CN111787231B - Focusing method, terminal equipment and computer readable storage medium - Google Patents
Focusing method, terminal equipment and computer readable storage medium Download PDFInfo
- Publication number
- CN111787231B CN111787231B CN202010763394.1A CN202010763394A CN111787231B CN 111787231 B CN111787231 B CN 111787231B CN 202010763394 A CN202010763394 A CN 202010763394A CN 111787231 B CN111787231 B CN 111787231B
- Authority
- CN
- China
- Prior art keywords
- value
- brightness
- preset
- shooting preview
- acquiring
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 238000001514 detection method Methods 0.000 claims description 86
- 238000004422 calculation algorithm Methods 0.000 claims description 70
- 238000012545 processing Methods 0.000 claims description 48
- 238000010606 normalization Methods 0.000 claims description 11
- 230000007613 environmental effect Effects 0.000 claims description 8
- 230000006870 function Effects 0.000 description 22
- 238000010586 diagram Methods 0.000 description 13
- 230000008569 process Effects 0.000 description 9
- 238000004891 communication Methods 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 4
- 230000001413 cellular effect Effects 0.000 description 3
- 238000004590 computer program Methods 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 239000011521 glass Substances 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 230000005236 sound signal Effects 0.000 description 2
- 230000001133 acceleration Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000007599 discharging Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 229910044991 metal oxide Inorganic materials 0.000 description 1
- 150000004706 metal oxides Chemical class 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 238000010079 rubber tapping Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000010897 surface acoustic wave method Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
- 210000000707 wrist Anatomy 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/67—Focus control based on electronic image sensor signals
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/63—Control of cameras or camera modules by using electronic viewfinders
- H04N23/631—Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters
- H04N23/632—Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters for displaying or modifying preview images prior to image capturing, e.g. variety of image resolutions or capturing parameters
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/67—Focus control based on electronic image sensor signals
- H04N23/673—Focus control based on electronic image sensor signals based on contrast or high frequency components of image signals, e.g. hill climbing method
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/67—Focus control based on electronic image sensor signals
- H04N23/675—Focus control based on electronic image sensor signals comprising setting of focusing regions
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Human Computer Interaction (AREA)
- Studio Devices (AREA)
- Automatic Focus Adjustment (AREA)
Abstract
The embodiment of the invention discloses a focusing method, terminal equipment and a computer readable storage medium, which are used for realizing rapid focusing when the terminal equipment shoots a preview image. The method provided by the embodiment of the invention comprises the following steps: acquiring current parameters; acquiring the direction of the focal position under the condition that the current parameter meets a preset condition; focusing by contrast automatic focusing according to the focal position direction; the current parameters comprise the brightness value of the environment where the terminal device is located, or the brightness value and/or the frame rate of the shooting preview image in the shooting preview interface of the terminal device.
Description
Technical Field
The present invention relates to the field of terminal device applications, and in particular, to a focusing method, a terminal device, and a computer-readable storage medium.
Background
With the rapid development of science and technology, people increasingly depend on terminal equipment. These terminal devices are no longer tools for simply communicating, and their shooting function has become a necessary extension of these terminal devices. With the improvement of life quality, people have higher and higher requirements on the focusing speed of the camera in the shooting process.
In the prior art, when the terminal device is in a dark environment, the terminal device generally starts the phase detection autofocus for focusing in order to ensure the definition of the image quality, and since the phase detection autofocus fails to focus in most dark environments, the contrast autofocus is started again. However, when using contrast autofocus, the focusing method may default to run from the far end to the near end of the terminal device, which is not flexible enough to set up and may lengthen the time-consuming process of the partial distance. Therefore, the automatic focusing mode adopted by the existing terminal device often requires the user to wait for a long period of time before completing focusing, so that the experience of the user is poor.
Disclosure of Invention
The embodiment of the invention provides a focusing method, terminal equipment and a computer readable storage medium, which are used for realizing rapid focusing when the terminal equipment shoots a preview image.
In view of this, a first aspect of an embodiment of the present invention provides a focusing method, which may include:
acquiring current parameters;
under the condition that the current parameter meets a preset condition, acquiring the position direction of a focus;
focusing by contrast automatic focusing according to the focal position direction;
the current parameter includes a brightness value of an environment where the terminal device is located, or a brightness value and/or a frame rate of a shooting preview image in a shooting preview interface of the terminal device.
Optionally, when the current parameter includes a brightness value of an environment where the terminal device is located, and when the current parameter meets a preset condition, acquiring a focus position direction, including: and under the condition that the brightness value of the environment where the terminal equipment is located is smaller than a preset environment brightness threshold, acquiring the direction of the focal position according to the DCC algorithm. Or,
if the current parameter includes a brightness value of an environment where the terminal device is located, and if the current parameter satisfies a preset condition, acquiring a focus position direction, including: and under the condition that the brightness value of the environment where the terminal equipment is located is greater than or equal to a preset environment brightness threshold value, acquiring the direction of the focal position through phase detection automatic focusing.
Optionally, when the current parameter includes a luminance value of an environment in which the terminal device is located, where the luminance value of the environment in which the terminal device is located is N, and N is an integer greater than or equal to 2, and when the current parameter meets a preset condition, obtaining the focal position direction includes: obtaining an environment brightness average value of N brightness values of the environment where the terminal equipment is located; and under the condition that the ambient brightness average value is smaller than the preset ambient brightness threshold value, acquiring the focus position direction according to the DCC algorithm. Or,
when the current parameter includes a luminance value of an environment in which the terminal device is located, where the luminance value of the environment in which the terminal device is located is N, where N is an integer greater than or equal to 2, and when the current parameter satisfies a preset condition, acquiring a focus position direction, including: obtaining an environment brightness average value of N brightness values of the environment where the terminal equipment is located; and under the condition that the ambient brightness average value is smaller than the preset ambient brightness threshold value, acquiring the focus position direction according to the DCC algorithm. And under the condition that the ambient brightness average value is greater than or equal to the preset ambient brightness threshold value, acquiring the direction of the focal position through phase detection automatic focusing.
Optionally, when the current parameter includes a brightness value and/or a frame rate of a preview image captured in a preview interface of the terminal device, and when the current parameter meets a preset condition, acquiring a focus position direction, including: and acquiring the direction of the focus position according to a DCC algorithm under the condition that the brightness value of the shooting preview image in the shooting preview interface of the terminal equipment is greater than a preset image brightness threshold value and/or the frame rate of the shooting preview image is less than a preset frame rate threshold value. Or,
when the current parameter includes a brightness value and/or a frame rate of a shooting preview image in a shooting preview interface of the terminal device, and when the current parameter satisfies a preset condition, acquiring a focus position direction, including: and acquiring the direction of the focal position through phase detection and automatic focusing under the condition that the brightness value of a shooting preview image in a shooting preview interface of the terminal equipment is less than or equal to a preset image brightness threshold value and/or the frame rate of the shooting preview image is greater than or equal to a preset frame rate threshold value.
Optionally, when the current parameter includes a luminance value and/or a frame rate of a shooting preview image in a shooting preview interface of the terminal device, the luminance value of the shooting preview image is P, the frame rate of the shooting preview image is Q, and P and Q are integers greater than or equal to 2, and when the current parameter meets a preset condition, the obtaining of the focus position direction includes: obtaining an image brightness average value of P brightness values of the shooting preview image in the shooting preview interface of the terminal equipment, and/or obtaining a frame rate average value of Q frame rates of the shooting preview image in the shooting preview interface of the terminal equipment; and acquiring the focus position direction according to the DCC algorithm under the condition that the image brightness average value is greater than the preset image brightness threshold value and/or the frame rate average value is less than the preset frame rate threshold value. Or,
when the current parameter includes a brightness value and/or a frame rate of a shooting preview image in a shooting preview interface of the terminal device, the brightness value of the shooting preview image is P, the frame rate of the shooting preview image is Q, and P and Q are integers greater than or equal to 2, and when the current parameter satisfies a preset condition, the obtaining of the focus position direction includes: obtaining an image brightness average value of P brightness values of the shooting preview image in the shooting preview interface of the terminal equipment, and/or obtaining a frame rate average value of Q frame rates of the shooting preview image in the shooting preview interface of the terminal equipment; and under the condition that the image brightness average value is less than or equal to the preset image brightness threshold value and/or the frame rate average value is greater than or equal to the preset frame rate threshold value, acquiring the direction of the focal position through phase detection automatic focusing.
Optionally, the obtaining the focal position direction according to the DCC algorithm includes: acquiring a coordinate information value of a phase detection pixel point in a shooting preview image; and acquiring the direction of the focal position according to the coordinate information value of the phase detection pixel point in the shot preview image and the DCC algorithm processing.
Optionally, the obtaining the focus position direction according to the DCC algorithm processing based on the coordinate information value of the photographed preview image includes: performing gain processing on the current green value of the phase detection pixel point to obtain a first green value of the phase detection pixel point; carrying out data normalization processing on the first green value of the phase detection pixel point to obtain a second green value of the phase detection pixel point; and acquiring the focus position direction according to the second green value of the phase detection pixel point and DCC algorithm processing.
A second aspect of an embodiment of the present invention provides a terminal device, which may include:
the acquisition module is used for acquiring current parameters; under the condition that the current parameter meets a preset condition, acquiring the position direction of a focus; the current parameters comprise the brightness value of the environment where the terminal equipment is located, or the brightness value and the frame rate of a shooting preview image in a shooting preview interface of the terminal equipment;
and the processing module is used for focusing through contrast automatic focusing according to the focus position direction.
Optionally, the obtaining module is specifically configured to, under a condition that the current parameter includes a brightness value of an environment where the terminal device is located, and under a condition that the brightness value of the environment where the terminal device is located is smaller than a preset environment brightness threshold, obtain the focal position direction according to a DCC algorithm. Or,
the obtaining module is specifically configured to, when the current parameter includes a brightness value of an environment where the terminal device is located, and when the brightness value of the environment where the terminal device is located is greater than or equal to a preset environment brightness threshold, obtain a focus position direction through phase detection autofocus.
Optionally, the obtaining module is specifically configured to, when the current parameter includes a luminance value of an environment in which the terminal device is located, where the luminance value of the environment in which the terminal device is located is N, and N is an integer greater than or equal to 2, obtain an average ambient luminance value of the N luminance values of the environment in which the terminal device is located; and under the condition that the ambient brightness average value is smaller than the preset ambient brightness threshold value, acquiring the focus position direction according to the DCC algorithm. Or,
the obtaining module is specifically configured to, when the current parameter includes a luminance value of an environment in which the terminal device is located, where the luminance value of the environment in which the terminal device is located is N, and N is an integer greater than or equal to 2, obtain an average ambient luminance value of the N luminance values of the environment in which the terminal device is located; and under the condition that the ambient brightness average value is smaller than the preset ambient brightness threshold value, acquiring the focus position direction according to the DCC algorithm. And under the condition that the ambient brightness average value is greater than or equal to the preset ambient brightness threshold value, acquiring the direction of the focal position through phase detection automatic focusing.
Optionally, the obtaining module is specifically configured to, under a condition that the current parameter includes a brightness value and/or a frame rate of a shooting preview image in a shooting preview interface of the terminal device, obtain, according to a DCC algorithm, a focus position direction when the brightness value of the shooting preview image in the shooting preview interface of the terminal device is greater than a preset image brightness threshold, and/or the frame rate of the shooting preview image is less than a preset frame rate threshold. Or,
the obtaining module is specifically configured to, under a condition that the current parameter includes a brightness value and/or a frame rate of a shooting preview image in a shooting preview interface of the terminal device, obtain a direction of a focal position according to a DCC algorithm under a condition that the brightness value of the shooting preview image in the shooting preview interface of the terminal device is greater than a preset image brightness threshold, and/or the frame rate of the shooting preview image is less than a preset frame rate threshold.
Optionally, the obtaining module is specifically configured to, when the current parameter includes a luminance value and/or a frame rate of a shooting preview image in a shooting preview interface of the terminal device, where the luminance value of the shooting preview image is P, the frame rate of the shooting preview image is Q, and P and Q are integers greater than or equal to 2, obtain an image luminance average value of P luminance values of the shooting preview image in the shooting preview interface of the terminal device, and/or obtain a frame rate average value of Q frame rates of the shooting preview image in the shooting preview interface of the terminal device; and acquiring the focus position direction according to the DCC algorithm under the condition that the image brightness average value is greater than the preset image brightness threshold value and/or the frame rate average value is less than the preset frame rate threshold value. Or,
the obtaining module is specifically configured to, when the current parameter includes a luminance value and/or a frame rate of a shooting preview image in a shooting preview interface of the terminal device, where the luminance value of the shooting preview image is P, the frame rate of the shooting preview image is Q, and P and Q are integers greater than or equal to 2, obtain an average image luminance value of P luminance values of the shooting preview image in the shooting preview interface of the terminal device, and/or obtain an average frame rate of Q frame rates of the shooting preview image in the shooting preview interface of the terminal device; and under the condition that the image brightness average value is less than or equal to the preset image brightness threshold value and/or the frame rate average value is greater than or equal to the preset frame rate threshold value, acquiring the direction of the focal position through phase detection automatic focusing.
Optionally, the obtaining module is specifically configured to obtain a coordinate information value of a phase detection pixel in the captured preview image; and acquiring the direction of the focal position according to the coordinate information value of the phase detection pixel point in the shot preview image and the DCC algorithm processing.
Optionally, the obtaining module is specifically configured to perform gain processing on the current green value of the phase detection pixel when the coordinate information value includes the current green value, so as to obtain a first green value of the phase detection pixel; carrying out data normalization processing on the first green value of the phase detection pixel point to obtain a second green value of the phase detection pixel point; and acquiring the focus position direction according to the second green value of the phase detection pixel point and DCC algorithm processing.
A third aspect of the embodiments of the present invention provides a terminal device, which may include:
a memory storing executable program code;
and a processor coupled to the memory;
the processor calls the executable program code stored in the memory for performing the method according to the first aspect of the embodiment of the present invention.
A fourth aspect of embodiments of the present invention provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the method according to the first aspect of embodiments of the present invention.
According to the technical scheme, the embodiment of the invention has the following advantages:
in the embodiment of the application, the current parameters are obtained; acquiring the direction of the focal position under the condition that the current parameter meets a preset condition; focusing by contrast automatic focusing according to the focal position direction; the current parameters comprise the brightness value of the environment where the terminal device is located, or the brightness value and/or the frame rate of the shooting preview image in the shooting preview interface of the terminal device. Under the condition that the obtained current parameters of the terminal equipment meet preset conditions, the direction of the focal position can be obtained according to DCC algorithm or phase detection automatic focusing, and focusing is carried out through contrast automatic focusing according to the obtained direction of the focal position, so that the situation that the contrast automatic focusing in the prior art can be carried out from the far end to the near end of the terminal equipment when the contrast automatic focusing is carried out is not needed, and quick focusing is realized.
Drawings
In order to more clearly illustrate the technical solution of the embodiments of the present invention, the drawings used in the description of the embodiments and the prior art will be briefly introduced below, and it is obvious that the drawings in the description are only some embodiments of the present invention, and other drawings can be obtained according to the drawings.
FIG. 1 is a schematic diagram of an embodiment of a focusing method in an embodiment of the invention;
FIG. 2 is a schematic diagram of a terminal device acquiring a direction of a focal position according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of another embodiment of a focusing method in an embodiment of the present invention;
FIG. 4 is a diagram of an embodiment of a terminal device in an embodiment of the present invention;
fig. 5 is a schematic diagram of another embodiment of the terminal device in the embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a focusing method, terminal equipment and a computer readable storage medium, which are used for realizing rapid focusing when the terminal equipment shoots a preview image.
In order to make the technical solutions of the present invention better understood by those skilled in the art, the technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. The embodiments based on the present invention should fall into the protection scope of the present invention.
It is understood that the terminal device according to the embodiment of the present invention may include a general handheld electronic terminal device, such as a mobile phone, a smart phone, a portable terminal, a Personal Digital Assistant (PDA), a Portable Multimedia Player (PMP) device, a notebook Computer, a notebook (Note Pad), a Wireless Broadband (Wibro) terminal, a tablet Computer (PC), a smart PC, a Point of Sales (POS), a car Computer, and the like.
The terminal device may also comprise a wearable device. The wearable device may be worn directly on the user or may be a portable electronic device integrated into the user's clothing or accessories. Wearable equipment is not only a hardware equipment, can realize powerful intelligent function through software support and data interaction, high in the clouds interaction more, for example: the system has the functions of calculation, positioning and alarming, and can be connected with a mobile phone and various terminals. Wearable devices may include, but are not limited to, wrist-supported watch types (e.g., wrist watches, wrist-supported products), foot-supported shoes types (e.g., shoes, socks, or other leg-worn products), head-supported Glass types (e.g., glasses, helmets, headbands, etc.), and various types of non-mainstream products such as smart clothing, bags, crutches, accessories, and the like.
In the following, a brief description of the terms involved in the embodiments of the present invention is given as follows:
DCC algorithm: the DCC algorithm is a self-defined algorithm for identifying the position relation between PD pixel points and a motor when the terminal equipment is in a dark environment.
PDAF: phase Detection Auto Focus, Phase Detection Auto Focus. The phase detection automatic focusing can accurately know which direction the set distance needs to be changed; the phase detection automatic focusing speed is high, the method is suitable for moving objects, the full-function is wide-angle, the automatic focusing area is limited, and the front focus and the rear focus are risky.
CAF: contrast Auto Focus. The contrast automatic focusing is very accurate, has no minimum aperture requirement, is slow, has enough light during shooting, does not support fast moving objects, and has high power consumption.
PD: phase Detection, Phase Detection.
G: green, Green. And the green color is a green pixel point in a shooting preview image pixel of the terminal equipment shooting preview interface.
R: red, Red. And green is a red pixel point in a shooting preview image pixel of the terminal equipment shooting preview interface.
B: blue, Blue. And the green color is a blue pixel point in a shooting preview image pixel of the terminal equipment shooting preview interface.
And the RGB is a three-primary-color pixel point in a shooting preview image pixel of the terminal equipment shooting preview interface.
COMS: complementary Metal Oxide Semiconductor (CMOS). The CMOS refers to a technology for manufacturing large-scale integrated circuit chips or chips manufactured by the technology, and is a readable and writable RAM chip on a computer mainboard. Because of its readable and writable property, it is used to store the data after BIOS has set the hardware parameters of computer on the computer mainboard, and this COMS chip is only used to store data.
BIOS: basic Input Output System, Basic Input Output System. The BIOS is the first software loaded at startup of the personal computer. It is a set of programs solidified on a ROM chip on the internal mainboard of computer, it stores the most important basic input and output program of computer, self-checking program after starting up and system self-starting program, it can read and write the specific information set by system from CMOS. Its primary function is to provide the lowest level, most direct hardware setup and control for the computer.
ROM: Read-Only Memory. The ROM may store a medium of program code.
RAM: random Access Memory, Random Access Memory. The RAM may store media of program code.
The following further describes the technical solution of the present invention by way of an embodiment, as shown in fig. 1, which is a schematic diagram of an embodiment of a focusing method in the embodiment of the present invention, and the method may include:
101. and acquiring current parameters, wherein the current parameters comprise brightness values of environments where the terminal equipment is located.
It is understood that the current parameters including the brightness value of the environment where the terminal device is located can be identified and obtained by the high-precision light-sensitive sensor.
Optionally, before the terminal device obtains the current parameter, it may be determined whether the terminal device meets a preset condition. If the terminal device meets at least one of the preset conditions, the terminal device may obtain the current parameters. Wherein the preset conditions include: the residual memory of the terminal equipment is larger than a preset memory threshold value; the current temperature of the terminal equipment is smaller than a preset temperature threshold; and the residual electric quantity of the terminal equipment is larger than a preset electric quantity threshold value. Illustratively, the preset power threshold of the terminal device is 50%, and when the remaining power is greater than or equal to 50% of the preset power threshold, the terminal device may obtain the current parameter.
102. And acquiring the direction of the focal position under the condition that the current parameter meets a preset condition.
It can be understood that, under the condition that the current parameter of the terminal device meets the preset condition, that is, under the condition that the brightness value of the environment where the terminal device is located is less than the preset environment brightness threshold, at this time, the terminal device may be considered to be currently located in a dark environment, and at this time, the terminal device may obtain the focus position direction according to the DCC algorithm; or, when the current parameter of the terminal device satisfies the preset condition, that is, when the brightness value of the environment where the terminal device is located is greater than or equal to the preset environment brightness threshold, it may be considered that the terminal device is currently located in a bright environment, and at this time, the terminal device may obtain the focus position direction through the PDAF.
Optionally, the obtaining, by the terminal device, the focal position direction when the current parameter meets the preset condition may include, but is not limited to, the following implementation manners:
implementation mode 1: and the terminal equipment acquires the focus position direction according to the DCC algorithm under the condition that the brightness value of the environment where the terminal equipment is located is smaller than a preset environment brightness threshold.
For example, assuming that the preset environment brightness threshold is 260 illuminance (lux), the brightness value of the environment in which the terminal device is located is 230lux, and at this time, the brightness value 230lux of the environment in which the terminal device is located is less than the preset environment brightness threshold 260lux, then it may be considered that the terminal device is currently located in a dark environment, so the terminal device may obtain the focus position direction according to the DCC algorithm.
Implementation mode 2: and the terminal equipment acquires the direction of the focal position through the PDAF under the condition that the brightness value of the environment where the terminal equipment is located is greater than or equal to a preset environment brightness threshold value.
For example, assuming that the preset environment brightness threshold is 260 illuminance (lux), the brightness value of the environment where the terminal device is located is 280lux, and at this time, the brightness value of the environment where the terminal device is located is 280lux greater than the preset environment brightness threshold 260lux, then it may be considered that the terminal device is currently in a bright environment, so the terminal device may obtain the focus position direction through the PDAF.
Implementation mode 3: when the current parameter of the terminal equipment comprises the brightness value of the environment where the terminal equipment is located, the brightness value of the environment where the terminal equipment is located is N, and N is an integer greater than or equal to 2, the terminal equipment obtains the average value of the environment brightness of the N brightness values of the environment where the terminal equipment is located; and the terminal equipment acquires the focus position direction according to the DCC algorithm under the condition that the environment brightness average value is smaller than the preset environment brightness threshold value.
For example, assuming that the preset ambient brightness threshold is 260lux, 3 brightness values of the environment where the terminal device is located are obtained, which are 240lux, 250lux, and 260lux, respectively, and the average value of the ambient brightness of the terminal device is obtained to be 250lux, at this time, the brightness value 250lux of the environment where the terminal device is located is smaller than the preset ambient brightness threshold 260lux, then it may be considered that the terminal device is currently located in a dark environment, so the terminal device may obtain the focus position direction according to the DCC algorithm.
Implementation mode 4: when the current parameter of the terminal equipment comprises the brightness value of the environment where the terminal equipment is located, the brightness value of the environment where the terminal equipment is located is N, and N is an integer greater than or equal to 2, the terminal equipment obtains the average value of the environment brightness of the N brightness values of the environment where the terminal equipment is located; and the terminal equipment acquires the direction of the focal position through the PDAF under the condition that the average value of the ambient brightness is greater than or equal to the preset ambient brightness threshold value.
For example, assuming that the preset environment brightness threshold is 260lux, 3 brightness values of the environment where the terminal device is located are obtained, which are 250lux, 270lux, and 290lux, respectively, and the average value of the environment brightness is 270lux, at this time, the brightness value 270lux of the environment where the terminal device is located is greater than the preset environment brightness threshold 260lux, then it may be considered that the terminal device is currently located in a bright environment, so the terminal device may obtain the focus position direction through the PDAF.
It can be understood that, when the terminal device acquires the N brightness values of the environment where the terminal device is located, the time interval for acquiring the two adjacent brightness values may be equal in duration, or may be unequal in duration, and is not limited herein.
Optionally, in implementation 1 or 3 above, the obtaining the focal position direction according to the DCC algorithm may include: acquiring a coordinate information value of a phase detection pixel point in a shooting preview image; and acquiring the direction of the focal position according to the coordinate information value of the phase detection pixel point in the shot preview image and the DCC algorithm processing.
Further, fig. 2 is a schematic diagram of a terminal device acquiring a focus position direction in the embodiment of the present invention. Wherein, the coordinate information value includes a current green value, and the obtaining of the focus position direction according to the coordinate information value of the shooting preview image and the DCC algorithm processing includes: 201. performing gain processing on the current green value of the phase detection pixel point to obtain a first green value of the phase detection pixel point; 202. performing data normalization processing on the first green value of the phase detection pixel point to obtain a second green value of the phase detection pixel point; 203. and acquiring the direction of the focal position according to the second green value of the phase detection pixel point and DCC algorithm processing.
It can be understood that the photographed preview image includes coordinate information values of PD pixel points and non-PD pixel points. The coordinate information value of the PD pixel point contains a coordinate information value of a green pixel point G (hereinafter referred to as a green value, namely a G value), a coordinate information value of a red pixel point R and a coordinate information value of a blue pixel point B.
And under the condition that the brightness value of the environment where the terminal device is located is smaller than a preset environment brightness threshold value, the terminal device can be considered to be currently located in a dark environment. The terminal equipment firstly acquires a coordinate information value of a PD pixel point in a shot preview image; obtaining a current G value in the coordinate information values of the PD pixel points in the shot preview image, and obtaining a first G value through gain processing on the current G value, wherein the obtained G value is smaller and needs to be increased through gain, so that the gain processing is performed on the current G value, and the current G value of the PD pixel points is improved; because the current parameters of the terminal equipment meet the preset conditions, the first G value obtained after the gain is possibly not compared in the phase comparison process, then the first G value is subjected to data normalization processing to obtain a second G value, the brightness of the second G value is improved at the moment, and the PD pixel points are highlighted; and then the terminal equipment can perform phase comparison according to the second G value after the brightness is improved, and finally the focal position direction is obtained. The data normalization processing may be fourier transform, and is not specifically limited herein; and the coordinate information value of the PD pixel point is acquired by the sensor identification in the COMS.
The terminal equipment directly distinguishes scenes after judging the environment brightness, when the terminal equipment is determined to be in a dark environment, the G value brightness in the PD pixel point is improved, so that the coordinate information value is obtained, CAF is assisted to find the focusing direction for focusing according to the coordinate information value of the PD pixel point, and rapid focusing is realized.
Optionally, the terminal device may directly measure the focusing distance according to the infrared device, and start the CAF to focus through the motor.
It is to be understood that the focus position direction may be located in a target direction of the motor, and the target direction may be located above, below, left, right, above-left, below-left, above-right, and below-right of the motor, which is not particularly limited herein; the motor is a device for providing power when CAF is provided in the camera for focusing.
103. And focusing through contrast automatic focusing according to the direction of the focal position.
And the terminal equipment controls the motor to focus through contrast automatic focusing according to the direction of the focus position.
In the embodiment of the invention, the terminal equipment firstly acquires the environment brightness value or the environment brightness average value, compares the environment brightness value or the environment brightness average value with the preset environment brightness threshold value, and if the environment brightness value or the environment brightness average value is smaller than the preset environment brightness threshold value, the terminal equipment firstly passes through the PDAF and then focuses through the CAF; and if the environment brightness value or the environment brightness average value is greater than or equal to the preset environment brightness threshold value, the terminal equipment focuses through CAF according to the DCC algorithm. The CAF does not need to be operated from the far end to the near end of the terminal equipment for focusing when the CAF is used for focusing in the prior art, so that the rapid focusing is realized.
As shown in fig. 3, which is a schematic diagram of another embodiment of a focusing method in an embodiment of the present invention, the focusing method may include:
301. and acquiring current parameters, wherein the current parameters comprise the brightness value and/or the frame rate of a shooting preview image in a shooting preview interface of the terminal equipment.
It is understood that the current parameters including the brightness value and the frame rate of the shooting preview image in the shooting preview interface of the terminal device can be identified and acquired by the sensor in the cmos.
Optionally, before the terminal device obtains the current parameter, it may be determined whether the terminal device meets a preset condition. The terminal device may obtain the current parameter if the terminal device satisfies at least one of the preset conditions. Wherein the preset conditions include: the residual memory of the terminal equipment is larger than a preset memory threshold value; the current temperature of the terminal equipment is smaller than a preset temperature threshold; and the residual electric quantity of the terminal equipment is larger than a preset electric quantity threshold value. Illustratively, the preset temperature threshold of the terminal device is 25 degrees celsius, and when the current temperature is less than the preset temperature threshold by 25 degrees celsius, the terminal device may obtain the current parameter.
302. And acquiring the direction of the focal position under the condition that the current parameter meets a preset condition.
It can be understood that, in a case that the brightness value of the captured preview image in the captured preview interface of the terminal device is greater than the preset image brightness threshold, and/or the frame rate of the captured preview image is less than the preset frame rate threshold, at this time, it may be considered that the terminal device is currently in a dark environment, and at this time, the terminal device may obtain the focus position direction according to the DCC algorithm. Or,
and under the condition that the brightness value of the shot preview image in the shooting preview interface of the terminal equipment is less than or equal to a preset image brightness threshold value and/or the frame rate of the shot preview image is greater than or equal to a preset frame rate threshold value, the terminal equipment can be considered to be in a bright environment at the moment, and at the moment, the terminal equipment can acquire the focus position direction through phase detection automatic focusing.
Optionally, the obtaining, by the terminal device, the focus position direction when the current parameter meets the preset condition may include, but is not limited to, the following implementation manners:
implementation mode 1: and the terminal equipment acquires the direction of the focus position according to the DCC algorithm under the condition that the brightness value of the shooting preview image in the shooting preview interface of the terminal equipment is greater than a preset image brightness threshold value and/or the frame rate of the shooting preview image is less than a preset frame rate threshold value.
Illustratively, assuming that the preset image brightness threshold is 260lux, the brightness value of the photographed preview image is 280lux, and the frame rate of the photographed preview image is 13 frames per second (fps), at which time the brightness value of the photographed preview image is greater than the preset image brightness threshold, and the frame rate of the photographed preview image is less than the preset frame rate threshold, at which time the terminal device may be considered to be currently in a dark environment, so the terminal device may acquire the focus position direction according to the DCC algorithm.
Implementation mode 2: the terminal equipment acquires the direction of the focal position through phase detection automatic focusing under the condition that the brightness value of a shooting preview image in a shooting preview interface of the terminal equipment is less than or equal to a preset image brightness threshold value and/or the frame rate of the shooting preview image is greater than or equal to a preset frame rate threshold value.
For example, assuming that the preset image brightness threshold is 260lux, the preset frame rate threshold is 16fps, the brightness value of the shooting preview image is 250lux, and the frame rate of the shooting preview image is 13fps, at this time, the brightness value of the shooting preview image 250lux is smaller than the preset image brightness threshold 260lux, and at this time, the terminal device may be considered to be currently in a bright environment, so the terminal device may acquire the focus position direction through phase detection autofocus.
Implementation mode 3: when the current parameters of the terminal equipment comprise the brightness values and/or the frame rates of shooting preview images in a shooting preview interface of the terminal equipment, the brightness values of the shooting preview images are P, the frame rates of the shooting preview images are Q, and P and Q are integers which are more than or equal to 2, the terminal equipment obtains the image brightness average value of the P brightness values of the shooting preview images in the shooting preview interface of the terminal equipment, and/or the frame rate average value of the Q frame rates of the shooting preview images in the shooting preview interface of the terminal equipment; and the terminal equipment acquires the focal position direction according to the DCC algorithm under the condition that the image brightness average value is greater than the preset image brightness threshold value and/or the frame rate average value is less than the preset frame rate threshold value.
For example, assuming that the preset image brightness threshold is 260lux, the preset frame rate threshold is 16fps, 2 brightness values of the captured preview image are obtained, which are 250lux and 280lux, respectively, and 2 frame rates of the captured preview image are 18fps and 10fps, respectively, the average value of the image brightness is 265lux and the average value of the frame rate is 14fps, at this time, the average value of the image brightness 265lux is greater than the preset image brightness threshold 260lux, and the average value of the frame rate is 14fps less than the preset frame rate threshold 16fps, at this time, the terminal device may be considered to be currently in a dark environment, so the terminal device may obtain the focus position direction according to the DCC algorithm.
Implementation mode 4: when the current parameters of the terminal equipment comprise the brightness values and/or the frame rates of shooting preview images in a shooting preview interface of the terminal equipment, the brightness values of the shooting preview images are P, the frame rates of the shooting preview images are Q, and P and Q are integers which are more than or equal to 2, the terminal equipment obtains the image brightness average value of the P brightness values of the shooting preview images in the shooting preview interface of the terminal equipment, and/or the frame rate average value of the Q frame rates of the shooting preview images in the shooting preview interface of the terminal equipment; and the terminal equipment acquires the direction of the focal position through phase detection automatic focusing under the condition that the image brightness average value is less than or equal to the preset image brightness threshold value and/or the frame rate average value is greater than or equal to the preset frame rate threshold value.
For example, assuming that the preset image brightness threshold is 260lux, the preset frame rate threshold is 16fps, 2 brightness values of the shooting preview image are obtained, which are 250lux and 280lux respectively, and 2 frame rates of the shooting preview image are 18fps and 20fps respectively, the average value of the image brightness is 265lux and the average value of the frame rate is 19fps, at this time, the average value of the image brightness 265lux is greater than the preset image brightness threshold 260lux, at this time, the terminal device may be considered to be currently in a bright environment, so the terminal device may obtain the focus position direction through phase detection autofocus.
It can be understood that, when the terminal device obtains P brightness values of the preview images captured in the capture preview interface of the terminal device, and/or when Q frame rates of the preview images captured in the capture preview interface of the terminal device are obtained, time intervals for obtaining two adjacent brightness values and/or two adjacent frame rates may be equal in duration, or may be unequal in duration, and is not limited herein.
Optionally, in implementation 1 or 3 above, the obtaining the focal position direction according to the DCC algorithm may include: acquiring a coordinate information value of a phase detection pixel point in a shooting preview image; and acquiring the direction of the focal position according to the coordinate information value of the phase detection pixel point in the shot preview image and DCC algorithm processing.
Further, fig. 2 is a schematic diagram of a terminal device acquiring a focus position direction in the embodiment of the present invention. Wherein, the coordinate information value includes a current green value, and the obtaining of the focus position direction according to the coordinate information value of the shooting preview image and the DCC algorithm processing includes: 201. performing gain processing on the current green value of the phase detection pixel point to obtain a first green value of the phase detection pixel point; 202. performing data normalization processing on the first green value of the phase detection pixel point to obtain a second green value of the phase detection pixel point; 203. and acquiring the direction of the focal position according to the second green value of the phase detection pixel point and DCC algorithm processing.
It can be understood that the photographed preview image includes coordinate information values of PD pixel points and non-PD pixel points. The coordinate information value of the PD pixel point contains a coordinate information value of a green pixel point G (hereinafter referred to as a green value, namely a G value), a coordinate information value of a red pixel point R and a coordinate information value of a blue pixel point B.
And under the condition that the brightness value of the environment where the terminal device is located is smaller than a preset environment brightness threshold value, the terminal device can be considered to be currently located in a dark environment. The terminal equipment firstly acquires a coordinate information value of a PD pixel point in a shot preview image; obtaining a current G value in the coordinate information values of the PD pixel points in the shot preview image, and obtaining a first G value through gain processing on the current G value, wherein the obtained G value is smaller and needs to be increased through gain, so that the gain processing is performed on the current G value, and the current G value of the PD pixel points is improved; because the current parameters of the terminal equipment meet the preset conditions, the first G value obtained after the gain can not be compared in the phase comparison process, then the data normalization processing is carried out on the first G value to obtain a second G value, the brightness of the second G value is improved at the moment, and the PD pixel points are highlighted; and then the terminal equipment can perform phase comparison according to the second G value after the brightness is improved, and finally the focal position direction is obtained. The data normalization processing may be fourier transform, and is not specifically limited herein; and the coordinate information value of the PD pixel point is obtained by the identification of a sensor in the COMS.
The terminal equipment directly distinguishes scenes after judging the environment brightness, when the terminal equipment is determined to be in a dark environment, the G value brightness in the PD pixel point is improved, so that the coordinate information value is obtained, CAF is assisted to find the focusing direction for focusing according to the coordinate information value of the PD pixel point, and rapid focusing is realized.
Optionally, the terminal device may directly measure the focusing distance according to the infrared device, and start the CAF to focus through the motor.
It is to be understood that the focus position direction may be located in a target direction of the motor, and the target direction may be located above, below, left, right, above-left, below-left, above-right, and below-right of the motor, which is not particularly limited herein; the motor is a device for providing power when CAF is provided in the camera for focusing.
303. And focusing through contrast automatic focusing according to the direction of the focal position.
It should be noted that step 303 is similar to step 1103 shown in fig. 1, and is not described here again.
In the embodiment of the invention, terminal equipment firstly acquires the brightness value and/or the frame rate of a shooting preview image, or the average value of the brightness and/or the average value of the frame rate of the shooting preview image; and comparing the brightness value or the average value of the brightness of the shot preview image with a preset image brightness threshold value, and/or comparing the frame rate of the shot preview image or the average value of the frame rate of the shot preview image with a preset frame rate threshold value. If the brightness value of the shot preview image in the shot preview interface is larger than a preset image brightness threshold value and/or the frame rate of the shot preview image is smaller than a preset frame rate threshold value, the terminal equipment firstly performs DCC algorithm; focusing through CAF; or, if the brightness value of the shot preview image in the shot preview interface is less than or equal to a preset image brightness threshold value, and/or the frame rate of the shot preview image is greater than or equal to a preset frame rate threshold value, the terminal device performs focusing through the PDAF and then the CAF.
The PDAF and DCC algorithms both have the function of providing a focus position direction for the CAF so that the CAF can directly find the focus position direction. According to the method, the terminal equipment judges the brightness value and the frame rate in the shot preview image, the focusing process is directly distinguished, the PDAF or DCC algorithm is used for directly providing the focus position direction for the CAF, and the CAF does not need to be operated from the far end to the near end of the terminal equipment for focusing in the prior art, so that the rapid focusing is realized.
As shown in fig. 4, which is a schematic diagram of an embodiment of a terminal device in the embodiment of the present invention, the schematic diagram may include:
an obtaining module 401, configured to obtain a current parameter; acquiring the direction of the focal position under the condition that the current parameter meets a preset condition; the current parameters comprise the brightness value of the environment where the terminal equipment is located, or the brightness value and the frame rate of a shooting preview image in a shooting preview interface of the terminal equipment;
and a processing module 402, configured to perform focusing through contrast autofocus according to the focus position direction.
Alternatively, in some embodiments of the invention,
the obtaining module 401 is specifically configured to, under the condition that the current parameter includes a brightness value of an environment where the terminal device is located, and under the condition that the brightness value of the environment where the terminal device is located is smaller than a preset environment brightness threshold, obtain the focal position direction according to a DCC algorithm. Or,
the obtaining module 401 is specifically configured to, when the current parameter includes a brightness value of an environment where the terminal device is located, and when the brightness value of the environment where the terminal device is located is greater than or equal to a preset environment brightness threshold, obtain the direction of the focal position through phase detection autofocus.
Alternatively, in some embodiments of the present invention,
the obtaining module 401 is specifically configured to, when the current parameter includes a luminance value of an environment in which the terminal device is located, where the luminance value of the environment in which the terminal device is located is N, and N is an integer greater than or equal to 2, obtain an average ambient luminance value of the N luminance values of the environment in which the terminal device is located; and under the condition that the average value of the environmental brightness is smaller than the preset environmental brightness threshold value, acquiring the direction of the focal position according to a DCC algorithm. Or,
the obtaining module 401 is specifically configured to, when the current parameter includes a luminance value of an environment in which the terminal device is located, where the luminance value of the environment in which the terminal device is located is N, and N is an integer greater than or equal to 2, obtain an average ambient luminance value of the N luminance values of the environment in which the terminal device is located; and under the condition that the average value of the environmental brightness is smaller than the preset environmental brightness threshold value, acquiring the direction of the focal position according to a DCC algorithm. And under the condition that the ambient brightness average value is greater than or equal to the preset ambient brightness threshold value, acquiring the direction of the focal position through phase detection automatic focusing.
Alternatively, in some embodiments of the present invention,
the obtaining module 401 is specifically configured to, under the condition that the current parameter includes a brightness value and/or a frame rate of a shooting preview image in a shooting preview interface of the terminal device, obtain a focus position direction according to a DCC algorithm under the condition that the brightness value of the shooting preview image in the shooting preview interface of the terminal device is greater than a preset image brightness threshold, and/or the frame rate of the shooting preview image is less than a preset frame rate threshold. Or,
the obtaining module 401 is specifically configured to, under the condition that the current parameter includes a brightness value and/or a frame rate of a shooting preview image in a shooting preview interface of the terminal device, obtain a focus position direction according to a DCC algorithm under the condition that the brightness value of the shooting preview image in the shooting preview interface of the terminal device is greater than a preset image brightness threshold, and/or the frame rate of the shooting preview image is less than a preset frame rate threshold.
Alternatively, in some embodiments of the present invention,
an obtaining module 401, configured to specifically obtain an average value of image brightness values of P brightness values of the preview images captured in the preview image capturing interface of the terminal device and/or an average value of Q frame rates of the preview images captured in the preview image capturing interface of the terminal device when the current parameter includes a brightness value and/or a frame rate of the preview images captured in the preview image capturing interface of the terminal device, the brightness values of the preview images captured are P, the frame rate of the preview images captured is Q, and P and Q are integers greater than or equal to 2; and acquiring the focus position direction according to the DCC algorithm under the condition that the image brightness average value is greater than the preset image brightness threshold value and/or the frame rate average value is less than the preset frame rate threshold value. Or,
an obtaining module 401, configured to specifically obtain an average value of image brightness values of P brightness values of the preview images captured in the preview image capturing interface of the terminal device and/or an average value of Q frame rates of the preview images captured in the preview image capturing interface of the terminal device when the current parameter includes a brightness value and/or a frame rate of the preview images captured in the preview image capturing interface of the terminal device, the brightness values of the preview images captured are P, the frame rate of the preview images captured is Q, and P and Q are integers greater than or equal to 2; and acquiring the direction of the focal position through phase detection automatic focusing under the condition that the image brightness average value is less than or equal to the preset image brightness threshold value and/or the frame rate average value is greater than or equal to the preset frame rate threshold value.
Alternatively, in some embodiments of the present invention,
an obtaining module 401, configured to specifically obtain a coordinate information value of a phase detection pixel in a captured preview image; and acquiring the direction of the focal position according to the coordinate information value of the phase detection pixel point in the shot preview image and the DCC algorithm processing.
Alternatively, in some embodiments of the present invention,
an obtaining module 401, configured to perform gain processing on the current green value of the phase detection pixel specifically when the coordinate information value includes the current green value, to obtain a first green value of the phase detection pixel; performing data normalization processing on the first green value of the phase detection pixel point to obtain a second green value of the phase detection pixel point; and acquiring the direction of the focal position according to the second green value of the phase detection pixel point and DCC algorithm processing.
Fig. 5 is a schematic diagram of another embodiment of a terminal device in an embodiment of the present invention, and fig. 5 is a block diagram of a partial structure of a mobile phone related to the terminal device provided in the embodiment of the present invention. Referring to fig. 5, the handset includes: radio Frequency (RF) circuit 510, memory 520, input unit 530, display unit 540, sensor 550, audio circuit 560, Wireless Fidelity (WiFi) module 560, processor 580, and power supply 590. Those skilled in the art will appreciate that the handset configuration shown in fig. 5 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following describes each component of the mobile phone in detail with reference to fig. 5:
The memory 520 may be used to store software programs and modules, and the processor 580 executes various functional applications and data processing of the mobile phone by operating the software programs and modules stored in the memory 520. The memory 520 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 520 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 530 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the cellular phone. Specifically, the input unit 530 may include a touch panel 531 and other input devices 532. The touch panel 531, also called a touch screen, can collect touch operations of a user on or near the touch panel 531 (for example, operations of the user on or near the touch panel 531 by using any suitable object or accessory such as a finger or a stylus pen), and drive the corresponding connection device according to a preset program. Alternatively, the touch panel 531 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, and sends the touch point coordinates to the processor 580, and can receive and execute commands sent by the processor 580. In addition, the touch panel 531 may be implemented by various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 530 may include other input devices 532 in addition to the touch panel 531. In particular, other input devices 532 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 540 may be used to display information input by the user or information provided to the user and various menus of the mobile phone. The Display unit 540 may include a Display panel 541, and optionally, the Display panel 541 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch panel 531 may cover the display panel 541, and when the touch panel 531 detects a touch operation on or near the touch panel 531, the touch panel is transmitted to the processor 580 to determine the type of the touch event, and then the processor 580 provides a corresponding visual output on the display panel 541 according to the type of the touch event. Although the touch panel 531 and the display panel 541 are shown as two separate components in fig. 5 to implement the input and output functions of the mobile phone, in some embodiments, the touch panel 531 and the display panel 541 may be integrated to implement the input and output functions of the mobile phone.
The handset may also include at least one sensor 550, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 541 according to the brightness of ambient light, and the proximity sensor may turn off the display panel 541 and/or the backlight when the mobile phone is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when stationary, and can be used for applications of recognizing the posture of a mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured on the mobile phone, the description is omitted here.
WiFi belongs to short-distance wireless transmission technology, and the mobile phone can help a user to receive and send e-mails, browse webpages, access streaming media and the like through the WiFi module 560, and provides wireless broadband Internet access for the user. Although fig. 5 shows the WiFi module 560, it is understood that it does not belong to the essential constitution of the handset, and can be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 580 is a control center of the mobile phone, connects various parts of the entire mobile phone by using various interfaces and lines, and performs various functions of the mobile phone and processes data by operating or executing software programs and/or modules stored in the memory 520 and calling data stored in the memory 520, thereby performing overall monitoring of the mobile phone. Alternatively, processor 580 may include one or more processing units; preferably, the processor 580 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 580.
The handset also includes a power supply 590 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 580 via a power management system, such that the power management system may be used to manage charging, discharging, and power consumption.
Although not shown, the mobile phone may further include a camera, a bluetooth module, etc., which are not described herein.
In this embodiment of the present invention, the processor 580 included in the terminal device further has the following functions:
acquiring current parameters;
acquiring the direction of the focal position under the condition that the current parameter meets a preset condition;
focusing by contrast automatic focusing according to the focal position direction;
the current parameters comprise the brightness value of the environment where the terminal device is located, or the brightness value and the frame rate of a shooting preview image in a shooting preview interface of the terminal device.
Optionally, the processor 580 also has the following functions:
under the condition that the current parameter comprises the brightness value of the environment where the terminal equipment is located and under the condition that the brightness value of the environment where the terminal equipment is located is smaller than a preset environment brightness threshold, acquiring the direction of the focal position according to a DCC algorithm; or,
and under the condition that the current parameter comprises the brightness value of the environment where the terminal equipment is located and under the condition that the brightness value of the environment where the terminal equipment is located is greater than or equal to a preset environment brightness threshold value, acquiring the direction of the focal position through phase detection automatic focusing.
Optionally, the processor 580 also has the following functions:
obtaining an environment brightness average value of N brightness values of the environment where the terminal device is located under the condition that the current parameter includes the brightness value of the environment where the terminal device is located, the brightness value of the environment where the terminal device is located is N, and N is an integer greater than or equal to 2; under the condition that the average value of the environmental brightness is smaller than the preset environmental brightness threshold value, acquiring the direction of the focal position according to a DCC algorithm; or,
when the current parameter comprises the brightness value of the environment where the terminal equipment is located, the brightness value of the environment where the terminal equipment is located is N, and N is an integer greater than or equal to 2, calculating the average value of the environment brightness of the N brightness values of the environment where the terminal equipment is located; and under the condition that the ambient brightness average value is greater than or equal to the preset ambient brightness threshold value, acquiring the direction of the focal position through phase detection automatic focusing.
Optionally, the processor 580 also has the following functions:
under the condition that the current parameters comprise the brightness value and/or the frame rate of a shooting preview image in a shooting preview interface of the terminal equipment, under the condition that the brightness value of the shooting preview image in the shooting preview interface of the terminal equipment is larger than a preset image brightness threshold value, and/or under the condition that the frame rate of the shooting preview image is smaller than a preset frame rate threshold value, acquiring the direction of the focal position according to a DCC algorithm; or,
and under the condition that the current parameters comprise the brightness value and/or the frame rate of the shooting preview image in the shooting preview interface of the terminal equipment, acquiring the direction of the focus position according to a DCC algorithm under the condition that the brightness value of the shooting preview image in the shooting preview interface of the terminal equipment is greater than a preset image brightness threshold value and/or the frame rate of the shooting preview image is less than a preset frame rate threshold value.
Optionally, the processor 580 also has the following functions:
when the current parameters comprise the brightness values and/or the frame rates of shooting preview images in a shooting preview interface of the terminal equipment, the brightness values of the shooting preview images are P, the frame rates of the shooting preview images are Q, and P and Q are integers which are more than or equal to 2, the average value of the image brightness values of the P brightness values of the shooting preview images in the shooting preview interface of the terminal equipment is obtained, and/or the average value of the frame rates of the Q frame rates of the shooting preview images in the shooting preview interface of the terminal equipment is obtained; under the condition that the image brightness average value is larger than the preset image brightness threshold value and/or the frame rate average value is smaller than the preset frame rate threshold value, acquiring the focal position direction according to a DCC algorithm; or,
when the current parameters comprise the brightness values and/or the frame rates of shooting preview images in a shooting preview interface of the terminal equipment, the brightness values of the shooting preview images are P, the frame rates of the shooting preview images are Q, and P and Q are integers which are more than or equal to 2, the average value of the image brightness values of the P brightness values of the shooting preview images in the shooting preview interface of the terminal equipment is obtained, and/or the average value of the frame rates of the Q frame rates of the shooting preview images in the shooting preview interface of the terminal equipment is obtained; and acquiring the direction of the focal position through phase detection automatic focusing under the condition that the image brightness average value is less than or equal to the preset image brightness threshold value and/or the frame rate average value is greater than or equal to the preset frame rate threshold value.
Optionally, the processor 580 also has the following functions:
acquiring a coordinate information value of a phase detection pixel point in a shooting preview image; and acquiring the direction of the focal position according to the coordinate information value of the phase detection pixel point in the shot preview image and the DCC algorithm processing.
Optionally, the processor 580 also has the following functions:
the coordinate information value comprises a current green value, and the current green value of the phase detection pixel point is subjected to gain processing to obtain a first green value of the phase detection pixel point; performing data normalization processing on the first green value of the phase detection pixel point to obtain a second green value of the phase detection pixel point; and acquiring the direction of the focal position according to the second green value of the phase detection pixel point and DCC algorithm processing.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product.
The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can store or a data storage device, such as a server, a data center, etc., that is integrated with one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is substantially or partly contributed by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (8)
1. A focusing method, comprising:
acquiring current parameters;
acquiring the direction of the focal position under the condition that the current parameter meets a preset condition;
focusing by contrast automatic focusing according to the focal position direction;
the current parameters comprise the brightness value of the environment where the terminal equipment is located, or the brightness value and/or the frame rate of a shooting preview image in a shooting preview interface of the terminal equipment;
the acquiring the focus position direction under the condition that the current parameter meets the preset condition includes:
under the condition that the brightness value of the environment where the terminal equipment is located is smaller than a preset environment brightness threshold value, acquiring the direction of the focal position according to a DCC algorithm; or,
under the condition that the brightness value of the environment where the terminal equipment is located is larger than or equal to the preset environment brightness threshold value, the focus position direction is obtained through phase detection automatic focusing; or,
acquiring the direction of the focus position according to the DCC algorithm under the condition that the brightness value of a shooting preview image in a shooting preview interface of the terminal equipment is greater than a preset image brightness threshold value and/or the frame rate of the shooting preview image is less than a preset frame rate threshold value; or,
acquiring the direction of the focus position through the phase detection automatic focusing under the condition that the brightness value of a shooting preview image in a shooting preview interface of the terminal equipment is less than or equal to the preset image brightness threshold value and/or the frame rate of the shooting preview image is greater than or equal to the preset frame rate threshold value;
the DCC algorithm is a method for obtaining a focus position direction based on a positional relationship between a phase detection PD pixel and a motor, where the focus position direction is located in a target direction of the motor, and the target direction is located in any one of an upper direction, a lower direction, a left direction, a right direction, an upper left direction, a lower left direction, an upper right direction, and a lower right direction of the motor.
2. The method according to claim 1, wherein in a case that the current parameter includes a luminance value of an environment in which a terminal device is located, the luminance value of the environment in which the terminal device is located is N, and N is an integer greater than or equal to 2, and in a case that the current parameter satisfies a preset condition, acquiring the focus position direction includes:
obtaining an environment brightness average value of N brightness values of the environment where the terminal equipment is located;
under the condition that the average value of the environmental brightness is smaller than the preset environmental brightness threshold value, acquiring the direction of the focal position according to a DCC algorithm; or,
and under the condition that the ambient brightness average value is greater than or equal to the preset ambient brightness threshold value, acquiring the direction of the focal position through phase detection automatic focusing.
3. The method according to claim 1, wherein in a case that the current parameter includes a brightness value and/or a frame rate of a shooting preview image in a shooting preview interface of the terminal device, the brightness value of the shooting preview image is P, the frame rate of the shooting preview image is Q, and P and Q are integers greater than or equal to 2, acquiring a focus position direction in a case that the current parameter satisfies a preset condition includes:
obtaining an image brightness average value of P brightness values of the shooting preview image in the shooting preview interface of the terminal equipment, and/or obtaining a frame rate average value of Q frame rates of the shooting preview image in the shooting preview interface of the terminal equipment;
under the condition that the image brightness average value is larger than the preset image brightness threshold value and/or the frame rate average value is smaller than the preset frame rate threshold value, acquiring the focal position direction according to a DCC algorithm; or,
and acquiring the direction of the focal position through phase detection automatic focusing under the condition that the image brightness average value is less than or equal to the preset image brightness threshold value and/or the frame rate average value is greater than or equal to the preset frame rate threshold value.
4. The method according to any of claims 1-3, wherein the obtaining the focus position direction according to the DCC algorithm comprises:
acquiring a coordinate information value of a phase detection pixel point in a shooting preview image;
and acquiring the direction of the focal position according to the coordinate information value of the phase detection pixel point in the shot preview image and the DCC algorithm processing.
5. The method of claim 4, wherein the coordinate information value includes a current green value, and the obtaining the focus position direction according to the DCC algorithm processing based on the coordinate information value of the photographed preview image comprises:
performing gain processing on the current green value of the phase detection pixel point to obtain a first green value of the phase detection pixel point;
performing data normalization processing on the first green value of the phase detection pixel point to obtain a second green value of the phase detection pixel point;
and acquiring the direction of the focal position according to the second green value of the phase detection pixel point and DCC algorithm processing.
6. A terminal device, comprising:
the acquisition module is used for acquiring current parameters; acquiring the direction of the focal position under the condition that the current parameter meets a preset condition; the current parameters comprise the brightness value of the environment where the terminal equipment is located, or the brightness value and the frame rate of a shooting preview image in a shooting preview interface of the terminal equipment;
the processing module is used for focusing through contrast automatic focusing according to the focal position direction;
the obtaining module is specifically configured to obtain a focus position direction according to a DCC algorithm when a brightness value of an environment where the terminal device is located is less than a preset environment brightness threshold; or, under the condition that the brightness value of the environment where the terminal device is located is greater than or equal to the preset environment brightness threshold, acquiring the focus position direction through phase detection automatic focusing; or, when the brightness value of the shooting preview image in the shooting preview interface of the terminal device is greater than a preset image brightness threshold value, and/or the frame rate of the shooting preview image is less than a preset frame rate threshold value, acquiring the focus position direction according to the DCC algorithm; or, when the brightness value of the shooting preview image in the shooting preview interface of the terminal device is less than or equal to the preset image brightness threshold value, and/or the frame rate of the shooting preview image is greater than or equal to the preset frame rate threshold value, acquiring the focus position direction through the phase detection automatic focusing; the DCC algorithm is a method for obtaining a focus position direction based on a positional relationship between a phase detection PD pixel and a motor, where the focus position direction is located in a target direction of the motor, and the target direction is located in any one of an upper direction, a lower direction, a left direction, a right direction, an upper left direction, a lower left direction, an upper right direction, and a lower right direction of the motor.
7. A terminal device, comprising:
a memory storing executable program code;
and a processor coupled to the memory;
the processor calls the executable program code stored in the memory for performing the method of any of claims 1-5.
8. A computer-readable storage medium comprising instructions that, when executed on a computer, cause the computer to perform the method of any one of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010763394.1A CN111787231B (en) | 2020-07-31 | 2020-07-31 | Focusing method, terminal equipment and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010763394.1A CN111787231B (en) | 2020-07-31 | 2020-07-31 | Focusing method, terminal equipment and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111787231A CN111787231A (en) | 2020-10-16 |
CN111787231B true CN111787231B (en) | 2022-05-27 |
Family
ID=72765686
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010763394.1A Active CN111787231B (en) | 2020-07-31 | 2020-07-31 | Focusing method, terminal equipment and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111787231B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2012168382A (en) * | 2011-02-15 | 2012-09-06 | Nikon Corp | Imaging apparatus and program |
CN109981965A (en) * | 2017-12-27 | 2019-07-05 | 华为技术有限公司 | The method and electronic equipment of focusing |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007248782A (en) * | 2006-03-15 | 2007-09-27 | Olympus Imaging Corp | Focusing device and camera |
JP5322783B2 (en) * | 2009-06-05 | 2013-10-23 | キヤノン株式会社 | IMAGING DEVICE AND CONTROL METHOD OF IMAGING DEVICE |
KR101773168B1 (en) * | 2011-07-21 | 2017-09-12 | 삼성전자주식회사 | Apparatus and method for controlling focus by image sensor for outputting phase difference signal |
CN104823094B (en) * | 2012-11-29 | 2017-08-11 | 富士胶片株式会社 | Camera device and focusing control method |
CN110881103B (en) * | 2019-09-19 | 2022-01-28 | Oppo广东移动通信有限公司 | Focusing control method and device, electronic equipment and computer readable storage medium |
-
2020
- 2020-07-31 CN CN202010763394.1A patent/CN111787231B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2012168382A (en) * | 2011-02-15 | 2012-09-06 | Nikon Corp | Imaging apparatus and program |
CN109981965A (en) * | 2017-12-27 | 2019-07-05 | 华为技术有限公司 | The method and electronic equipment of focusing |
Non-Patent Citations (1)
Title |
---|
手机摄像头自动对焦技术;徐仁东;《科技传播》;20200910(第17期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN111787231A (en) | 2020-10-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108093134B (en) | Anti-interference method of electronic equipment and related product | |
CN107038681B (en) | Image blurring method and device, computer readable storage medium and computer device | |
US11363196B2 (en) | Image selection method and related product | |
US20220005439A1 (en) | Method for display-brightness adjustment and related products | |
CN107124556B (en) | Focusing method, focusing device, computer readable storage medium and mobile terminal | |
AU2018273505B2 (en) | Method for capturing fingerprint and associated products | |
US20190080120A1 (en) | Unlocking methods and related products | |
CN106993136B (en) | Mobile terminal and multi-camera-based image noise reduction method and device thereof | |
CN108122528A (en) | Display control method and related product | |
CN110851350A (en) | Method and device for monitoring white screen of web page interface | |
CN107330867B (en) | Image synthesis method, image synthesis device, computer-readable storage medium and computer equipment | |
CN110971822A (en) | Picture processing method and device, terminal equipment and computer readable storage medium | |
CN106803863A (en) | A kind of image sharing method and terminal | |
CN107657160B (en) | Face information acquisition method and related product | |
CN108121583A (en) | Screenshotss method and Related product | |
CN110536067B (en) | Image processing method, image processing device, terminal equipment and computer readable storage medium | |
CN107835336B (en) | Dual-camera frame synchronization method and device, user terminal and storage medium | |
CN111787231B (en) | Focusing method, terminal equipment and computer readable storage medium | |
CN108304709B (en) | Face unlocking method and related product | |
CN106851023B (en) | Method and equipment for quickly making call and mobile terminal | |
CN103079047B (en) | A kind of method of parameter adjustment and terminal | |
CN110889102B (en) | Image unlocking method and device, computer readable storage medium and terminal | |
CN114339032A (en) | Control method, intelligent terminal and storage medium | |
CN113038019A (en) | Camera adjusting method and device, electronic equipment and readable storage medium | |
CN107087119B (en) | Method and device for adjusting exposure and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |