CN107465881B - Dual-camera focusing method, mobile terminal and computer readable storage medium - Google Patents
Dual-camera focusing method, mobile terminal and computer readable storage medium Download PDFInfo
- Publication number
- CN107465881B CN107465881B CN201710913729.1A CN201710913729A CN107465881B CN 107465881 B CN107465881 B CN 107465881B CN 201710913729 A CN201710913729 A CN 201710913729A CN 107465881 B CN107465881 B CN 107465881B
- Authority
- CN
- China
- Prior art keywords
- focusing
- camera
- area
- judgment result
- pure
- 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
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/10—Cameras or camera modules comprising electronic image sensors; Control thereof for generating image signals from different wavelengths
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Studio Devices (AREA)
Abstract
The invention discloses a double-camera focusing method, which is used for obtaining and calculating the brightness and color gamut value of the current environment; judging whether the brightness and color gamut values are larger than preset values; if the judgment result is yes, starting the first camera to perform contrast focusing; and under the condition that the judgment result is negative, starting the second camera to perform contrast focusing. The invention also discloses a mobile terminal and a computer readable storage medium, which solve the problem that the focusing of the camera in the related technology is not flexible enough, and the camera which starts contrast focusing is determined by the brightness and the color gamut value, thereby realizing flexible focusing and improving the user experience.
Description
Technical Field
The invention relates to the technical field of mobile communication, in particular to a double-camera focusing method, a mobile terminal and a computer readable storage medium.
Background
At present, when taking a picture, a camera generally searches for an focusing point, and the focusing point searching process is based on the general FV principle, that is, the focusing point found in the previous taken picture is taken as an initial position, the definition at the position is judged, then △ x units are added to a certain direction along a curve each time by taking the position as a starting point to search for the focusing point, if the focusing point passes through a section of ascending trend in a certain direction to reach the position x1, and then three continuous positions are judged as descending trends, the initial point is returned, the focusing point is searched in the opposite direction according to the same method until a rough range is found to serve as a curve range obtained by rough scanning, and then △ x is reduced to perform fine focusing in the curve range obtained by rough scanning by the same method until a point with the highest definition is found to serve as the focusing point of the current picture to be taken.
For the double cameras, focusing is required to be respectively focused, so that for a single camera, the time required for focusing is longer, rapid photographing is not facilitated, and certain inconvenience is caused to the use of a user when the wonderful moment is grasped.
In order to solve the problem that the focusing of a camera in the related art is not flexible enough, no solution is provided at present.
Disclosure of Invention
The invention mainly aims to provide a double-camera focusing method, a mobile terminal and a computer readable storage medium, and aims to solve the problem that the focusing of a camera in the related technology is not flexible enough.
In order to achieve the above object, an embodiment of the present invention provides a method for focusing two cameras, including:
acquiring and calculating the current environment brightness and color gamut value;
judging whether the brightness and color gamut values are larger than preset values;
if the judgment result is yes, starting the first camera to perform contrast focusing;
and under the condition that the judgment result is negative, starting the second camera to perform contrast focusing.
Optionally, the first camera is a color camera, and the second camera is a black-and-white camera.
Optionally, the determining whether the brightness and color gamut value is greater than a preset value includes:
acquiring original data YUV through the first camera and the second camera, wherein Y is the brightness of the image, and U, V is the chroma of the image;
and judging whether the YUV value is larger than a preset value.
Optionally, the enabling the first camera for contrast focusing includes:
judging whether the colors of the viewfinder images are pure color images or not;
if the judgment result is yes, performing contrast focusing through the first camera;
and under the condition that the judgment result is negative, carrying out phase focusing through the first camera.
Optionally, the determining whether the color of the viewfinder image is a pure color image includes:
acquiring an image in a focus area;
judging whether the focusing area uses a face weight area focusing mode or a central area focusing mode;
when the focusing area uses a face weight area focusing center area focusing mode, determining the acquired image as the non-pure color image;
and when the focusing area uses a central area focusing mode, judging whether the focusing area is a pure-color image.
Optionally, when the focusing area uses a central area focusing manner, determining whether the focusing area is a pure color image includes:
counting the occupation ratio of similar pixels in the N-by-N pixel rectangular focusing area, wherein the similar pixels are the pixels A and the pixels B, the difference of which is smaller than a first preset value, and N is an integer between 300 and 600;
judging whether the ratio of the similar pixels is larger than a preset first threshold value or not;
if the judgment result is yes, determining that the focusing area is a pure-color image;
and under the condition that the judgment result is negative, determining that the focusing area is a non-pure color image.
Optionally, when the focusing area uses a central area focusing manner, determining whether the focusing area is a pure color image includes:
acquiring pixel values P in an N-by-N pixel rectangular focusing area;
calculating a new N matrix by rounding log2(P), wherein each point in the new N matrix has a value of an integer from 0 to 8;
counting the number of each number in 0-8;
judging whether the number of one number is larger than a preset second threshold value or not;
if the judgment result is yes, determining that the focusing area is a pure-color image;
and under the condition that the judgment result is negative, determining that the focusing area is a non-pure color image.
Optionally, when the focusing area uses a central area focusing manner, determining whether the focusing area is a pure color image includes:
dividing the N x N pixel rectangular focus area into 9 adjacent matrices of 1/3N x 1/3N;
comparing the adjacent matrixes to obtain similar matrixes of the adjacent matrixes, wherein the similar matrixes are matrixes with the coincidence degree larger than a second preset value;
judging whether the times of the similarity matrix are larger than a preset third threshold value or not;
if the judgment result is yes, determining that the focusing area is a pure-color image;
and under the condition that the judgment result is negative, determining that the focusing area is a non-pure color image.
According to another aspect of the embodiments of the present invention, there is also provided a mobile terminal, including: a first camera, a second camera, a processor, a memory and a communication bus, wherein,
the first camera and the second camera are respectively used for focusing the shot images;
the communication bus is used for realizing connection communication between the processor and the memory;
the processor is used for executing the double-camera focusing program stored in the memory so as to realize the following steps:
acquiring and calculating the current environment brightness and color gamut value;
judging whether the brightness and color gamut values are larger than preset values;
if the judgment result is yes, starting the first camera to perform contrast focusing;
and under the condition that the judgment result is negative, starting the second camera to perform contrast focusing.
Optionally, the first camera is a color camera, and the second camera is a black-and-white camera.
Optionally, the processor is further configured to execute a dual-camera focusing procedure to implement the following steps:
acquiring original data YUV through the first camera and the second camera, wherein Y is the brightness of the image, and U, V is the chroma of the image;
and judging whether the YUV value is larger than a preset value.
Optionally, the processor is further configured to execute a dual-camera focusing procedure to implement the following steps:
judging whether the colors of the viewfinder images are pure color images or not;
if the judgment result is yes, performing contrast focusing through the first camera;
and under the condition that the judgment result is negative, carrying out phase focusing through the first camera.
Optionally, the processor is further configured to execute a dual-camera focusing procedure to implement the following steps:
acquiring an image in a focus area;
judging whether the focusing area uses a face weight area focusing mode or a central area focusing mode;
when the focusing area uses a face weight area focusing center area focusing mode, determining the acquired image as the non-pure color image;
and when the focusing area uses a central area focusing mode, judging whether the focusing area is a pure-color image.
Optionally, the processor is further configured to execute a dual-camera focusing procedure to implement the following steps:
counting the occupation ratio of similar pixels in the N-by-N pixel rectangular focusing area, wherein the similar pixels are the pixels A and the pixels B, the difference of which is smaller than a first preset value, and N is an integer between 300 and 600;
judging whether the ratio of the similar pixels is larger than a preset first threshold value or not;
if the judgment result is yes, determining that the focusing area is a pure-color image;
and under the condition that the judgment result is negative, determining that the focusing area is a non-pure color image.
Optionally, the processor is further configured to execute a dual-camera focusing procedure to implement the following steps:
acquiring pixel values P in an N-by-N pixel rectangular focusing area;
calculating a new N matrix by rounding log2(P), wherein each point in the new N matrix has a value of an integer from 0 to 8;
counting the number of each number in 0-8;
judging whether the number of one number is larger than a preset second threshold value or not;
if the judgment result is yes, determining that the focusing area is a pure-color image;
and under the condition that the judgment result is negative, determining that the focusing area is a non-pure color image.
Optionally, the processor is further configured to execute a dual-camera focusing procedure to implement the following steps:
dividing the N x N pixel rectangular focus area into 9 adjacent matrices of 1/3N x 1/3N;
comparing the adjacent matrixes to obtain similar matrixes of the adjacent matrixes, wherein the similar matrixes are matrixes with the coincidence degree larger than a second preset value;
judging whether the times of the similarity matrix are larger than a preset third threshold value or not;
if the judgment result is yes, determining that the focusing area is a pure-color image;
and under the condition that the judgment result is negative, determining that the focusing area is a non-pure color image.
According to another aspect of embodiments of the present invention, there is also provided a computer-readable storage medium storing one or more programs, which are executable by one or more processors, to implement the steps of the above-described dual-camera focusing method.
According to the invention, the current environment brightness and color gamut value are obtained and calculated; judging whether the brightness and color gamut values are larger than preset values; if the judgment result is yes, starting the first camera to perform contrast focusing; and if the judgment result is negative, the second camera is started to perform contrast focusing, so that the problem that the focusing of the camera in the related technology is not flexible enough is solved, the camera started to perform contrast focusing is determined according to the brightness and the color gamut value, the flexible focusing is realized, and the user experience is improved.
Drawings
Fig. 1 is a schematic diagram of a hardware structure of an optional mobile terminal for implementing various embodiments of the present invention;
FIG. 2 is a diagram of a wireless communication system for the mobile terminal shown in FIG. 1;
FIG. 3 is a flowchart of a dual-camera focusing method according to an embodiment of the present invention;
FIG. 4 is a first diagram illustrating dual-camera focusing according to an embodiment of the present invention;
FIG. 5 is a second schematic diagram of dual-camera focusing according to an embodiment of the present invention;
fig. 6 is a block diagram of a mobile terminal according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In the following description, suffixes such as "module", "component", or "unit" used to denote elements are used only for facilitating the explanation of the present invention, and have no specific meaning in itself. Thus, "module", "component" or "unit" may be used mixedly.
The terminal may be implemented in various forms. For example, the terminal described in the present invention may include a mobile terminal such as a mobile phone, a tablet computer, a notebook computer, a palmtop computer, a Personal Digital Assistant (PDA), a Portable Media Player (PMP), a navigation device, a wearable device, a smart band, a pedometer, and the like, and a fixed terminal such as a Digital TV, a desktop computer, and the like.
The following description will be given by way of example of a mobile terminal, and it will be understood by those skilled in the art that the construction according to the embodiment of the present invention can be applied to a fixed type terminal, in addition to elements particularly used for mobile purposes.
Referring to fig. 1, which is a schematic diagram of a hardware structure of a mobile terminal for implementing various embodiments of the present invention, the mobile terminal 100 may include: RF (Radio Frequency) unit 101, WiFi module 102, audio output unit 103, a/V (audio/video) input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, processor 110, and power supply 111. Those skilled in the art will appreciate that the mobile terminal architecture shown in fig. 1 is not intended to be limiting of mobile terminals, which 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 terminal in detail with reference to fig. 1:
the radio frequency unit 101 may be configured to receive and transmit signals during information transmission and reception or during a call, and specifically, receive downlink information of a base station and then process the downlink information to the processor 110; in addition, the uplink data is transmitted to the base station. Typically, radio frequency unit 101 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like. In addition, the radio frequency unit 101 can also communicate with a network and other devices through wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System for Mobile communications), GPRS (General Packet Radio Service), CDMA2000(Code Division Multiple Access 2000), WCDMA (Wideband Code Division Multiple Access), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access), FDD-LTE (Frequency Division duplex-Long Term Evolution), and TDD-LTE (Time Division duplex-Long Term Evolution).
WiFi belongs to short-distance wireless transmission technology, and the mobile terminal can help a user to receive and send e-mails, browse webpages, access streaming media and the like through the WiFi module 102, and provides wireless broadband internet access for the user. Although fig. 1 shows the WiFi module 102, it is understood that it does not belong to the essential constitution of the mobile terminal, and may be omitted entirely as needed within the scope not changing the essence of the invention.
The audio output unit 103 may convert audio data received by the radio frequency unit 101 or the WiFi module 102 or stored in the memory 109 into an audio signal and output as sound when the mobile terminal 100 is in a call signal reception mode, a call mode, a recording mode, a voice recognition mode, a broadcast reception mode, or the like. Also, the audio output unit 103 may also provide audio output related to a specific function performed by the mobile terminal 100 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 103 may include a speaker, a buzzer, and the like.
The a/V input unit 104 is used to receive audio or video signals. The a/V input Unit 104 may include a Graphics Processing Unit (GPU) 1041 and a microphone 1042, the Graphics processor 1041 Processing image data of still pictures or video obtained by an image capturing device (e.g., a camera) in a video capturing mode or an image capturing mode. The processed image frames may be displayed on the display unit 106. The image frames processed by the graphic processor 1041 may be stored in the memory 109 (or other storage medium) or transmitted via the radio frequency unit 101 or the WiFi module 102. The microphone 1042 may receive sounds (audio data) via the microphone 1042 in a phone call mode, a recording mode, a voice recognition mode, or the like, and may be capable of processing such sounds into audio data. The processed audio (voice) data may be converted into a format output transmittable to a mobile communication base station via the radio frequency unit 101 in case of a phone call mode. The microphone 1042 may implement various types of noise cancellation (or suppression) algorithms to cancel (or suppress) noise or interference generated in the course of receiving and transmitting audio signals.
The mobile terminal 100 also includes at least one sensor 105, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor that can adjust the brightness of the display panel 1061 according to the brightness of ambient light, and a proximity sensor that can turn off the display panel 1061 and/or a backlight when the mobile terminal 100 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 fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured on the mobile phone, further description is omitted here.
The display unit 106 is used to display information input by a user or information provided to the user. The Display unit 106 may include a Display panel 1061, and the Display panel 1061 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like.
The user input unit 107 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the mobile terminal. Specifically, the user input unit 107 may include a touch panel 1071 and other input devices 1072. The touch panel 1071, also referred to as a touch screen, may collect a touch operation performed by a user on or near the touch panel 1071 (e.g., an operation performed by the user on or near the touch panel 1071 using a finger, a stylus, or any other suitable object or accessory), and drive a corresponding connection device according to a predetermined program. The touch panel 1071 may include two parts of 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, sends the touch point coordinates to the processor 110, and can receive and execute commands sent by the processor 110. In addition, the touch panel 1071 may be implemented in various types, such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. In addition to the touch panel 1071, the user input unit 107 may include other input devices 1072. In particular, other input devices 1072 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like, and are not limited to these specific examples.
Further, the touch panel 1071 may cover the display panel 1061, and when the touch panel 1071 detects a touch operation thereon or nearby, the touch panel 1071 transmits the touch operation to the processor 110 to determine the type of the touch event, and then the processor 110 provides a corresponding visual output on the display panel 1061 according to the type of the touch event. Although the touch panel 1071 and the display panel 1061 are shown in fig. 1 as two separate components to implement the input and output functions of the mobile terminal, in some embodiments, the touch panel 1071 and the display panel 1061 may be integrated to implement the input and output functions of the mobile terminal, and is not limited herein.
The interface unit 108 serves as an interface through which at least one external device is connected to the mobile terminal 100. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input/output (I/O) port, a video I/O port, an earphone port, and the like. The interface unit 108 may be used to receive input (e.g., data information, power, etc.) from external devices and transmit the received input to one or more elements within the mobile terminal 100 or may be used to transmit data between the mobile terminal 100 and external devices.
The memory 109 may be used to store software programs as well as various data. The memory 109 may mainly include a storage program area and a storage data area, wherein the storage program 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 109 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 processor 110 is a control center of the mobile terminal, connects various parts of the entire mobile terminal using various interfaces and lines, and performs various functions of the mobile terminal and processes data by operating or executing software programs and/or modules stored in the memory 109 and calling data stored in the memory 109, thereby performing overall monitoring of the mobile terminal. Processor 110 may include one or more processing units; preferably, the processor 110 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 the processor 110.
The mobile terminal 100 may further include a power supply 111 (e.g., a battery) for supplying power to various components, and preferably, the power supply 111 may be logically connected to the processor 110 via a power management system, so as to manage charging, discharging, and power consumption management functions via the power management system.
Although not shown in fig. 1, the mobile terminal 100 may further include a bluetooth module or the like, which is not described in detail herein.
In order to facilitate understanding of the embodiments of the present invention, a communication network system on which the mobile terminal of the present invention is based is described below.
Referring to fig. 2, fig. 2 is an architecture diagram of a communication Network system according to an embodiment of the present invention, where the communication Network system is an LTE system of a universal mobile telecommunications technology, and the LTE system includes a UE (User Equipment) 201, an E-UTRAN (Evolved UMTS Terrestrial Radio Access Network) 202, an EPC (Evolved Packet Core) 203, and an IP service 204 of an operator, which are in communication connection in sequence.
Specifically, the UE201 may be the terminal 100 described above, and is not described herein again.
The E-UTRAN202 includes eNodeB2021 and other eNodeBs 2022, among others. Among them, the eNodeB2021 may be connected with other eNodeB2022 through backhaul (e.g., X2 interface), the eNodeB2021 is connected to the EPC203, and the eNodeB2021 may provide the UE201 access to the EPC 203.
The EPC203 may include an MME (Mobility Management Entity) 2031, an HSS (Home Subscriber Server) 2032, other MMEs 2033, an SGW (Serving gateway) 2034, a PGW (PDN gateway) 2035, and a PCRF (Policy and charging functions Entity) 2036, and the like. The MME2031 is a control node that handles signaling between the UE201 and the EPC203, and provides bearer and connection management. HSS2032 is used to provide registers to manage functions such as home location register (not shown) and holds subscriber specific information about service characteristics, data rates, etc. All user data may be sent through SGW2034, PGW2035 may provide IP address assignment for UE201 and other functions, and PCRF2036 is a policy and charging control policy decision point for traffic data flow and IP bearer resources, which selects and provides available policy and charging control decisions for a policy and charging enforcement function (not shown).
The IP services 204 may include the internet, intranets, IMS (IP Multimedia Subsystem), or other IP services, among others.
Although the LTE system is described as an example, it should be understood by those skilled in the art that the present invention is not limited to the LTE system, but may also be applied to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA, and future new network systems.
Based on the above mobile terminal hardware structure and communication network system, the present invention provides various embodiments of the method.
Example 1
Based on the above mobile terminal, an embodiment of the present invention provides a dual-camera focusing method, and fig. 3 is a flowchart of the dual-camera focusing method according to the embodiment of the present invention, as shown in fig. 3, the method includes the following steps:
step S301, obtaining and calculating the current environment brightness and color gamut value;
step S302, judging whether the brightness and color gamut values are larger than preset values;
step S303, under the condition that the judgment result is yes, starting a first camera to perform contrast focusing;
and step S304, under the condition that the judgment result is negative, starting the second camera to carry out contrast focusing.
Through the steps, the current environment brightness and the color gamut value are obtained and calculated; judging whether the brightness and color gamut values are larger than preset values; if the judgment result is yes, starting the first camera to perform contrast focusing; and if the judgment result is negative, the second camera is started to perform contrast focusing, so that the problem that the focusing of the camera in the related technology is not flexible enough is solved, the camera started to perform contrast focusing is determined according to the brightness and the color gamut value, the flexible focusing is realized, and the user experience is improved.
Optionally, the first camera is a color camera, and the second camera is a black-and-white camera.
Optionally, the determining whether the brightness and color gamut value is greater than a preset value includes: acquiring original data YUV through the first camera and the second camera, wherein Y is the brightness of the image, and U, V is the chroma of the image; and judging whether the YUV value is larger than a preset value.
YUV is mainly used to optimize the transmission of color video signals to make them backward compatible with legacy black and white televisions. Compared with the transmission of RGB video signals, the most significant advantage is that it takes up very little bandwidth (RGB requires the simultaneous transmission of three independent video signals). Wherein "Y" represents brightness (Luma or Luma), i.e., a gray scale value; "U" and "V" denote Chroma (Chroma) which describes the color and saturation of an image and is used to specify the color of a pixel. "luminance" is established through the RGB input signals by superimposing specific parts of the RGB signals together. "chroma" defines two aspects of color-hue and saturation, represented by Cr and Cb, respectively. Where Cr reflects the difference between the red part of the RGB input signal and the luminance value of the RGB signal. And Cb reflects the difference between the blue part of the RGB input signal and the luminance value of the RGB signal.
The importance of using the YUV color space is that its luminance signal Y and chrominance signal U, V are separate. If there is only a Y signal component and no U, V component, then the image so represented is a black and white grayscale image.
Optionally, the enabling the first camera for contrast focusing includes: judging whether the colors of the viewfinder images are pure color images or not; if the judgment result is yes, performing contrast focusing through the first camera; and under the condition that the judgment result is negative, carrying out phase focusing through the first camera.
Optionally, the determining whether the color of the viewfinder image is a pure color image includes: acquiring an image in a focus area; judging whether the focusing area uses a face weight area focusing mode or a central area focusing mode; when the focusing area uses a face weight area focusing center area focusing mode, determining the acquired image as the non-pure color image; and when the focusing area uses a central area focusing mode, judging whether the focusing area is a pure-color image.
Optionally, when the focusing area uses a central area focusing manner, determining whether the focusing area is a pure color image includes: counting the occupation ratio of similar pixels in the N-by-N pixel rectangular focusing area, wherein the similar pixels are the pixels A and the pixels B, the difference of which is smaller than a first preset value, and N is an integer between 300 and 600; judging whether the ratio of the similar pixels is larger than a preset first threshold value or not; if the judgment result is yes, determining that the focusing area is a pure-color image; and under the condition that the judgment result is negative, determining that the focusing area is a non-pure color image.
Optionally, when the focusing area uses a central area focusing manner, determining whether the focusing area is a pure color image includes: acquiring pixel values P in an N-by-N pixel rectangular focusing area; calculating a new N matrix by rounding log2(P), wherein each point in the new N matrix has a value of an integer from 0 to 8; counting the number of each number in 0-8; judging whether the number of one number is larger than a preset second threshold value or not; if the judgment result is yes, determining that the focusing area is a pure-color image; and under the condition that the judgment result is negative, determining that the focusing area is a non-pure color image.
Optionally, when the focusing area uses a central area focusing manner, determining whether the focusing area is a pure color image includes: dividing the N x N pixel rectangular focus area into 9 adjacent matrices of 1/3N x 1/3N; comparing the adjacent matrixes to obtain similar matrixes of the adjacent matrixes, wherein the similar matrixes are matrixes with the coincidence degree larger than a second preset value; judging whether the times of the similarity matrix are larger than a preset third threshold value or not; if the judgment result is yes, determining that the focusing area is a pure-color image; and under the condition that the judgment result is negative, determining that the focusing area is a non-pure color image.
In the embodiment of the invention, the double cameras are focused to obtain and calculate the brightness and color gamut value of the current environment, judge whether the brightness and color gamut value is greater than a preset value, and start the first camera to perform contrast focusing if the brightness and color gamut value is greater than the preset value; otherwise, the second camera is started to carry out contrast focusing.
1. The brightness is lower than the threshold value S1, and the contrast focusing mode of a black and white camera is directly used;
2. and the brightness is higher than a threshold value S1, whether the colors of the viewfinder image are close to a pure color picture is judged, if yes, contrast focusing of the color camera is used, and if not, phase focusing of the color camera is used.
And original image data YUV of the bottommost layer of the camera, wherein Y signals are brightness information representing the image, a dark environment is determined when the average value of the Y signals is lower than a preset threshold Y0, and a bright environment is determined when the average value of the Y signals is higher than a preset threshold Y0. Y0 is a parameter that can be adjusted for modification, and is 32 by default. (the value of Y is between 0 and 255) the average brightness information of the whole image can be obtained and judged in the fastest time, so that whether a color main shot or a black and white sub shot is used can be intelligently selected and judged.
And (4) taking a very small image in a focusing area according to the judgment mode of whether the image color is a pure color area. The focusing area generally uses a center area focusing mode or a face weight area focusing mode, wherein the face weight area focusing mode is directly phase focusing of a non-pure color image using a color camera, and the center area focusing mode is a square area of approximately 300 × 300 pixels in the middle of the image (or other N × N pixel matrixes, generally, the N value in a mobile phone is 300-.
Taking the area image, and adopting more than three judgment modes:
mode 1: and counting the occupation ratios of similar pixels in the 300-300 pixel matrix area, and determining the similar pixels if the difference between the pixel A and the pixel B is less than a threshold value in the judging mode of the similar pixels. A similar pixel percentage higher than 50% may be considered a pure color scene in the in-focus area. (the 50% can be adjusted manually to 60% or even other values).
Mode 2: taking the pixel value P (each P value is coded by 0-255) in the 300-300 pixel matrix area, and calculating the log2(P) by taking an integer to obtain a new 300-300 matrix (the value of each point in the matrix is an integer within 0-8), respectively counting the number of each digit from 0-8, wherein when the number of one digit is more than 300-50%, the focusing area can be regarded as a pure color scene. (the 50% can be adjusted manually to 60% or even other values).
Mode 3: and (3) dividing 300 by 300 into 9 adjacent matrixes of 100 by 100, comparing the nine small matrixes, determining that the two matrixes are similar when the coincidence degree between the small matrixes is higher than 40%, calculating the maximum times of the similar matrixes, and determining that the focusing area is a pure-color scene when the maximum times is more than 4 times. (the 4 times can be adjusted to 5 times or other values manually).
In the embodiment of the invention, contrast focusing is a focusing mode used by most of current smart phones, in the focusing mode, when a shot object is aligned, a motor in a lens module can drive a lens to move from the bottom to the top, and in the process, a pixel sensor can carry out comprehensive detection on the whole scene range in the depth direction and continuously record contrast values such as contrast and the like. After the position with the maximum contrast is found, the lens moving to the top returns to the position again, and the final focusing is finished. When the screen is reflected on the screen of the mobile phone of the user, the process is a process from blurring to clearness and then blurring, and finally the process is a clear 'drawing box' process.
According to the embodiment of the invention, contrast focusing can be realized by the following modes:
step S1, fig. 4 is a first schematic diagram of dual-camera focusing according to an embodiment of the present invention, as shown in fig. 4, a first group of focuses is obtained by the first camera and the second camera, and each group of focuses includes a previous focus and a next focus.
Before the step, the focusing point of the previous image is obtained, and the focusing point is used as the initial focusing point of the current image.
In this step, a previous pair of focuses is obtained through the first camera, and a next pair of focuses is obtained through the second camera, and each set of focuses includes a previous pair of focuses and a next pair of focuses.
In step S2, it is determined whether the focus value of the subsequent pair of focuses is larger than the focus value of the previous pair of focuses.
In this step, the focus values of the next pair of focuses are compared with the focus values of the previous pair of focuses. When the fact that the focus value of the next pair of focuses is larger than the focus value of the previous pair of focuses is detected, the next group of focuses are continuously obtained through the first camera and the second camera, and whether the next pair of focuses is larger than the focus value of the previous pair of focuses is judged;
comparing the focus value of the next pair of focuses with the focus value of the previous pair of focuses, and circularly executing the steps of acquiring the focuses and judging the focus values of the next pair of focuses and the previous pair of focuses.
In the invention, the larger the focus value is, the clearer the image representing the focus; the smaller the focus value, the less sharp the image representing the focus.
In this step, when the focus value of the next pair of focuses is greater than the focus value of the previous pair of focuses, the next pair of focuses is continuously obtained through the first camera, and then the sizes of the focus value of the next pair of focuses and the focus value of the previous pair of focuses in the next pair of focuses are continuously judged.
And step S3, when the focus value of the three continuous focuses is found to be smaller than that of a certain pair of focuses before the three focuses, taking the certain pair of focuses as a first pair of focuses to take image shooting.
Fig. 5 is a schematic diagram of two-camera focusing according to an embodiment of the present invention, as shown in fig. 5, a second group of focuses are obtained by the first camera and the second camera, each group of focuses includes a previous focus and a subsequent focus, the first camera continues to obtain a focus value of the previous focus, the second camera obtains a focus value of the subsequent focus, and as described above, until a focus value of a pair of focuses before three consecutive focuses is found to be smaller than a focus value of the previous focus, the pair of focuses is taken as the first focus to perform image capturing. Wherein the previous pair of focal points is adjacent to the subsequent pair of focal points and spaced apart by a first step size.
Compared with phase focusing on a digital single lens reflex, the phase focusing on a mobile phone directly integrates an automatic focusing sensor and a pixel sensor, a left-right opposite paired pixel point is taken out from the pixel sensor, information such as light incoming amount and the like of an object in a scene is detected respectively, an accurate focusing point can be found rapidly by comparing the conditions of relevant values of the left side and the right side, and then a lens can be pushed to a corresponding position by a motor between lenses at one time to complete focusing.
Example 2
According to another aspect of the embodiments of the present invention, there is also provided a mobile terminal, and fig. 6 is a block diagram of a mobile terminal according to an embodiment of the present invention, as shown in fig. 6, the mobile terminal includes: a first camera, a second camera, a processor, a memory and a communication bus, wherein,
the first camera and the second camera are respectively used for focusing the shot images;
the communication bus is used for realizing connection communication between the processor and the memory;
the processor is used for executing the double-camera focusing program stored in the memory so as to realize the following steps:
acquiring and calculating the current environment brightness and color gamut value;
judging whether the brightness and color gamut values are larger than preset values;
if the judgment result is yes, starting the first camera to perform contrast focusing;
and under the condition that the judgment result is negative, starting the second camera to perform contrast focusing.
Optionally, the first camera is a color camera, and the second camera is a black-and-white camera.
Optionally, the processor is further configured to execute a dual-camera focusing procedure to implement the following steps:
acquiring original data YUV through the first camera and the second camera, wherein Y is the brightness of the image, and U, V is the chroma of the image;
and judging whether the YUV value is larger than a preset value.
Optionally, the processor is further configured to execute a dual-camera focusing procedure to implement the following steps:
judging whether the colors of the viewfinder images are pure color images or not;
if the judgment result is yes, performing contrast focusing through the first camera;
and under the condition that the judgment result is negative, carrying out phase focusing through the first camera.
Optionally, the processor is further configured to execute a dual-camera focusing procedure to implement the following steps:
acquiring an image in a focus area;
judging whether the focusing area uses a face weight area focusing mode or a central area focusing mode;
when the focusing area uses a face weight area focusing center area focusing mode, determining the acquired image as the non-pure color image;
and when the focusing area uses a central area focusing mode, judging whether the focusing area is a pure-color image.
Optionally, the processor is further configured to execute a dual-camera focusing procedure to implement the following steps:
counting the occupation ratio of similar pixels in the N-by-N pixel rectangular focusing area, wherein the similar pixels are the pixels A and the pixels B, the difference of which is smaller than a first preset value, and N is an integer between 300 and 600;
judging whether the ratio of the similar pixels is larger than a preset first threshold value or not;
if the judgment result is yes, determining that the focusing area is a pure-color image;
and under the condition that the judgment result is negative, determining that the focusing area is a non-pure color image.
Optionally, the processor is further configured to execute a dual-camera focusing procedure to implement the following steps:
acquiring pixel values P in an N-by-N pixel rectangular focusing area;
calculating a new N matrix by rounding log2(P), wherein each point in the new N matrix has a value of an integer from 0 to 8;
counting the number of each number in 0-8;
judging whether the number of one number is larger than a preset second threshold value or not;
if the judgment result is yes, determining that the focusing area is a pure-color image;
and under the condition that the judgment result is negative, determining that the focusing area is a non-pure color image.
Optionally, the processor is further configured to execute a dual-camera focusing procedure to implement the following steps:
dividing the N x N pixel rectangular focus area into 9 adjacent matrices of 1/3N x 1/3N;
comparing the adjacent matrixes to obtain similar matrixes of the adjacent matrixes, wherein the similar matrixes are matrixes with the coincidence degree larger than a second preset value;
judging whether the times of the similarity matrix are larger than a preset third threshold value or not;
if the judgment result is yes, determining that the focusing area is a pure-color image;
and under the condition that the judgment result is negative, determining that the focusing area is a non-pure color image.
Example 3
According to another aspect of embodiments of the present invention, there is also provided a computer-readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement the following steps of the above-mentioned dual-camera focusing method:
s11, acquiring and calculating the current environment brightness and color gamut value;
s12, judging whether the brightness and color gamut values are larger than preset values;
s13, under the condition that the judgment result is yes, starting the first camera to carry out contrast focusing;
and S14, if the judgment result is negative, enabling the second camera to carry out contrast focusing.
According to the embodiment of the invention, the current environment brightness and color gamut value are obtained and calculated; judging whether the brightness and color gamut values are larger than preset values; if the judgment result is yes, starting the first camera to perform contrast focusing; and if the judgment result is negative, the second camera is started to perform contrast focusing, so that the problem that the focusing of the camera in the related technology is not flexible enough is solved, the camera started to perform contrast focusing is determined according to the brightness and the color gamut value, the flexible focusing is realized, and the user experience is improved.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.
Claims (8)
1. A dual-camera focusing method is characterized by comprising the following steps:
acquiring and calculating the current environment brightness and color gamut value;
judging whether the brightness and color gamut values are larger than preset values;
under the condition that the judgment result is negative, starting a second camera to perform contrast focusing;
if the judgment result is yes, judging whether the colors of the viewfinder images are pure color images;
if the judgment result is yes, performing contrast focusing through the first camera;
under the condition that the judgment result is negative, phase focusing is carried out through the first camera;
the first camera is a color camera, and the second camera is a black and white camera.
2. The method of claim 1, wherein determining whether the luminance and color gamut values are greater than predetermined values comprises:
acquiring original data YUV through the first camera and the second camera, wherein Y is the brightness of the image, and U, V is the chroma of the image;
and judging whether the YUV value is larger than a preset value.
3. The method of claim 1, wherein determining whether the viewfinder image color is a solid image comprises:
acquiring an image in a focus area;
judging whether the focusing area uses a face weight area focusing mode or a central area focusing mode;
when the focusing area uses a face weight area focusing mode, determining that the acquired image is a non-pure-color image;
and when the focusing area uses a central area focusing mode, judging whether the focusing area is a pure-color image.
4. The method of claim 3, wherein when the focusing area uses a center area focusing manner, determining whether the focusing area is a pure color image comprises:
counting the occupation ratio of similar pixels in the N-by-N pixel rectangular focusing area, wherein the similar pixels are the pixels A and the pixels B, the difference of which is smaller than a first preset value, and N is an integer between 300 and 600;
judging whether the ratio of the similar pixels is larger than a preset first threshold value or not;
if the judgment result is yes, determining that the focusing area is a pure-color image;
and under the condition that the judgment result is negative, determining that the focusing area is a non-pure color image.
5. The method of claim 3, wherein when the focusing area uses a center area focusing manner, determining whether the focusing area is a pure color image comprises:
acquiring pixel values P in an N-by-N pixel rectangular focusing area;
calculating a new N matrix by rounding log2(P), wherein each point in the new N matrix has a value of an integer from 0 to 8;
counting the number of each number in 0-8;
judging whether the number of one number is larger than a preset second threshold value or not;
if the judgment result is yes, determining that the focusing area is a pure-color image;
and under the condition that the judgment result is negative, determining that the focusing area is a non-pure color image.
6. The method of claim 3, wherein when the focusing area uses a center area focusing manner, determining whether the focusing area is a pure color image comprises:
dividing the N x N pixel rectangular focus area into 9 adjacent matrices of 1/3N x 1/3N;
comparing the adjacent matrixes to obtain similar matrixes of the adjacent matrixes, wherein the similar matrixes are matrixes with the coincidence degree larger than a second preset value;
judging whether the times of the similarity matrix are larger than a preset third threshold value or not;
if the judgment result is yes, determining that the focusing area is a pure-color image;
and under the condition that the judgment result is negative, determining that the focusing area is a non-pure color image.
7. A mobile terminal, characterized in that the mobile terminal comprises: a first camera, a second camera, a processor, a memory and a communication bus, wherein,
the first camera and the second camera are respectively used for focusing the shot images;
the communication bus is used for realizing connection communication between the processor and the memory;
the processor is used for executing the double-camera focusing program stored in the memory so as to realize the following steps:
acquiring and calculating the current environment brightness and color gamut value;
judging whether the brightness and color gamut values are larger than preset values;
under the condition that the judgment result is negative, starting a second camera to perform contrast focusing;
if the judgment result is yes, judging whether the colors of the viewfinder images are pure color images;
if the judgment result is yes, performing contrast focusing through the first camera;
under the condition that the judgment result is negative, phase focusing is carried out through the first camera;
the first camera is a color camera, and the second camera is a black and white camera.
8. A computer readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to perform the steps of the dual-camera focusing method of any one of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710913729.1A CN107465881B (en) | 2017-09-30 | 2017-09-30 | Dual-camera focusing method, mobile terminal and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710913729.1A CN107465881B (en) | 2017-09-30 | 2017-09-30 | Dual-camera focusing method, mobile terminal and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107465881A CN107465881A (en) | 2017-12-12 |
CN107465881B true CN107465881B (en) | 2020-06-26 |
Family
ID=60554038
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710913729.1A Active CN107465881B (en) | 2017-09-30 | 2017-09-30 | Dual-camera focusing method, mobile terminal and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107465881B (en) |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109981965B (en) * | 2017-12-27 | 2021-01-01 | 华为技术有限公司 | Focusing method and electronic equipment |
CN108735157B (en) * | 2018-06-12 | 2020-04-10 | Oppo(重庆)智能科技有限公司 | Light sensor processing method and device, storage medium and electronic equipment |
CN109600606B (en) * | 2018-11-30 | 2019-12-27 | 深圳市华星光电半导体显示技术有限公司 | Method for identifying single tone image |
CN110070684A (en) * | 2019-04-16 | 2019-07-30 | 北京意锐新创科技有限公司 | A kind of barcode scanning payment devices for open air |
CN110084801A (en) * | 2019-04-28 | 2019-08-02 | 深圳回收宝科技有限公司 | A kind of detection method of terminal screen, device, portable terminal and storage medium |
CN110933305B (en) | 2019-11-28 | 2021-07-20 | 维沃移动通信有限公司 | Electronic equipment and focusing method |
CN112153373A (en) * | 2020-09-23 | 2020-12-29 | 平安国际智慧城市科技股份有限公司 | Fault identification method and device for bright kitchen range equipment and storage medium |
CN112135060B (en) * | 2020-10-22 | 2022-06-10 | 努比亚技术有限公司 | Focusing processing method, mobile terminal and computer storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105007420A (en) * | 2015-07-14 | 2015-10-28 | 广东欧珀移动通信有限公司 | Focusing method and mobile terminal |
CN106060419A (en) * | 2016-06-30 | 2016-10-26 | 维沃移动通信有限公司 | Photographing method and mobile terminal |
CN106254682A (en) * | 2016-09-22 | 2016-12-21 | 维沃移动通信有限公司 | A kind of photographic method and mobile terminal |
CN106534696A (en) * | 2016-11-29 | 2017-03-22 | 努比亚技术有限公司 | Focusing apparatus and method |
TWI640200B (en) * | 2017-08-11 | 2018-11-01 | 群邁通訊股份有限公司 | Electronic device and method for image capturing control thereof |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR101727486B1 (en) * | 2010-10-25 | 2017-04-17 | 삼성전자 주식회사 | Method and apparatus for determining attitude of mobile terminal |
-
2017
- 2017-09-30 CN CN201710913729.1A patent/CN107465881B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105007420A (en) * | 2015-07-14 | 2015-10-28 | 广东欧珀移动通信有限公司 | Focusing method and mobile terminal |
CN106060419A (en) * | 2016-06-30 | 2016-10-26 | 维沃移动通信有限公司 | Photographing method and mobile terminal |
CN106254682A (en) * | 2016-09-22 | 2016-12-21 | 维沃移动通信有限公司 | A kind of photographic method and mobile terminal |
CN106534696A (en) * | 2016-11-29 | 2017-03-22 | 努比亚技术有限公司 | Focusing apparatus and method |
TWI640200B (en) * | 2017-08-11 | 2018-11-01 | 群邁通訊股份有限公司 | Electronic device and method for image capturing control thereof |
Also Published As
Publication number | Publication date |
---|---|
CN107465881A (en) | 2017-12-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107465881B (en) | Dual-camera focusing method, mobile terminal and computer readable storage medium | |
CN108900790B (en) | Video image processing method, mobile terminal and computer readable storage medium | |
CN107302663B (en) | Image brightness adjusting method, terminal and computer readable storage medium | |
CN108848294B (en) | Shooting parameter adjusting method, terminal and computer readable storage medium | |
CN107959839B (en) | A kind of method of blank level adjustment, terminal and computer readable storage medium | |
CN108198146B (en) | Noise reduction method, equipment and computer readable storage medium | |
CN107948530B (en) | Image processing method, terminal and computer readable storage medium | |
CN110086993B (en) | Image processing method, image processing device, mobile terminal and computer readable storage medium | |
CN108419008B (en) | Shooting method, terminal and computer readable storage medium | |
CN107133939A (en) | A kind of picture synthesis method, equipment and computer-readable recording medium | |
CN111708503A (en) | Screen projection control method and device and computer readable storage medium | |
CN107566734B (en) | Intelligent control method, terminal and computer readable storage medium for portrait photographing | |
CN107705247B (en) | Image saturation adjusting method, terminal and storage medium | |
CN108184105B (en) | Method and device for adjusting brightness and computer readable storage medium | |
CN113179369B (en) | Shot picture display method, mobile terminal and storage medium | |
CN111885307B (en) | Depth-of-field shooting method and device and computer readable storage medium | |
CN109120858B (en) | Image shooting method, device, equipment and storage medium | |
CN107896304B (en) | Image shooting method and device and computer readable storage medium | |
CN108234893B (en) | Brightness adjusting method, brightness adjusting equipment and computer readable storage medium | |
CN107241504B (en) | Image processing method, mobile terminal and computer readable storage medium | |
CN109510941B (en) | Shooting processing method and device and computer readable storage medium | |
CN113347372A (en) | Shooting light supplement method, mobile terminal and readable storage medium | |
CN112965680A (en) | Screen projection method, screen projection initiating device and storage medium | |
CN107493431A (en) | A kind of image taking synthetic method, terminal and computer-readable recording medium | |
CN109361872B (en) | Double-sided screen auxiliary shooting method, terminal and storage medium |
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 |