CN114390195A - Automatic focusing method, device, equipment and storage medium - Google Patents

Automatic focusing method, device, equipment and storage medium Download PDF

Info

Publication number
CN114390195A
CN114390195A CN202111536844.4A CN202111536844A CN114390195A CN 114390195 A CN114390195 A CN 114390195A CN 202111536844 A CN202111536844 A CN 202111536844A CN 114390195 A CN114390195 A CN 114390195A
Authority
CN
China
Prior art keywords
image
target
focal length
length information
color
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.)
Granted
Application number
CN202111536844.4A
Other languages
Chinese (zh)
Other versions
CN114390195B (en
Inventor
李亚楠
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202111536844.4A priority Critical patent/CN114390195B/en
Publication of CN114390195A publication Critical patent/CN114390195A/en
Application granted granted Critical
Publication of CN114390195B publication Critical patent/CN114390195B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • H04N23/673Focus control based on electronic image sensor signals based on contrast or high frequency components of image signals, e.g. hill climbing method

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Studio Devices (AREA)
  • Automatic Focus Adjustment (AREA)

Abstract

The present disclosure relates to an auto-focusing method, apparatus, device and storage medium, which can simplify the auto-focusing process. The specific scheme comprises the following steps: and acquiring a plurality of images according to the plurality of focal length information, wherein each piece of focal length information in the plurality of focal length information corresponds to one image. And acquiring color information of all pixel points of each image in the plurality of images. And determining target focal length information according to the color information of all pixel points in each image, wherein the target focal length information is focal length information corresponding to the target image, and the target image is an image with the highest color level in the plurality of images.

Description

Automatic focusing method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of network technologies, and in particular, to an auto-focusing method, an auto-focusing apparatus, a device, and a storage medium.
Background
With the continuous development of electronic technology, more and more electronic devices have a photographing function (for example, a mobile phone, a notebook, etc. with a camera installed). The user may use the photographing apparatus to save an image of a person or a landscape to record a wonderful moment in life.
The photographing device can automatically focus in the photographing process so as to ensure that clear images are obtained. Currently, common focusing schemes include phase focusing, contrast focusing, laser focusing, and the like. However, the above focusing scheme has great technical difficulty and a complicated implementation process.
Disclosure of Invention
The present disclosure provides an auto-focusing method, apparatus, device and storage medium, which can simplify the auto-focusing process. The technical scheme of the disclosure is as follows:
according to a first aspect of the present disclosure, there is provided a method of auto-focusing, the method comprising:
and acquiring a plurality of images according to the plurality of focal length information, wherein each piece of focal length information in the plurality of focal length information corresponds to one image. And acquiring color information of all pixel points of each image in the plurality of images. And determining target focal length information according to the color information of all pixel points in each image, wherein the target focal length information is focal length information corresponding to the target image, and the target image is an image with the highest color level in the plurality of images.
Optionally, the method for acquiring a plurality of images according to a plurality of focal length information includes: and sequentially acquiring a plurality of images through a plurality of pieces of focal length information according to a preset sequence, wherein the preset sequence is the sequence of the focal length information from small to large, or the sequence of the focal length information from large to small. Wherein, the order of the color gradation change of the plurality of images corresponding to the plurality of focal length information is: from low to high to low.
Optionally, the target image is an image with the largest target number in the plurality of images, the target number is the number of pixel points with different color information in all pixel points of the image, and the target number is used for representing the color level of the image.
Optionally, determining target focal length information according to color information of all pixel points in each image, including: and determining the target quantity of each image according to the color information of all pixel points in each image. And determining target images according to the target number of each image. And determining target focal length information according to the focal length information corresponding to the target image.
Optionally, the color information of the pixel point includes a color value. Determining the target number of each image according to the color information of all pixel points in each image, wherein the method comprises the following steps: for each image, determining a target number of each image according to a first operation; the first operation includes: comparing the color values of all pixel points in the first image with a plurality of preset color value intervals, determining a plurality of target pixel points of the first image, wherein the preset color value intervals of the color values of each target pixel point in the plurality of target pixel points are different, and the first image is any one of the plurality of images. Determining the target number of the first image, wherein the target number of the first image is used for indicating the number of a plurality of target pixel points in the first image.
Optionally, determining the target number of each image according to the color information of all pixel points in each image, further comprising: for each image, determining a target number of each image according to a second operation; the second operation includes: comparing the color values of all pixel points in the first image with a plurality of preset color value intervals, and determining a plurality of target color value intervals, wherein each target color value interval in the plurality of target color value intervals is different. A target number of the first image is determined, the target number of the first image indicating a number of the plurality of target color value intervals of the first image.
Optionally, the method of automatic focusing further includes: and receiving a shooting operation, wherein the shooting operation is used for triggering image shooting. And saving the target image.
Optionally, the method of automatic focusing further includes: and adjusting the focal length information to target focal length information. And displaying a shooting preview page, wherein the shooting preview page comprises an image to be shot, and the image to be shot is an image acquired according to the target focal length information. In response to the photographing operation, an image to be photographed is photographed in accordance with the target focal length information.
According to a second aspect of the present disclosure, there is provided an auto-focusing apparatus, comprising: the device comprises a collecting unit, a processing unit and a display unit.
The acquisition unit is configured to acquire a plurality of images according to a plurality of pieces of focal length information, wherein each piece of focal length information corresponds to one image. And the processing unit is configured to acquire color information of all pixel points of each image in the plurality of images. And the processing unit is also configured to determine target focal length information according to the color information of all pixel points in each image, wherein the target focal length information is focal length information corresponding to the target image, and the target image is an image with the highest color level in the plurality of images.
Optionally, the acquiring unit is further configured to sequentially acquire the plurality of images through the plurality of focal length information according to a preset sequence, where the preset sequence is a sequence of the focal length information from small to large, or a sequence of the focal length information from large to small. Wherein, the order of the color gradation change of the plurality of images corresponding to the plurality of focal length information is: from low to high to low.
Optionally, the target image is an image with the largest target number in the plurality of images, the target number is the number of pixel points with different color information in all pixel points of the image, and the target number is used for representing the color level of the image.
Optionally, the processing unit is specifically configured to execute, and determine the target number of each image according to the color information of all the pixel points in each image. And determining target images according to the target number of each image. And determining target focal length information according to the focal length information corresponding to the target image.
Optionally, the processing unit is specifically configured to perform, for each image, determining a target number of each image according to the first operation; the first operation includes: comparing the color values of all pixel points in the first image with a plurality of preset color value intervals, determining a plurality of target pixel points of the first image, wherein the preset color value intervals of the color values of each target pixel point in the plurality of target pixel points are different, and the first image is any one of the plurality of images. Determining the target number of the first image, wherein the target number of the first image is used for indicating the number of a plurality of target pixel points in the first image.
Optionally, the processing unit is further specifically configured to perform, for each image, determining a target number of each image according to the second operation; the second operation includes: comparing the color values of all pixel points in the first image with a plurality of preset color value intervals, and determining a plurality of target color value intervals, wherein each target color value interval in the plurality of target color value intervals is different. A target number of the first image is determined, the target number of the first image indicating a number of the plurality of target color value intervals of the first image.
Optionally, the processing unit is further configured to perform a receiving shooting operation, and the shooting operation is used for triggering to shoot the image. A processing unit further configured to perform saving the target image.
Optionally, the processing unit is further configured to perform adjusting the focal length information to the target focal length information. And the display unit is configured to execute displaying of a shooting preview page, wherein the shooting preview page comprises an image to be shot, and the image to be shot is an image acquired according to the target focal length information. And the acquisition unit is also configured to execute shooting of the image to be shot according to the target focal length information in response to the shooting operation.
According to a third aspect of the present disclosure, there is provided a terminal comprising:
a processor. A memory for storing processor-executable instructions. Wherein the processor is configured to execute the instructions to implement any of the above-described methods of the first aspect of optionally auto-focusing.
According to a fourth aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon instructions which, when executed by a processor of a terminal, enable the terminal to perform any of the above-mentioned methods of the first aspect, optionally auto-focusing.
According to a fifth aspect of the present disclosure, there is provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the method of optionally auto-focusing as in any one of the first aspects.
According to a sixth aspect of the present disclosure, there is provided a chip comprising a processor and a communication interface, the communication interface being coupled to the processor, the processor being configured to execute a computer program or instructions to implement the method of auto-focusing as described in the first aspect and any one of the possible implementations of the first aspect.
The technical scheme provided by the disclosure at least brings the following beneficial effects: and acquiring a plurality of images according to the plurality of focal length information, wherein each piece of focal length information in the plurality of focal length information corresponds to one image. And acquiring color information of all pixel points of each image in the plurality of images. And then, determining target focal length information according to the color information of all pixel points in each image. Because the color levels of the images acquired at different focal length information are different, and the color levels of the images can be determined by the color information of all pixel points of the images. Therefore, when the target image is an image with the highest color gradation among the plurality of images, the target focal length information corresponding to the target image is the optimal focusing point. In addition, the method and the device can obtain proper focal length information only by analyzing the color of the image, and the complexity of realizing automatic focusing is reduced.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
Fig. 1 is a schematic diagram illustrating the structure of a terminal according to an exemplary embodiment;
FIG. 2 is a flow chart illustrating a method of auto-focusing according to an exemplary embodiment;
FIG. 3 is a flow chart illustrating another method of auto-focusing in accordance with an exemplary embodiment;
FIG. 4 is a schematic diagram illustrating an arrangement of an autofocus apparatus according to an exemplary embodiment;
fig. 5 is a schematic structural diagram illustrating another autofocus apparatus according to an exemplary embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
It should be noted that the user information (including but not limited to user device information, user personal information, etc.) referred to in the present disclosure is information authorized by the user or sufficiently authorized by each party.
First, an application scenario of the embodiment of the present disclosure is described.
The automatic focusing method of the embodiment of the disclosure is applied to a scene of a shot image. In the related art, the photographing device can automatically focus in the photographing process to ensure that a clear image is obtained. Currently, common focusing schemes include phase focusing, contrast focusing, laser focusing, and the like. However, the above focusing scheme has great technical difficulty and a complicated implementation process.
In order to solve the above problem, an embodiment of the present disclosure provides an auto-focusing method, which acquires a plurality of images according to a plurality of focal length information, where each piece of focal length information in the plurality of focal length information corresponds to one image. And then, taking the focal length information corresponding to the image with the highest color level in the plurality of images as target focal length information. Therefore, proper focal length information can be obtained only by analyzing the color level of the image, and the process of automatic focusing is simplified.
Fig. 1 is a schematic structural diagram of a terminal device to which the method provided by the present disclosure is applied according to an embodiment of the present disclosure. The terminal device 10 includes a processor 101 and a memory 102.
The processor 101 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 101 may include an Application Processor (AP), a modem processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a memory, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors.
Memory 102 may include one or more computer-readable storage media, which may be non-transitory. Memory 102 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 102 is used to store at least one instruction for execution by processor 101 to implement the group communication method provided by the disclosed method embodiments.
In some embodiments, the terminal device 10 may further include: a peripheral interface 103 and at least one peripheral. The processor 101, memory 102 and peripheral interface 103 may be connected by bus or signal lines. Each peripheral may be connected to peripheral interface 103 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 104, display screen 105, camera assembly 106, audio circuitry 107, positioning assembly 108, and power supply 109.
The peripheral interface 103 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 101 and the memory 102. In some embodiments, processor 101, memory 102, and peripheral interface 103 are integrated on the same chip or circuit board; in some other embodiments, any one or both of the processor 101, the memory 102, and the peripheral interface 103 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
The Radio Frequency circuit 104 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 104 communicates with communication networks and other communication devices via electromagnetic signals. The rf circuit 104 converts an electrical signal into an electromagnetic signal for transmission, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 104 comprises: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuitry 104 may communicate with other terminal devices via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: metropolitan area networks, various generations of mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or Wi-Fi (Wireless Fidelity) networks. In some embodiments, the rf circuit 104 may further include NFC (Near Field Communication) related circuits, which are not limited by this disclosure.
The display screen 105 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 105 is a touch display screen, the display screen 105 also has the ability to capture touch signals on or over the surface of the display screen 105. The touch signal may be input to the processor 101 as a control signal for processing. At this point, the display screen 105 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display screen 105 may be one, providing the front panel of the terminal device 10; the Display screen 105 may be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), and the like.
The camera assembly 106 is used to capture images or video. Optionally, the camera assembly 106 includes a front camera and a rear camera. Generally, a front camera is disposed on a front panel of a terminal device, and a rear camera is disposed on a rear surface of the terminal device. Audio circuitry 107 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 101 for processing or inputting the electric signals to the radio frequency circuit 104 to realize voice communication. For the purpose of stereo sound collection or noise reduction, a plurality of microphones may be provided at different portions of the terminal device 10. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 101 or the radio frequency circuit 104 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, audio circuitry 107 may also include a headphone jack.
The positioning component 108 is used to locate the current geographic Location of the terminal device 10 to implement navigation or LBS (Location Based Service). The Positioning component 108 may be a Positioning component based on the united states GPS (Global Positioning System), the chinese beidou System, the russian graves System, or the european union's galileo System.
The power supply 109 is used to supply power to each component in the terminal device 10. The power source 109 may be alternating current, direct current, disposable or rechargeable. When power source 109 comprises a rechargeable battery, the rechargeable battery may support wired or wireless charging. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, the terminal device 10 also includes one or more sensors 1010. The one or more sensors 1010 include, but are not limited to: acceleration sensors, gyroscope sensors, pressure sensors, fingerprint sensors, optical sensors, and proximity sensors.
The acceleration sensor can detect the magnitude of acceleration in three coordinate axes of the coordinate system established with the terminal device 10. The gyroscope sensor can detect the body direction and the rotation angle of the terminal device 10, and the gyroscope sensor and the acceleration sensor can cooperatively acquire the 3D action of the user on the terminal device 10. The pressure sensors may be disposed on the side bezel of the terminal device 10 and/or underneath the display screen 105. When the pressure sensor is disposed on the side frame of the terminal device 10, a user's holding signal to the terminal device 10 can be detected. The fingerprint sensor is used for collecting fingerprints of users. The optical sensor is used for collecting the intensity of ambient light. A proximity sensor, also called a distance sensor, is generally provided on the front panel of the terminal device 10. The proximity sensor is used to capture the distance between the user and the front face of the terminal device 10.
The execution main body of the method for automatic focusing provided by the present disclosure may be an automatic focusing device, and the execution device may be the terminal device shown in fig. 1. Meanwhile, the executing device may also be a Central Processing Unit (CPU) of the terminal device, or a control module for auto-focusing in the terminal device. Optionally, the executing device may also be a server. In the embodiment of the present application, a method for performing auto focusing by a terminal device is taken as an example to describe the auto focusing method provided in the embodiment of the present application.
In one implementable manner, the terminal device is used to provide voice and/or data connectivity services to the user. Terminal equipment may be referred to by different names, such as UE side, terminal unit, terminal station, mobile station, remote terminal, mobile device, wireless communication device, vehicular user equipment, terminal agent, or terminal device, etc.
Optionally, the terminal device may be various handheld devices, vehicle-mounted devices, wearable devices, and computers with communication functions, which is not limited in this disclosure. For example, the handheld device may be a smartphone. The in-vehicle device may be an in-vehicle navigation system. The wearable device may be a smart bracelet. The computer may be a Personal Digital Assistant (PDA) computer, a tablet computer, and a laptop computer.
After the application scenario and the implementation environment of the embodiment of the present disclosure are introduced, the following describes in detail the method for automatic focusing provided by the embodiment of the present disclosure with reference to the implementation environment shown in fig. 1.
FIG. 2 is a flow chart illustrating a method of auto-focusing according to an exemplary embodiment. As shown in fig. 2, the method may include steps 201-203.
201. And acquiring a plurality of images according to the plurality of focal length information.
Wherein each of the plurality of focal length information corresponds to an image.
It should be noted that the plurality of pieces of focal length information are all focal lengths to which the terminal can adjust. For example, the focal length information that the terminal can adjust is 10 mm, 12 mm, 14 mm, respectively, and then the plurality of focal length information includes 10 mm, 12 mm, 14 mm.
Illustratively, suppose the plurality of focal length information includes 10 mm, 12 mm, 14 mm, and 16 mm. The terminal may adjust the focal distance in a fixed step-by-step manner, i.e. acquire an image once per unit focal distance adjustment. That is, images are acquired at a focal length information of 10 mm, a focal length information of 12 mm, a focal length information of 14 mm, and a focal length information of 16 mm, respectively, that is, a total of 4 images can be acquired.
As a possible implementation, a plurality of images are sequentially acquired through a plurality of focal length information according to a preset sequence. The preset sequence is the sequence of the focal length information from small to large, or the sequence of the focal length information from large to small.
Illustratively, suppose the plurality of focal length information includes: 10 mm, 12 mm, 14 mm, 16 mm and 18 mm. Under the condition that the preset sequence is the sequence from small to large of the focal length information, firstly, images are collected according to the 10 mm focal length information, then, the images are collected according to the 12 mm focal length information, then, the images are collected according to the 14 mm focal length information, and then, the images are collected according to the 16 mm focal length information. Under the condition that the preset sequence is the sequence from large focal length information to small focal length information, firstly, images are collected according to 16 mm focal length information, then, images are collected according to 14 mm focal length information, then, images are collected according to 12 mm focal length information, and then, images are collected according to 10 mm focal length information.
Wherein, the order of the color gradation change of the plurality of images corresponding to the plurality of focal length information is: from low to high to low.
It should be noted that the color gradation is used to represent the color richness of the image (or the clearness of the image), i.e., the number of colors included in the image. The color levels of the images acquired at different focal lengths are different. In the case where the focal length information is optimal, the color gradation of the image is the highest. The farther the focal length information is from the optimal target focal length information, the lower the color gradation.
Illustratively, suppose the plurality of focal length information includes: 10 mm, 12 mm, 14 mm, 16 mm and 18 mm. Under the condition that the preset sequence is the sequence from small to large of the focal length information, firstly, an image A is collected according to the 10 mm focal length information, then an image B is collected according to the 12 mm focal length information, then an image C is collected according to the 14 mm focal length information, and then an image D is collected according to the 16 mm focal length information. The color level of the image A is smaller than that of the image B, the color level of the image C is smaller than that of the image B, and the color level of the image D is smaller than that of the image C.
The technical scheme provided by the embodiment at least has the following beneficial effects: and sequentially acquiring a plurality of images according to a preset sequence through a plurality of focal length information. The method and the device can avoid the jump-type adjustment of the focal length information, and reduce the power consumption of the terminal for adjusting the focal length information. The color gradation change sequence of the plurality of images corresponding to the plurality of focal length information is: from low to high to low. Therefore, the plurality of pieces of focal length information can be guaranteed to be all pieces of focal length information in the terminal, and omission of the focal length information is avoided.
202. And acquiring color information of all pixel points of each image in the plurality of images.
As a possible implementation manner, color information of all pixel points of each image in a plurality of images is acquired by a preset pixel acquisition method. For example, the preset pixel obtaining method may be HTML5 canvas getImageData (), and the embodiment of the present disclosure does not limit the preset pixel obtaining method.
Optionally, the color information of all the pixels of each image is arranged in an array manner. For example, if the resolution of the image is 1500 × 1200, the two-dimensional array of the color information of all the pixels of the image may be 1500 × 1200, or the one-dimensional array of the color information of all the pixels of the image is 1 × 1920000.
203. And determining target focal length information according to the color information of all pixel points in each image.
The target focal length information is focal length information corresponding to the target image, and the target image is an image with the highest color level in the multiple images.
As a possible implementation, the color levels of each image are compared according to the colors of all the pixel points in each image. And then, determining the image with the highest color gradation as a target image, and determining the focal length information of the acquired target image as target focal length information.
The technical scheme provided by the embodiment at least has the following beneficial effects: and acquiring a plurality of images according to the plurality of focal length information, wherein each piece of focal length information in the plurality of focal length information corresponds to one image. And acquiring color information of all pixel points of each image in the plurality of images. And then, determining target focal length information according to the color information of all pixel points in each image. Because the color levels of the images acquired at different focal length information are different, and the color levels of the images can be determined by the color information of the pixel points of the images. Therefore, when the target image is an image with the highest color gradation among the plurality of images, the target focal length information corresponding to the target image is the optimal focusing point. In addition, the method and the device can obtain proper focal length information only by analyzing the color of the image, and the complexity of realizing automatic focusing is reduced.
In one implementable manner, as shown in FIG. 3, step 203 may include steps 301-303.
301. And determining the target quantity of each image according to the color information of all pixel points in each image.
The target number is the number of pixel points with different color information in all pixel points of the image, and the target number is used for reflecting the color level of the image.
Exemplarily, if there are 5 pixels (e.g., pixel a, pixel B, pixel C, pixel D, and pixel E) in the image a, the color information of the pixel of the image a is a first numerical value, the color information of the pixel of the image B is a second numerical value, the color information of the pixel of the image C is a third numerical value, the color information of the pixel of the image D is the first numerical value, and the color information of the pixel of the image E is the second numerical value, then the target number is 3.
It should be noted that, the larger the number of targets is, the more the pixel points of different color information in the image are, the higher the color hierarchy of the image is. The smaller the target number is, the fewer pixel points of different color information in the image are, and the lower the color level of the image is.
It can be understood that the target number is the number of the pixel points with different color information in all the pixel points of the image, the target number is used for representing the color hierarchy of the image, and the target image is the image with the maximum target number in the plurality of images. Therefore, the color level of the image can be determined through the number of the pixel points with different color information, and then the target focal length information is determined. The process is simple, and the complexity of realizing automatic focusing is reduced.
In the disclosed embodiment, the color information includes a color value, i.e., a Red Green Blue (RGB) value. Optionally, the color information further comprises a Hue Saturation Value (Hue, Saturation, Value, HSV) Value.
As a possible implementation, for each image, the target number of each image is determined according to the first operation. The first operation includes: comparing the color values of all pixel points in the first image with a plurality of preset color value intervals, determining a plurality of target pixel points of the first image, wherein the preset color value intervals of the color values of each target pixel point in the plurality of target pixel points are different, and the first image is any one of the plurality of images. And then, determining the target number of the first image, wherein the target number of the first image is used for indicating the number of a plurality of target pixel points in the first image.
It should be noted that different color values may have a smaller difference in color. Therefore, in order to identify a relatively close color value, a plurality of preset color value intervals may be set. For example, if the color value is greater than 245 and the color value is less than 255, the same color can be considered.
For example, if the plurality of predetermined color value intervals includes: a first interval, a second interval, a third interval, and a fourth interval. If the first image includes: the color information of the pixel point A is a first numerical value, the color information of the pixel point B is a second numerical value, the color information of the pixel point C is a third numerical value, the color information of the pixel point D is a fourth numerical value, and the color information of the pixel point E is a fifth numerical value. Wherein, first numerical value and fifth numerical value are in first interval, and the second numerical value is in the second interval, and third numerical value and fourth numerical value are in the third interval, and then a plurality of target pixel point include: pixel point a (or pixel point E), pixel point B, and pixel point C (or pixel point D), i.e., the number of targets is 3.
The technical scheme provided by the embodiment at least has the following beneficial effects: the color information of the pixel point comprises a color value. Comparing the color values of all the pixel points in the first image with a plurality of preset color value intervals, and determining a plurality of target pixel points of the first image, wherein the preset color value intervals of the color values of each target pixel point in the plurality of target pixel points are different. Then, a target number of the first images is determined. Therefore, the target number can be obtained through the color values of the pixel points, and then the color level and the target focal length information of the image are determined. Therefore, the automatic focusing can be realized only through the front-end technology, the process is simple, and the complexity of realizing the automatic focusing is reduced.
As another possible implementation, for each image, the target number of each image is determined according to the second operation. The second operation includes: comparing the color values of all pixel points in the first image with a plurality of preset color value intervals, and determining a plurality of target color value intervals, wherein each target color value interval in the plurality of target color value intervals is different. A target number of the first image is determined, the target number of the first image indicating a number of the plurality of target color value intervals of the first image.
For example, if the plurality of predetermined color value intervals includes: a first interval, a second interval, a third interval, and a fourth interval. If the first image includes: the color information of the pixel point A is a first numerical value, the color information of the pixel point B is a second numerical value, the color information of the pixel point C is a third numerical value, the color information of the pixel point D is a fourth numerical value, and the color information of the pixel point E is a fifth numerical value. Wherein, first numerical value and fifth numerical value are in first interval, and the second numerical value is in the second interval, and third numerical value and fourth numerical value are in the third interval, and then a plurality of target color value intervals include: the first, second and third intervals, i.e., the target number, are 3.
The technical scheme provided by the embodiment at least has the following beneficial effects: comparing the color values of all pixel points in the first image with a plurality of preset color value intervals, and determining a plurality of target color value intervals, wherein each target color value interval in the plurality of target color value intervals is different. Then, a target number of the first image is determined, wherein the target number of the first image is used for indicating the number of the target color value intervals of the first image. Therefore, the target number can be obtained through the color values of the pixel points, and then the color level and the target focal length information of the image are determined. Therefore, the automatic focusing can be realized only through the front-end technology, the process is simple, and the complexity of realizing the automatic focusing is reduced.
302. And determining target images according to the target number of each image.
The target image is the image with the largest target number in the plurality of images.
As a possible implementation, the target number of the plurality of images is compared to determine the maximum target number. Then, the image corresponding to the maximum number of objects (i.e., the object image) is determined.
Illustratively, if the number of objects in image a is 1500, the number of objects in image B is 2500, the number of objects in image C is 4000, the number of objects in image D is 2000, and the number of objects in image E is 3000, then the object image is image C.
303. And determining target focal length information according to the focal length information corresponding to the target image.
Illustratively, suppose the plurality of images includes: image a, image B, image C, and image D. The image A is an image collected according to the focal length information A, the image B is an image collected according to the focal length information B, the image C is an image collected according to the focal length information C, and the image D is an image collected according to the focal length information D. If the target image is the image C, the target focal length information is the focal length information C.
The technical scheme provided by the embodiment at least has the following beneficial effects: and determining the target quantity of each image according to the color information of all pixel points in each image. And determining target images according to the target number of each image. And determining target focal length information according to the focal length information corresponding to the target image. Therefore, the color level of the image can be identified through the front-end technology (the color information of the pixel points), the target focal length information is further determined, and the complexity of realizing automatic focusing is reduced.
In one possible implementation, a capture operation may be received prior to acquiring the plurality of images in accordance with the plurality of focal length information, the capture operation being used to trigger capturing the images. Thereafter, after determining the target focal length information, the target image may be saved.
In one possible implementation, a plurality of images are acquired in accordance with a plurality of focal length information in response to a photographing operation.
For example, taking a mobile phone as an example, after the shooting application is started, the shooting operation is received, steps 201 to 203 may be performed, and then the target image may be saved as the image shot at this time.
The technical scheme provided by the embodiment at least has the following beneficial effects: and receiving a shooting operation, wherein the shooting operation is used for triggering image shooting. After determining the target focal length information, the target image may be saved. That is, after receiving a photographing operation, the embodiments of the present disclosure may be performed, and an image with the highest gradation of color may be saved as an image photographed this time. Therefore, the automatic focusing process can be simplified, and the complexity of realizing automatic focusing is reduced.
In an implementable manner, after the target focal length information is determined, the focal length information is adjusted to the target focal length information, and a shooting preview page is displayed, wherein the shooting preview page comprises an image to be shot, and the image to be shot is an image acquired according to the target focal length information. Then, in response to the photographing operation, an image to be photographed is photographed in accordance with the target focal length information. Then, the target image is saved.
For example, in the case of a mobile phone, after the shooting application is started, steps 201 to 203 may be executed. And then, adjusting the camera of the mobile phone to the target focal length information, and displaying a shooting preview page on a display screen of the mobile phone. Thereafter, in response to a photographing operation by the user, an image may be photographed in accordance with the target focal length information.
The technical scheme provided by the embodiment at least has the following beneficial effects: and adjusting the focal length information to target focal length information. And displaying a shooting preview page, wherein the shooting preview page comprises an image to be shot, and the image to be shot is an image acquired according to the target focal length information. In response to the photographing operation, an image to be photographed is photographed in accordance with the target focal length information. That is, after the target focal length information is determined, a photographing operation may be received, and an image may be photographed according to the target focal length information. Therefore, the automatic focusing process can be simplified, and the complexity of realizing automatic focusing is reduced.
It will be appreciated that the above method may be implemented by an autofocus device. The autofocus apparatus includes hardware structures and/or software modules for performing the respective functions to realize the above functions. Those of skill in the art will readily appreciate that the various illustrative modules and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the disclosed embodiments.
The disclosed embodiments may divide the functional modules of the autofocus device according to the method examples, for example, each functional module may be divided according to each function, or two or more functions may be integrated into one processing module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. It should be noted that, the division of the modules in the embodiments of the present disclosure is illustrative, and is only one division of logic functions, and there may be another division in actual implementation.
Fig. 4 is a block diagram illustrating an arrangement of auto-focusing according to an exemplary embodiment. Referring to fig. 4, the apparatus 40 for auto-focusing includes an acquisition unit 41, a processing unit 42, and a display unit 43.
An acquisition unit 41 configured to perform acquisition of a plurality of images in accordance with a plurality of focal length information, each of the plurality of focal length information corresponding to one image. A processing unit 42 configured to perform acquiring color information of all pixel points of each of the plurality of images. The processing unit 42 is further configured to determine target focal length information according to the color information of all the pixel points in each image, where the target focal length information is focal length information corresponding to a target image, and the target image is an image with the highest color level in the plurality of images.
Optionally, the acquiring unit 41 is further configured to sequentially acquire a plurality of images through a plurality of focal length information according to a preset sequence, where the preset sequence is a sequence of focal length information from small to large, or a sequence of focal length information from large to small. Wherein, the order of the color gradation change of the plurality of images corresponding to the plurality of focal length information is: from low to high to low.
Optionally, the target image is an image with the largest target number in the plurality of images, the target number is the number of pixel points with different color information in all pixel points of the image, and the target number is used for representing the color level of the image.
Optionally, the processing unit 42 is specifically configured to execute, according to the color information of all pixel points in each image, determining the target number of each image. And determining target images according to the target number of each image. And determining target focal length information according to the focal length information corresponding to the target image.
Optionally, the processing unit 42, in particular configured to perform, for each image, determining a target number of each image according to the first operation; the first operation includes: comparing the color values of all pixel points in the first image with a plurality of preset color value intervals, determining a plurality of target pixel points of the first image, wherein the preset color value intervals of the color values of each target pixel point in the plurality of target pixel points are different, and the first image is any one of the plurality of images. Determining the target number of the first image, wherein the target number of the first image is used for indicating the number of a plurality of target pixel points in the first image.
Optionally, the processing unit 42 is further specifically configured to perform, for each image, determining a target number of each image according to the second operation; the second operation includes: comparing the color values of all pixel points in the first image with a plurality of preset color value intervals, and determining a plurality of target color value intervals, wherein each target color value interval in the plurality of target color value intervals is different. A target number of the first image is determined, the target number of the first image indicating a number of the plurality of target color value intervals of the first image.
Optionally, the processing unit 42 is further configured to perform a receiving shooting operation, and the shooting operation is used for triggering to shoot an image. The processing unit 42 is further configured to perform saving the target image.
Optionally, the processing unit 42 is further configured to perform adjusting the focal length information to the target focal length information. And a display unit 43 configured to perform displaying of a shooting preview page including an image to be shot, which is an image acquired in accordance with the target focal length information. And the acquisition unit 41 is also configured to perform shooting of an image to be shot in accordance with the target focal length information in response to the shooting operation.
With regard to the autofocus apparatus in the above-mentioned embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 5 is a schematic structural diagram of an auto-focusing apparatus 50 provided by the present disclosure. As shown in fig. 5, the autofocus apparatus 50 may include at least one processor 501 and a memory 503 for storing instructions executable by the processor 501. Wherein the processor 501 is configured to execute instructions in the memory 503 to implement the method of auto-focusing in the above-described embodiments.
In addition, the autofocus device 50 may also include a communication bus 502 and at least one communication interface 504.
The processor 501 may be a GPU, a micro-processing unit, an ASIC, or one or more integrated circuits for controlling the execution of programs in accordance with the disclosed aspects.
The communication bus 502 may include a path that conveys information between the aforementioned components.
The communication interface 504 may be any device, such as a transceiver, for communicating with other devices or communication networks, such as an ethernet, a Radio Access Network (RAN), a Wireless Local Area Network (WLAN), etc.
The memory 503 may be, but is not limited to, a read-only memory (ROM) or other type of static storage device that may store static information and instructions, a Random Access Memory (RAM) or other type of dynamic storage device that may store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory may be self-contained and connected to the processing unit by a bus. The memory may also be integrated with the processing unit as a volatile storage medium in the GPU.
The memory 503 is used for storing instructions for executing the disclosed solution, and is controlled by the processor 501. The processor 501 is configured to execute instructions stored in the memory 503 to implement the functions of the disclosed method.
In particular implementations, processor 501 may include one or more GPUs, such as GPU0 and GPU1 in fig. 5, as one embodiment.
In a specific implementation, as an embodiment, the autofocus apparatus 50 may include a plurality of processors, such as the processor 501 and the processor 507 in fig. 5. Each of these processors may be a single-Core (CPU) processor or a multi-core (multi-GPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
In a specific implementation, the autofocus apparatus 50 may further include an output device 505 and an input device 506, as an embodiment. An output device 505, which is in communication with the processor 501, may display information in a variety of ways. For example, the output device 505 may be a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display device, a Cathode Ray Tube (CRT) display device, a projector (projector), or the like. The input device 506 is in communication with the processor 501 and can accept user input in a variety of ways. For example, the input device 506 may be a mouse, a keyboard, a touch screen device, or a sensing device, among others.
Those skilled in the art will appreciate that the configuration shown in fig. 5 does not constitute a limitation of autofocus device 50 and may include more or fewer components than shown, or some components may be combined, or a different arrangement of components may be used.
The present disclosure also provides a computer-readable storage medium having instructions stored thereon, where the instructions in the storage medium, when executed by a processor of a terminal, enable the terminal to perform the group communication method provided by the embodiments of the present disclosure.
The embodiment of the present disclosure further provides a computer program product containing instructions, which when run on a terminal, causes the terminal to execute the method for automatic focusing provided by the embodiment of the present disclosure.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. An automatic focusing method is applied to a terminal, and the method comprises the following steps:
acquiring a plurality of images according to a plurality of focal length information, wherein each piece of focal length information in the plurality of focal length information corresponds to one image;
acquiring color information of all pixel points of each image in the plurality of images;
and determining target focal length information according to the color information of all pixel points in each image, wherein the target focal length information is focal length information corresponding to a target image, and the target image is an image with the highest color level in the plurality of images.
2. The method of claim 1, wherein acquiring a plurality of images in accordance with a plurality of focal length information comprises:
sequentially acquiring the plurality of images according to a preset sequence through the plurality of focal length information, wherein the preset sequence is the sequence of the focal length information from small to large, or the sequence of the focal length information from large to small;
wherein, the order of the color gradation change of the plurality of images corresponding to the plurality of focal length information is: from low to high to low.
3. The method according to claim 1 or 2, wherein the target image is an image with a maximum target number in the plurality of images, the target number is the number of pixels with different color information in all pixels of the image, and the target number is used for representing a color hierarchy of the image.
4. The method according to claim 3, wherein the determining target focal length information according to the color information of all pixel points in each image comprises:
determining the target quantity of each image according to the color information of all pixel points in each image;
determining the target images according to the target number of each image;
and determining the target focal length information according to the focal length information corresponding to the target image.
5. The method of claim 4, wherein the color information of the pixels comprises color values, and the determining the target number of each image according to the color information of all the pixels in each image comprises:
for each image, determining the target number of each image according to a first operation; the first operation includes:
comparing color values of all pixel points in a first image with a plurality of preset color value intervals, and determining a plurality of target pixel points of the first image, wherein the preset color value intervals of the color values of each target pixel point in the plurality of target pixel points are different, and the first image is any one of the plurality of images;
determining the target number of the first image, the target number of the first image being used to indicate the number of the plurality of target pixel points in the first image.
6. The method of claim 5, wherein the determining the target number of each image according to the color information of all the pixels in each image further comprises:
for each image, determining the target number of each image according to a second operation; the second operation includes:
comparing color values of all pixel points in the first image with a plurality of preset color value intervals to determine a plurality of target color value intervals, wherein each target color value interval in the plurality of target color value intervals is different;
determining the target number of the first image, the target number of the first image indicating a number of the plurality of target color value intervals of the first image.
7. An automatic focusing device, applied to a terminal, includes:
the image acquisition device comprises an acquisition unit, a processing unit and a display unit, wherein the acquisition unit is configured to acquire a plurality of images according to a plurality of focal length information, and each piece of focal length information in the plurality of focal length information corresponds to one image;
a processing unit configured to perform acquiring color information of all pixel points of each of the plurality of images;
the processing unit is further configured to determine target focal length information according to color information of all pixel points in each image, where the target focal length information is focal length information corresponding to a target image, and the target image is an image with the highest color level in the plurality of images.
8. A terminal, characterized in that the terminal comprises:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method of auto-focusing according to any one of claims 1-6.
9. A computer-readable storage medium having instructions stored thereon, wherein the instructions in the computer-readable storage medium, when executed by a processor of a terminal, enable the terminal to perform the method of auto-focusing according to any one of claims 1-6.
10. A computer program product comprising computer programs/instructions, characterized in that the computer programs/instructions, when executed by a processor, implement the method of auto-focusing according to any of claims 1-6.
CN202111536844.4A 2021-12-15 2021-12-15 Automatic focusing method, device, equipment and storage medium Active CN114390195B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111536844.4A CN114390195B (en) 2021-12-15 2021-12-15 Automatic focusing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111536844.4A CN114390195B (en) 2021-12-15 2021-12-15 Automatic focusing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114390195A true CN114390195A (en) 2022-04-22
CN114390195B CN114390195B (en) 2024-03-22

Family

ID=81198183

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111536844.4A Active CN114390195B (en) 2021-12-15 2021-12-15 Automatic focusing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114390195B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW397930B (en) * 1999-11-30 2000-07-11 Dynacolor Inc The multi-focus picturing method and its device
JP2004184634A (en) * 2002-12-02 2004-07-02 Lapole System:Kk Automatic focusing method and device
JP2005250401A (en) * 2004-03-08 2005-09-15 Kodak Digital Product Center Japan Ltd Method for detecting focal distance and focusing device
JP2009069303A (en) * 2007-09-11 2009-04-02 Olympus Imaging Corp Camera
CN102891966A (en) * 2012-10-29 2013-01-23 珠海全志科技股份有限公司 Focusing method and device for digital imaging device
CN106412423A (en) * 2016-09-19 2017-02-15 珠海格力电器股份有限公司 Focusing method and device
CN112261292A (en) * 2020-10-20 2021-01-22 Oppo广东移动通信有限公司 Image acquisition method, terminal, chip and storage medium
CN113545030A (en) * 2019-09-30 2021-10-22 谷歌有限责任公司 Automatic generation of full focus images by moving camera

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW397930B (en) * 1999-11-30 2000-07-11 Dynacolor Inc The multi-focus picturing method and its device
JP2004184634A (en) * 2002-12-02 2004-07-02 Lapole System:Kk Automatic focusing method and device
JP2005250401A (en) * 2004-03-08 2005-09-15 Kodak Digital Product Center Japan Ltd Method for detecting focal distance and focusing device
JP2009069303A (en) * 2007-09-11 2009-04-02 Olympus Imaging Corp Camera
CN102891966A (en) * 2012-10-29 2013-01-23 珠海全志科技股份有限公司 Focusing method and device for digital imaging device
CN106412423A (en) * 2016-09-19 2017-02-15 珠海格力电器股份有限公司 Focusing method and device
CN113545030A (en) * 2019-09-30 2021-10-22 谷歌有限责任公司 Automatic generation of full focus images by moving camera
CN112261292A (en) * 2020-10-20 2021-01-22 Oppo广东移动通信有限公司 Image acquisition method, terminal, chip and storage medium

Also Published As

Publication number Publication date
CN114390195B (en) 2024-03-22

Similar Documents

Publication Publication Date Title
US11604574B2 (en) Electronic device and method for electronic device displaying image
CN113905179B (en) Method for switching cameras by terminal and terminal
CN111179282B (en) Image processing method, image processing device, storage medium and electronic apparatus
KR20150077646A (en) Image processing apparatus and method
CN109302632B (en) Method, device, terminal and storage medium for acquiring live video picture
US20240119566A1 (en) Image processing method and apparatus, and electronic device
CN111144365A (en) Living body detection method, living body detection device, computer equipment and storage medium
WO2020015149A1 (en) Wrinkle detection method and electronic device
WO2021179186A1 (en) Focusing method and apparatus, and electronic device
CN110138999B (en) Certificate scanning method and device for mobile terminal
CN109754439B (en) Calibration method, calibration device, electronic equipment and medium
CN111127541A (en) Vehicle size determination method and device and storage medium
CN112508959A (en) Video object segmentation method and device, electronic equipment and storage medium
CN115798417A (en) Backlight brightness determination method, device, equipment and computer readable storage medium
CN114332118A (en) Image processing method, device, equipment and storage medium
CN115150542B (en) Video anti-shake method and related equipment
CN114390195B (en) Automatic focusing method, device, equipment and storage medium
CN113709353B (en) Image acquisition method and device
CN108881739B (en) Image generation method, device, terminal and storage medium
CN110443841B (en) Method, device and system for measuring ground depth
CN112399080A (en) Video processing method, device, terminal and computer readable storage medium
CN114527903A (en) Key mapping method, electronic equipment and system
CN116708751B (en) Method and device for determining photographing duration and electronic equipment
CN116703741B (en) Image contrast generation method and device and electronic equipment
CN111353934B (en) Video synthesis method and device

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