CN112040121B - Focusing method and device, storage medium and terminal - Google Patents

Focusing method and device, storage medium and terminal Download PDF

Info

Publication number
CN112040121B
CN112040121B CN202010839188.4A CN202010839188A CN112040121B CN 112040121 B CN112040121 B CN 112040121B CN 202010839188 A CN202010839188 A CN 202010839188A CN 112040121 B CN112040121 B CN 112040121B
Authority
CN
China
Prior art keywords
pixel
focusing
preset
circle radius
pixel area
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
Application number
CN202010839188.4A
Other languages
Chinese (zh)
Other versions
CN112040121A (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.)
Jiangxi Oumaisi Microelectronics Co Ltd
Original Assignee
Jiangxi Oumaisi Microelectronics 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 Jiangxi Oumaisi Microelectronics Co Ltd filed Critical Jiangxi Oumaisi Microelectronics Co Ltd
Priority to CN202010839188.4A priority Critical patent/CN112040121B/en
Publication of CN112040121A publication Critical patent/CN112040121A/en
Application granted granted Critical
Publication of CN112040121B publication Critical patent/CN112040121B/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

Landscapes

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

Abstract

The embodiment of the application discloses a focusing method, a focusing device, a storage medium and a terminal, and belongs to the technical field of computers. The method comprises the following steps: the terminal determines the inner circle radius and the outer circle radius of a preset focusing image based on a focusing index, the preset focusing image is a circular ring type focusing image, the preset focusing image comprises a black fan ring and a white fan ring, the first pixel area of an outer circle is determined based on the outer circle radius, the second pixel area of the inner circle is determined based on the inner circle radius, the first total pixel amount in the first circular ring pixel area is determined, the pixel proportion of pixels with brightness values lower than a preset brightness threshold value in the first total pixel amount is calculated, the first circular ring pixel area is the difference value of the first pixel area and the second pixel area, when the pixel proportion is smaller than the preset proportion threshold value, the outer circle radius and the inner circle radius are adjusted until the pixel proportion is larger than or equal to the preset proportion threshold value, accurate focusing of the camera module can be achieved, and a good focusing effect can be obtained.

Description

Focusing method and device, storage medium and terminal
Technical Field
The present application relates to the field of computer technologies, and in particular, to a focusing method and apparatus, a storage medium, and a terminal.
Background
The camera module, namely an image acquisition module in the camera lens, mainly comprises a lens and an image sensor, and each camera module can be focused according to different application scenes in the manufacturing process, so that ideal images can be acquired in the respective suitable application scenes. In the related art, the edge pixel sharpness of a black and white focusing image acquired by a camera module is usually calculated based on an SFR algorithm, and focusing of the camera module is further assisted by a manual focusing method, but when the edge pixel sharpness is calculated, part of parameter details may be lost, so that the adjustment effect is not intuitive, and a better focusing effect cannot be obtained.
Disclosure of Invention
The embodiment of the application provides a focusing method, a focusing device, a storage medium and a terminal, and can solve the problem of poor focusing quality obtained by focusing a camera module in the related art. The technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a focusing method, where the method includes:
determining the inner circle radius and the outer circle radius of a preset focusing graph based on the focusing index; the preset focusing graph is an annular focusing graph and comprises a black fan ring and a white fan ring;
determining a first pixel area of an outer circle based on the outer circle radius, and determining a second pixel area of an inner circle based on the inner circle radius;
determining a first total pixel quantity in the area of the first annular pixel, and calculating the pixel proportion of pixels with brightness values lower than a preset brightness threshold value in the first total pixel quantity; wherein the first annular pixel area is a difference value between the first pixel area and the second pixel area;
and when the pixel proportion is smaller than a preset proportion threshold, adjusting the outer circle radius and the inner circle radius until the pixel proportion is larger than or equal to the preset proportion threshold.
In a second aspect, an embodiment of the present application provides a focusing apparatus, including:
the first determining module is used for determining the inner circle radius and the outer circle radius of a preset focusing map based on the focusing index; the preset focusing graph is an annular focusing graph and comprises a black fan ring and a white fan ring;
a second determining module for determining a first pixel area of the outer circle based on the outer circle radius and a second pixel area of the inner circle based on the inner circle radius;
the processing module is used for determining a first total pixel quantity in the area of the first annular pixel and calculating the pixel proportion of a pixel with a brightness value lower than a preset brightness threshold value in the first total pixel quantity; wherein the first annular pixel area is a difference value between the first pixel area and the second pixel area;
and the adjusting module is used for adjusting the outer circle radius and the inner circle radius when the pixel proportion is smaller than a preset proportion threshold value until the pixel proportion is larger than or equal to the preset proportion threshold value.
In a third aspect, embodiments of the present application provide a computer storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the above-mentioned method steps.
In a fourth aspect, an embodiment of the present application provides a terminal, including: a processor, a memory, and a display unit; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the above-mentioned method steps.
The beneficial effects brought by the technical scheme provided by some embodiments of the application at least comprise:
when the scheme of the embodiment of the application is executed, the terminal determines the inner circle radius and the outer circle radius of a preset focusing map based on the focusing index, the preset focusing map is a ring-shaped focusing map, the preset focusing map comprises a black fan ring and a white fan ring, the first pixel area of the outer circle is determined based on the outer circle radius, and determining a second pixel area of the inner circle based on the radius of the inner circle, determining a first total pixel amount in the first ring pixel area, and calculating the pixel ratio of the pixels with the brightness values lower than the preset brightness threshold value in the first total pixel quantity, wherein the first annular pixel area is the difference value between the first pixel area and the second pixel area, when the pixel ratio is smaller than the preset ratio threshold, the outer circle radius and the inner circle radius are adjusted until the pixel ratio is larger than or equal to the preset ratio threshold, so that accurate focusing of the camera module can be achieved, and a good focusing effect can be obtained.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic view of a focusing system of a lens module according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of a focusing method provided in an embodiment of the present application;
fig. 3 is another schematic flowchart of a focusing method provided in an embodiment of the present application;
FIG. 4 is a comparison image before and after focusing provided by an embodiment of the present application;
FIG. 5 is a schematic view of a focusing apparatus according to an embodiment of the present disclosure;
fig. 6 is a schematic view of a focusing apparatus according to an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the application, as detailed in the appended claims.
In the description of the present application, it is to be understood that the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. The specific meaning of the above terms in the present application can be understood in a specific case by those of ordinary skill in the art. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
In order to make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Fig. 1 is a schematic view of a focusing system of a lens module according to the present disclosure.
Referring to fig. 1, a focusing system of a lens module includes a lens module 101, a processor 102, a display 103, and a focusing drawing 104, where the processor 102 and the display 103 may together form a focusing terminal, and the focusing drawing 104 includes a circular ring-shaped focusing drawing, and the focusing drawing mainly includes a black fan ring and a white fan ring. The focusing system can be used for focusing the lens module 101 to be focused, the lens module 101 is electrically connected with the focusing terminal, a user can operate the focusing system to control the lens module 101 to collect focusing drawing 104 to obtain a focusing image, namely a preset focusing image, the processor 102 can further perform focusing processing on the lens module 101 based on a focusing index set by the user and the preset focusing image collected by the lens module 101, a focusing image with good focusing can be obtained after the focusing processing, and the focusing image can be visually displayed through the display 103.
The lens module 101 is mainly composed of a lens, a DVS dynamic vision sensor, and a circuit module electrically connected to the DVS dynamic vision sensor, that is, an image capturing module in the camera lens, which may also be referred to as a camera module. The DVS dynamic vision sensor is a core module of the lens module 101, is a novel image sensor, and is different from a conventional Complementary Metal Oxide Semiconductor (CMOS) sensor or a Charge Coupled Device (CCD) sensor, the DVS image sensor may observe whether light intensity of each pixel point slightly changes with time according to illumination change intensity of a scene, and read and output the pixel point of which the contrast change exceeds a preset threshold value according to the illumination change intensity, so as to generate a DVS image, and if the DVS can generate a corresponding event according to a pixel brightness value in the acquired image: an event (pixel) having a luminance value lower than a preset luminance threshold value, and an event (pixel) having a luminance value higher than a preset luminance threshold value. The lens is formed by combining different lenses, is an important component of the lens module 101, and plays a very important role in the imaging effect; the lens can determine the frame sharpness (frame sharpness, light, distance) and the image display range, and also affect the highest pixels of the image.
The focus terminal mainly comprises a processor 102 and a display 103, as well as a memory for storage. Processor 102 may include one or more processing cores. The processor 102 connects various parts within the overall terminal using various interfaces and lines, performs various functions of the terminal and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory, and calling data stored in the memory. Alternatively, the processor may be implemented in hardware using at least one of Digital Signal Processing (DSP), field-programmable gate Array (FPGA), and Programmable Logic Array (PLA). The processor 102 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 102, but may be implemented by a communication chip.
The display 103 may be any of a variety of devices capable of performing display functions, such as: a cathode ray tube display (CR), a light-emitting diode display (LED), an electronic ink panel, a Liquid Crystal Display (LCD), a Plasma Display Panel (PDP), and the like. The user can view information such as displayed text (focus parameters), images (focus images), video, and the like, using the display 103 in the focus system.
The memory may include Random Access Memory (RAM) or read-only memory (ROM). Optionally, the memory includes a non-transitory computer-readable medium. The memory may be used to store an instruction, a program, code, a set of codes, or a set of instructions. The memory may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described below, and the like, and the operating system may be an Android (Android) system (including an Android system depth development-based system), an IOS system developed by apple, including an IOS system depth development-based system, or other systems.
In the following method embodiments, for convenience of description, only the main execution body of each step is described as a terminal.
The focusing method provided by the embodiment of the present application will be described in detail below with reference to fig. 2 to 4.
Referring to fig. 2, a schematic flow chart of a focusing method according to an embodiment of the present application is provided. The present embodiment is exemplified by applying a focusing method to a terminal, and the focusing method may include the following steps:
s201, determining the inner circle radius and the outer circle radius of a preset focusing map based on the focusing index.
The focusing index is an expected parameter value which needs to be reached by focusing, the focusing index can be a specific focal length parameter, the preset focusing picture is a focusing image obtained by acquiring a focusing drawing through a lens module by a terminal, the preset focusing picture is an annular focusing picture, the preset focusing picture comprises a black fan ring and a white fan ring, the inner circle of the preset focusing picture corresponds to the inner circle radius, the outer circle of the preset focusing picture corresponds to the outer circle radius, and the ratio of the outer circle radius to the inner circle radius is a preset ratio (fixed ratio).
Generally, a focusing index can be set on the terminal by a user, such as: the focusing index preliminary estimation method comprises the steps that a focal length value expected by a user is obtained, meanwhile, a terminal controls a lens module to collect a focusing map on a focusing drawing to obtain an initial focusing image (a preset focusing map), further, the terminal preliminarily estimates a focusing index set by the user to obtain an inner circle radius and an outer circle radius of the preset focusing map, image adjustment is carried out on the preset focusing map based on the preliminary inner circle radius and the outer circle radius, the pixel area of an outer circle and the pixel area of an inner circle in the preset focusing map are determined based on the inner circle radius and the outer circle radius, and then the pixel area corresponding to a ring in the preset focusing map can be calculated based on the pixel area of the outer circle and the pixel area of the inner.
S202, determining a first pixel area of the outer circle based on the radius of the outer circle, and determining a second pixel area of the inner circle based on the radius of the inner circle.
The first pixel area refers to a pixel area corresponding to an outer circle of a ring in the preset focusing image, and the second pixel area refers to a pixel area corresponding to an inner circle of the ring in the preset focusing image.
Generally, the preset focusing map is a circular ring type focusing map, and a circular ring mainly includes a black fan ring and a white fan ring, so that a pixel area (a first pixel area) of an outer circle in the circular ring can be determined based on an outer circle radius, a pixel area (a second pixel area) of an inner circle in the circular ring can be determined based on an inner circle radius, and a plurality of pixels are included in the first pixel area and the second pixel area.
S203, determining a first total pixel amount in the area of the first annular pixel, and calculating the pixel proportion of the pixel with the brightness value lower than the preset brightness threshold value in the first total pixel amount.
The first ring pixel area refers to an area difference value between the first pixel area and the second pixel area, that is, a pixel area of a ring in a preset focusing image, the first total pixel amount refers to the total number of pixels in the first ring pixel area, the first ring pixel area includes pixels with brightness values lower than a preset brightness threshold value and pixels with brightness values higher than the preset brightness threshold value, and the pixel proportion refers to the proportion of pixels with brightness values lower than the preset brightness threshold value in the first total pixel amount.
Generally, after determining the area of the pixels in the ring in the preset focusing map, the total number of pixels included in the first ring pixel area, that is, the first total pixel amount, may be calculated, and meanwhile, the luminance values of the plurality of pixels in the first ring pixel area may also be calculated, so as to obtain the number of pixels having luminance values lower than the preset luminance threshold value in the first ring pixel area, and based on the number and the first total pixel amount, the pixel occupation ratio of the pixels having luminance values lower than the preset luminance threshold value in the first ring pixel area may be calculated.
And S204, when the pixel ratio is smaller than the preset ratio threshold, adjusting the outer circle radius and the inner circle radius until the pixel ratio is larger than or equal to the preset ratio threshold.
The preset duty ratio threshold is an expected value that the pixel duty ratio needs to reach, and can be determined based on a focusing index set by a user.
Generally, after a terminal acquires a focusing index set by a user, a corresponding preset ratio threshold is generated based on the focusing index, a pixel ratio is obtained by calculating a ratio of pixels with brightness values lower than the preset brightness threshold in a total pixel in an annular pixel area, and whether focusing can be finished is determined based on the pixel ratio: if the pixel proportion is larger than or equal to the preset proportion threshold, determining that the focusing can be finished, wherein the focal length of the lens module meets the condition of a focusing index set by a user; if the pixel proportion is smaller than a preset proportion threshold value, determining a radius adjusting value based on the pixel proportion in the first total pixel quantity, reducing the outer circle radius based on the radius adjusting value, reducing the inner circle radius based on the radius adjusting value, wherein the ratio of the outer circle radius to the inner circle radius is a preset ratio, determining a third pixel area of the outer circle based on the adjusted outer circle radius, determining a fourth pixel area of the inner circle based on the adjusted inner circle radius, determining a second total pixel quantity in a second ring pixel area, calculating the pixel proportion of pixels with brightness values lower than the preset brightness threshold value in the second total pixel quantity, wherein the second ring pixel area is the difference value between the third pixel area and the fourth pixel area, and determining that focusing is finished when the pixel proportion is larger than or equal to the preset proportion threshold value; upon determining that focusing is finished, a focused image may be acquired and displayed through the display unit.
For example, the following steps are carried out: the focusing index set by a user is focal length 3m, the terminal determines the preset duty ratio threshold value to be 80% according to the focusing index set by the user, the terminal can predict and obtain the outer circle radius and the inner circle radius of a circular ring in the preset focusing picture according to the focal length 3m, after the preset focusing picture is subjected to image adjustment based on the outer circle radius and the inner circle radius, the duty ratio of pixels of which the brightness values are lower than the preset brightness threshold value in the circular ring of the preset focusing picture is calculated to be 60%, the focal length at the moment cannot reach the focusing index set by the user, the radius adjusting value of the circular ring radius can be determined based on the current pixel duty ratio and the focusing index, the outer circle radius and the inner circle radius of the circular ring are simultaneously reduced based on the radius adjusting value, the duty ratio of the pixels of which the brightness values are lower than the preset brightness threshold value in the circular ring of the preset focusing picture after the radius is reduced is calculated again, and when the pixel duty ratio reaches 80%, i.e. indicating the end of the focusing.
From the above, the present solution provides a focusing method, in which the terminal determines an inner circle radius and an outer circle radius of a preset focusing map based on the focusing index, the preset focusing map is an annular focusing map, the preset focusing map includes a black sector ring and a white sector ring, determines a first pixel area of the outer circle based on the outer circle radius, and determining a second pixel area of the inner circle based on the radius of the inner circle, determining a first total pixel amount in the first ring pixel area, and calculating the pixel ratio of the pixels with the brightness values lower than the preset brightness threshold value in the first total pixel quantity, wherein the first annular pixel area is the difference value between the first pixel area and the second pixel area, when the pixel ratio is smaller than the preset ratio threshold, the outer circle radius and the inner circle radius are adjusted until the pixel ratio is larger than or equal to the preset ratio threshold, so that accurate focusing of the camera module can be achieved, and a good focusing effect can be obtained.
Referring to fig. 3, another schematic flow chart of a focusing method according to an embodiment of the present application is provided. The present embodiment is exemplified by applying a focusing method to a terminal. The focusing method may include the steps of:
s301, collecting a preset focusing image through a camera, and acquiring a focusing index.
The preset focusing graph refers to a focusing image obtained by acquiring a focusing drawing through a lens module by a terminal, and is an annular focusing graph, the preset focusing graph comprises a black fan ring and a white fan ring, the inner circle of the preset focusing graph corresponds to the inner circle radius, and the outer circle of the preset focusing graph corresponds to the outer circle radius. The focusing index refers to an expected parameter value required to be achieved by focusing, and the focusing index can be a specific focal length parameter.
Generally, a user can set a focusing index on a terminal according to own needs, such as: the focusing index preliminary estimation method comprises the steps that a focal length value expected by a user is obtained, meanwhile, a terminal controls a lens module to collect a focusing image on a focusing drawing to obtain an initial focusing image (a preset focusing image), further, the terminal preliminarily estimates a focusing index set by the user to obtain the inner circle radius and the outer circle radius of the preset focusing image, and image adjustment can be carried out on the preset focusing image on the basis of the preliminary inner circle radius and the preliminary outer circle radius.
S302, determining the inner circle radius and the outer circle radius of the preset focusing map based on the focusing index.
Generally, a terminal can determine an expected value to be focused by acquiring a focusing index set by a user, estimate an initial ring radius of a preset focusing map based on the focusing index, that is, estimate an inner circle radius and an outer circle radius of a ring in the preset focusing map to obtain initial values of the inner circle radius and the outer circle radius, where the ratio of the outer circle radius to the inner circle radius is a preset ratio (fixed ratio), and the terminal can correspondingly adjust the preset focusing map based on the initial values of the inner circle radius and the outer circle radius, that is, perform overall zooming adjustment on the ring in the preset focusing map.
S303, determining a first pixel area of the outer circle based on the radius of the outer circle, and determining a second pixel area of the inner circle based on the radius of the inner circle.
The first pixel area refers to a pixel area corresponding to an outer circle of a ring in the preset focusing image, and the second pixel area refers to a pixel area corresponding to an inner circle of the ring in the preset focusing image.
Generally, the preset focusing map is a ring-shaped focusing map, and a ring mainly includes a black ring and a white ring, so that a pixel area (a first pixel area) of an outer circle in the ring can be determined based on an outer circle radius, a pixel area (a second pixel area) of an inner circle in the ring can be determined based on an inner circle radius, and then the pixel area corresponding to the ring in the preset focusing map can be calculated from the first pixel area and the second pixel area, and the pixel area of the ring includes a plurality of pixels.
S304, determining a first total pixel quantity in the area of the first circular ring pixels, and the quantity of the pixels with the brightness values lower than a preset brightness threshold value in the area of the first circular ring pixels.
The first ring pixel area refers to an area difference value between the first pixel area and the second pixel area, that is, a pixel area of a ring in a preset focusing diagram, the first total pixel quantity refers to the total quantity of pixels in the first ring pixel area, and the first ring pixel area includes pixels with brightness values lower than a preset brightness threshold value and pixels with brightness values higher than the preset brightness threshold value.
Generally, after determining the area of the pixels in the ring in the preset focusing map, the total number of pixels included in the first ring pixel area, that is, the first total pixel amount, may be calculated, and meanwhile, the luminance values of the plurality of pixels in the first ring pixel area may also be calculated, so as to obtain the number of pixels having luminance values lower than the preset luminance threshold value in the first ring pixel area, and based on the number and the first total pixel amount, the pixel occupation ratio of the pixels having luminance values lower than the preset luminance threshold value in the first ring pixel area may be calculated.
S305, calculating the pixel ratio based on the number and the first total pixel amount.
The pixel proportion refers to the proportion of pixels with brightness values lower than a preset brightness threshold value in the first total pixel quantity.
S306, judging whether the pixel ratio is smaller than a preset ratio threshold value.
The preset duty ratio threshold is an expected value that the pixel duty ratio needs to reach, and can be determined based on a focusing index set by a user.
Generally, after a terminal acquires a focusing index set by a user, a corresponding preset ratio threshold value is generated based on the focusing index, a pixel ratio is obtained by calculating the ratio of pixels with brightness values lower than the preset brightness threshold value in the area of circular ring pixels in total pixels, and whether focusing is finished or not can be determined by judging whether the pixel ratio is smaller than the preset ratio threshold value or not; if the pixel ratio is smaller than the preset ratio threshold, executing step S307; if the pixel occupation ratio is greater than or equal to the preset occupation ratio threshold, the step S311 is executed.
S307, when the pixel ratio is smaller than the preset ratio threshold value, a radius adjusting value is determined based on the pixel ratio in the first total pixel quantity.
The radius adjusting value refers to a numerical value of the outer circle radius and the inner circle radius which need to be adjusted, and the outer circle radius and the inner circle radius can be adjusted to be smaller based on the radius adjusting value.
Generally, when it is determined that the pixel proportion of the total pixel amount in the ring of the pixels with the brightness values lower than the preset brightness threshold value in the ring of the current preset focusing map is smaller than the preset proportion threshold value, it indicates that the current focal length of the lens module still does not meet the requirement of the user, so that it is necessary to determine a radius adjustment value that needs to reduce the radius of the ring, that is, a radius adjustment value that simultaneously reduces the inner circle radius and the outer circle radius of the ring, based on the focusing index set by the user and the current pixel proportion in the ring, that is, perform overall reduction adjustment on the ring in the preset focusing map.
S308, the outer circle radius is adjusted to be small based on the radius adjusting value, and the inner circle radius is adjusted to be small based on the radius adjusting value.
For example, the following steps are carried out: the focusing index set by a user is focal length 3m, the terminal determines the preset duty ratio threshold value to be 80% according to the focusing index set by the user, the terminal can predict and obtain the outer circle radius and the inner circle radius of a circular ring in the preset focusing picture according to the focal length 3m, after the preset focusing picture is subjected to image adjustment based on the outer circle radius and the inner circle radius, the duty ratio of pixels of which the brightness values are lower than the preset brightness threshold value in the circular ring of the preset focusing picture is calculated to be 60%, the focal length at the moment cannot reach the focusing index set by the user, the radius adjusting value of the circular ring radius can be determined based on the current pixel duty ratio and the focusing index, the outer circle radius and the inner circle radius of the circular ring are simultaneously reduced based on the radius adjusting value, the duty ratio of the pixels of which the brightness values are lower than the preset brightness threshold value in the circular ring of the preset focusing picture after the radius is reduced is calculated again, and when the pixel duty ratio reaches 80%, the focal length at the moment reaches the focusing index set by the user, i.e. indicating the end of the focusing.
S309, determining a third pixel area of the outer circle based on the adjusted outer circle radius, and determining a fourth pixel area of the inner circle based on the adjusted inner circle radius.
The third pixel area refers to a pixel area corresponding to an outer circle of a ring in a preset focusing diagram after the outer circle radius is adjusted, the fourth pixel area refers to a pixel area corresponding to an inner circle of the ring in the preset focusing diagram after the inner circle radius is adjusted, and the pixel area of the ring in the preset focusing diagram after the outer circle radius and the inner circle radius are adjusted can be calculated and obtained usually based on the third pixel area and the fourth pixel area.
S310, determining a second total pixel quantity in the area of the second circular ring pixel, and calculating the pixel proportion of the pixel with the brightness value lower than the preset brightness threshold value in the second total pixel quantity.
The second ring pixel area refers to an area difference value between a third pixel area and a fourth pixel area, namely, the pixel area of a ring in a focusing image is preset after the outer circle radius and the inner circle radius are adjusted, the second total pixel quantity refers to the total quantity of pixels in the second ring pixel area, the second ring pixel area includes pixels with brightness values lower than a preset brightness threshold value and pixels with brightness values higher than the preset brightness threshold value, and the pixel proportion refers to the proportion of pixels with brightness values lower than the preset brightness threshold value in the second total pixel quantity.
Generally, the area of the pixels in the ring in the preset focusing map after the outer circle radius and the inner circle radius are adjusted, that is, the area of the pixels in the second ring, can be calculated based on the third pixel area and the fourth pixel area.
And S311, when the pixel ratio is larger than or equal to the preset ratio threshold value, determining that the focusing is finished.
Generally, when it is determined that the pixel proportion of the pixel with the brightness value lower than the preset brightness threshold in the area of the second annular pixel is greater than or equal to the preset proportion threshold, it indicates that the focal length of the lens module at this time can meet the requirement of the focusing index set by the user, that is, it indicates that the focusing on the lens module is completed.
S312, the focused image after focusing is acquired, and the focused image is displayed by the display unit.
The focusing image is an image obtained by adjusting the outer circle radius and the inner circle radius of a ring in a preset focusing image at least once, namely the preset focusing image is obtained after focusing is finished, the pixel proportion of a pixel with a brightness value lower than a preset brightness threshold value in the focusing image in the area of the ring pixel is greater than or equal to a preset proportion threshold value, namely the focusing image meets the relevant requirements of a focusing index set by a user.
Generally, after adjusting ring radius (inner circle radius and excircle radius) in presetting focusing image many times based on user's focusing index, can obtain the focusing image that satisfies the focusing index requirement that the user set up, in order to facilitate the user can directly perceivedly observe the focusing result, can show the focusing image that finally obtains through the display element at terminal, can see the focusing image of fig. 4: the left image 401 is a focusing image obtained after focusing, and the right image 402 is a preset focusing image initially acquired by the lens module.
As can be seen from the above, in the focusing method provided in this embodiment, the terminal acquires the preset focusing map through the camera and obtains the focusing index, determines the inner circle radius and the outer circle radius of the preset focusing map based on the focusing index, determines the first pixel area of the outer circle based on the outer circle radius, determines the second pixel area of the inner circle based on the inner circle radius, determines the first total pixel amount in the first ring pixel area and the number of pixels having luminance values lower than the preset luminance threshold value in the first ring pixel area, calculates the pixel proportion based on the number and the first total pixel amount, determines whether the pixel proportion is smaller than the preset proportion threshold value, determines the radius adjustment value based on the pixel proportion in the first total pixel amount when the pixel proportion is smaller than the preset proportion threshold value, reduces the outer circle radius based on the radius adjustment value, and reduces the inner circle radius based on the radius adjustment value, the method comprises the steps of determining a third pixel area of an outer circle based on an adjusted outer circle radius, determining a fourth pixel area of an inner circle based on an adjusted inner circle radius, determining a second total pixel amount in a second ring pixel area, calculating a pixel proportion of pixels with brightness values lower than a preset brightness threshold value in the second total pixel amount, determining that focusing is finished when the pixel proportion is larger than or equal to the preset proportion threshold value, obtaining a focused image after focusing, and displaying the focused image through a display unit.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
Referring to fig. 5, a schematic structural diagram of a focusing apparatus provided in an exemplary embodiment of the present application is shown, which is hereinafter referred to as an apparatus 5. The apparatus 5 may be implemented as all or part of a terminal by software, hardware or a combination of both. The device 5 is applied to a terminal, and the device 5 comprises:
a first determining module 501, configured to determine an inner circle radius and an outer circle radius of a preset focusing map based on a focusing index; the preset focusing graph is an annular focusing graph and comprises a black fan ring and a white fan ring;
a second determining module 502, configured to determine a first pixel area of the outer circle based on the outer circle radius, and determine a second pixel area of the inner circle based on the inner circle radius;
the processing module 503 is configured to determine a first total pixel amount in the area of the first annular pixel, and calculate a pixel proportion of a pixel with a luminance value lower than a preset luminance threshold in the first total pixel amount; wherein the first annular pixel area is a difference value between the first pixel area and the second pixel area;
an adjusting module 504, configured to adjust the outer circle radius and the inner circle radius when the pixel proportion is smaller than a preset proportion threshold until the pixel proportion is greater than or equal to the preset proportion threshold.
Optionally, the processing module 503 includes:
a first determining unit, configured to determine a first total pixel amount in the first circular pixel area, and a number of pixels in the first circular pixel area, where the luminance value is lower than a preset luminance threshold;
a first calculation unit configured to calculate the pixel fraction based on the number and the first total pixel amount.
Optionally, the adjusting module 504 includes:
the first adjusting unit is used for adjusting the outer circle radius and the inner circle radius;
a second determining unit, configured to determine a third pixel area of the outer circle based on the adjusted radius of the outer circle, and determine a fourth pixel area of the inner circle based on the adjusted radius of the inner circle;
the first processing unit is used for determining a second total pixel quantity in the area of the second annular pixel and calculating the pixel proportion of the pixel with the brightness value lower than a preset brightness threshold value in the second total pixel quantity; wherein the second annular pixel area is a difference between the third pixel area and the fourth pixel area;
and a third determining unit configured to determine that focusing is finished when the pixel occupancy is greater than or equal to the preset occupancy threshold.
Optionally, the adjusting module 504 includes:
a fourth determination unit configured to determine a radius adjustment value based on the pixel proportion in the first total pixel amount;
a second adjusting unit for adjusting the outer circle radius to be smaller based on the radius adjustment value and adjusting the inner circle radius to be smaller based on the radius adjustment value; the ratio of the outer circle radius to the inner circle radius is a preset ratio.
Optionally, the adjusting module 504 further includes:
an acquisition unit configured to acquire a focused image after focusing;
and the display unit is used for displaying the focusing image through the display unit.
Optionally, the apparatus 5 further includes:
a fifth determining unit, configured to determine that focusing is finished when the pixel occupancy is greater than or equal to the preset occupancy threshold.
Optionally, the apparatus 5 further includes:
and the second processing unit is used for acquiring the preset focusing map through a camera and acquiring the focusing index.
It should be noted that, when executing the focusing method, the focusing apparatus 5 provided in the foregoing embodiment is only illustrated by dividing the functional modules, and in practical applications, the above function allocation may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the focusing device and the focusing method provided by the above embodiments belong to the same concept, and details of implementation processes are described in the method embodiments, which are not described herein again.
Fig. 6 is a schematic structural diagram of a focusing apparatus provided in an embodiment of the present application, which is hereinafter referred to as an apparatus 6 for short, where the apparatus 6 may be integrated in the foregoing server or terminal device, as shown in fig. 6, the apparatus includes: memory 602, processor 601, input device 603, output device 604, and a communication interface.
The memory 602 may be a separate physical unit, and may be connected to the processor 601, the input device 603, and the output device 604 via a bus. The memory 602, processor 601, input device 603, and output device 604 may also be integrated, implemented in hardware, etc.
The memory 602 is used for storing a program for implementing the above method embodiment, or various modules of the apparatus embodiment, and the processor 601 calls the program to execute the operations of the above method embodiment.
Input devices 602 include, but are not limited to, a keyboard, a mouse, a touch panel, a camera, and a microphone; the output device includes, but is not limited to, a display screen.
Communication interfaces are used to send and receive various types of messages and include, but are not limited to, wireless interfaces or wired interfaces.
Alternatively, when part or all of the distributed task scheduling method of the above embodiments is implemented by software, the apparatus may also include only a processor. The memory for storing the program is located outside the device and the processor is connected to the memory by means of circuits/wires for reading and executing the program stored in the memory.
The processor may be a Central Processing Unit (CPU), a Network Processor (NP), or a combination of a CPU and an NP.
The processor may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof. The PLD may be a Complex Programmable Logic Device (CPLD), a field-programmable gate array (FPGA), a General Array Logic (GAL), or any combination thereof.
The memory may include volatile memory (volatile memory), such as random-access memory (RAM); the memory may also include a non-volatile memory (non-volatile memory), such as a flash memory (flash memory), a Hard Disk Drive (HDD) or a solid-state drive (SSD); the memory may also comprise a combination of memories of the kind described above.
Wherein the processor 601 calls the program code in the memory 602 for performing the following steps:
determining the inner circle radius and the outer circle radius of a preset focusing graph based on the focusing index; the preset focusing graph is an annular focusing graph and comprises a black fan ring and a white fan ring;
determining a first pixel area of an outer circle based on the outer circle radius, and determining a second pixel area of an inner circle based on the inner circle radius;
determining a first total pixel quantity in the area of the first annular pixel, and calculating the pixel proportion of pixels with brightness values lower than a preset brightness threshold value in the first total pixel quantity; wherein the first annular pixel area is a difference value between the first pixel area and the second pixel area;
and when the pixel proportion is smaller than a preset proportion threshold, adjusting the outer circle radius and the inner circle radius until the pixel proportion is larger than or equal to the preset proportion threshold.
In one or more embodiments, processor 601 is further configured to:
determining a first total pixel quantity in the first circular pixel area and the number of pixels of which the brightness values are lower than a preset brightness threshold value in the first circular pixel area;
calculating the pixel fraction based on the number and the first total pixel amount.
In one or more embodiments, processor 601 is further configured to:
adjusting the outer circle radius and the inner circle radius;
determining a third pixel area of the outer circle based on the adjusted outer circle radius, and determining a fourth pixel area of the inner circle based on the adjusted inner circle radius;
determining a second total pixel quantity in the area of the second circular ring pixel, and calculating the pixel proportion of the pixel with the brightness value lower than a preset brightness threshold value in the second total pixel quantity; wherein the second annular pixel area is a difference between the third pixel area and the fourth pixel area;
and when the pixel occupation ratio is larger than or equal to the preset occupation ratio threshold, determining that focusing is finished.
In one or more embodiments, processor 601 is further configured to:
determining a radius adjustment value based on the pixel fraction in the first total pixel quantity;
turning down the outer circle radius based on the radius adjustment value, and turning down the inner circle radius based on the radius adjustment value; the ratio of the outer circle radius to the inner circle radius is a preset ratio.
In one or more embodiments, processor 601 is further configured to:
acquiring a focused image after focusing;
displaying the focus image through a display unit.
In one or more embodiments, processor 601 is further configured to:
and when the pixel occupation ratio is larger than or equal to the preset occupation ratio threshold, determining that focusing is finished.
In one or more embodiments, processor 601 is further configured to:
and acquiring the preset focusing map through a camera, and acquiring the focusing index.
It should be noted that, when the apparatus 6 provided in the foregoing embodiment executes the focusing method, only the division of the functional modules is illustrated, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the embodiments of the focusing method provided by the above embodiments belong to the same concept, and details of the implementation process are found in the embodiments of the method, which are not described herein again.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
Embodiments of the present application also provide a computer storage medium that may store a plurality of instructions adapted to be loaded by a processor and to perform the method steps as described above.
The application also provides a terminal, which comprises a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the above-mentioned method steps.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a read-only memory or a random access memory.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present application and is not to be construed as limiting the scope of the present application, so that the present application is not limited thereto, and all equivalent variations and modifications can be made to the present application.

Claims (10)

1. A method of focusing, the method comprising:
determining the inner circle radius and the outer circle radius of a preset focusing graph based on the focusing index; the preset focusing graph is an annular focusing graph and comprises a black fan ring and a white fan ring;
determining a first pixel area of an outer circle based on the outer circle radius, and determining a second pixel area of an inner circle based on the inner circle radius;
determining a first total pixel quantity in the area of a first annular pixel, and calculating the pixel proportion of a pixel with a brightness value lower than a preset brightness threshold value in the first total pixel quantity; wherein the first annular pixel area is a difference value between the first pixel area and the second pixel area;
and when the pixel proportion is smaller than a preset proportion threshold, adjusting the outer circle radius and the inner circle radius until the pixel proportion is larger than or equal to the preset proportion threshold.
2. The method of claim 1, wherein the determining a first total pixel amount in the first annular pixel area and calculating a pixel fraction of pixels with luminance values below a preset luminance threshold in the first total pixel amount comprises:
determining a first total pixel quantity in the first circular pixel area and the number of pixels of which the brightness values are lower than a preset brightness threshold value in the first circular pixel area;
calculating the pixel fraction based on the number and the first total pixel amount.
3. The method according to claim 1 or 2, wherein the adjusting the outer circle radius and the inner circle radius until the pixel fraction is greater than or equal to the preset fraction threshold comprises:
adjusting the outer circle radius and the inner circle radius;
determining a third pixel area of the outer circle based on the adjusted outer circle radius, and determining a fourth pixel area of the inner circle based on the adjusted inner circle radius;
determining a second total pixel quantity in the area of a second annular pixel, and calculating the pixel proportion of pixels with brightness values lower than a preset brightness threshold value in the second total pixel quantity; wherein the second annular pixel area is a difference between the third pixel area and the fourth pixel area;
and when the pixel occupation ratio is larger than or equal to the preset occupation ratio threshold, determining that focusing is finished.
4. The method of claim 3, wherein said adjusting said outer radius and said inner radius comprises:
determining a radius adjustment value based on the pixel fraction in the first total pixel quantity;
turning down the outer circle radius based on the radius adjustment value, and turning down the inner circle radius based on the radius adjustment value; the ratio of the outer circle radius to the inner circle radius is a preset ratio.
5. The method of claim 4, wherein after determining that focusing is complete, further comprising:
acquiring a focused image after focusing;
displaying the focus image through a display unit.
6. The method of claim 1 or 2, further comprising:
and when the pixel occupation ratio is larger than or equal to the preset occupation ratio threshold, determining that focusing is finished.
7. The method according to claim 1 or 2, wherein before determining the inner circle radius and the outer circle radius of the preset focusing map based on the focusing index, the method further comprises:
and acquiring the preset focusing map through a camera, and acquiring the focusing index.
8. A focusing apparatus, comprising:
the first determining module is used for determining the inner circle radius and the outer circle radius of a preset focusing map based on the focusing index; the preset focusing graph is an annular focusing graph and comprises a black fan ring and a white fan ring;
a second determining module for determining a first pixel area of the outer circle based on the outer circle radius and a second pixel area of the inner circle based on the inner circle radius;
the processing module is used for determining a first total pixel quantity in the area of the first annular pixel and calculating the pixel proportion of the pixel with the brightness value lower than a preset brightness threshold value in the first total pixel quantity; wherein the first annular pixel area is a difference value between the first pixel area and the second pixel area;
and the adjusting module is used for adjusting the outer circle radius and the inner circle radius when the pixel proportion is smaller than a preset proportion threshold value until the pixel proportion is larger than or equal to the preset proportion threshold value.
9. A computer storage medium, characterized in that it stores a plurality of instructions adapted to be loaded by a processor and to carry out the method steps according to any one of claims 1 to 7.
10. A terminal, comprising: a processor, a memory, and a display unit; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method steps of any of claims 1 to 7.
CN202010839188.4A 2020-08-19 2020-08-19 Focusing method and device, storage medium and terminal Active CN112040121B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010839188.4A CN112040121B (en) 2020-08-19 2020-08-19 Focusing method and device, storage medium and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010839188.4A CN112040121B (en) 2020-08-19 2020-08-19 Focusing method and device, storage medium and terminal

Publications (2)

Publication Number Publication Date
CN112040121A CN112040121A (en) 2020-12-04
CN112040121B true CN112040121B (en) 2021-08-13

Family

ID=73577645

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010839188.4A Active CN112040121B (en) 2020-08-19 2020-08-19 Focusing method and device, storage medium and terminal

Country Status (1)

Country Link
CN (1) CN112040121B (en)

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007133312A (en) * 2005-11-14 2007-05-31 Auto Network Gijutsu Kenkyusho:Kk Focus adjustment device and focus adjustment method for camera
CN202600357U (en) * 2011-12-01 2012-12-12 信利光电(汕尾)有限公司 Camera module focusing test system
JP5789725B2 (en) * 2012-11-22 2015-10-07 富士フイルム株式会社 Imaging apparatus, focusing method thereof and focusing control program
EP2957217A4 (en) * 2013-06-12 2017-03-01 Olympus Corporation Endoscope system
CN103702035B (en) * 2014-01-14 2017-01-04 昆山丘钛微电子科技有限公司 Photographic head module quickly regulating method based on FOV
CN105592308A (en) * 2014-10-21 2016-05-18 鸿富锦精密工业(深圳)有限公司 Test drawing, and method and system for detecting camera module by adopting test drawing
CN106603909B (en) * 2016-11-25 2019-06-28 努比亚技术有限公司 A kind of method and apparatus for realizing focusing
CN106961553A (en) * 2017-03-27 2017-07-18 广东欧珀移动通信有限公司 The focusing method of testing and system of mobile device, mobile device
CN107702695B (en) * 2017-09-26 2020-05-12 歌尔股份有限公司 Method for testing relative position of camera module lens and image sensor
CN110392254A (en) * 2019-07-25 2019-10-29 深圳市爱培科技术股份有限公司 A kind of focusing test method and terminal device based on image definition evaluation algorithm
CN111556311B (en) * 2020-04-07 2022-02-01 昆山丘钛微电子科技有限公司 Quality detection method and device for fixed-focus camera module and computer storage medium

Also Published As

Publication number Publication date
CN112040121A (en) 2020-12-04

Similar Documents

Publication Publication Date Title
US9451173B2 (en) Electronic device and control method of the same
JP6388673B2 (en) Mobile terminal and imaging method thereof
US20160094770A1 (en) Image Processing Method and Apparatus, and Terminal
CN109040523B (en) Artifact eliminating method and device, storage medium and terminal
CN106303157B (en) Video noise reduction processing method and video noise reduction processing device
CN110809101B (en) Image zooming processing method and device, electronic equipment and storage medium
CN109951635B (en) Photographing processing method and device, mobile terminal and storage medium
CN107690804B (en) Image processing method and user terminal
CN108702452A (en) A kind of image capturing method and device
JP2011508268A5 (en)
CN104486552A (en) Method and electronic device for obtaining images
CN108665510B (en) Rendering method and device of continuous shooting image, storage medium and terminal
CN111405185B (en) Zoom control method and device for camera, electronic equipment and storage medium
US20220329729A1 (en) Photographing method, storage medium and electronic device
CN110868533B (en) HDR mode determination method, device, storage medium and terminal
US11127141B2 (en) Image processing apparatus, image processing method, and a non-transitory computer readable storage medium
WO2022151852A1 (en) Image processing method, apparatus, and system, electronic device, and storage medium
CN108769538B (en) Automatic focusing method and device, storage medium and terminal
CN112351197B (en) Shooting parameter adjusting method and device, storage medium and electronic equipment
CN112040121B (en) Focusing method and device, storage medium and terminal
CN111970501A (en) Pure color scene AE color processing method and device, electronic equipment and storage medium
CN109672829B (en) Image brightness adjusting method and device, storage medium and terminal
CN111917986A (en) Image processing method, medium thereof, and electronic device
CN114339060A (en) Exposure adjusting method and device, storage medium and electronic equipment
CN108307114B (en) Image processing method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 330096 No.699 Tianxiang North Avenue, Nanchang hi tech Industrial Development Zone, Nanchang City, Jiangxi Province

Applicant after: Jiangxi oumaisi Microelectronics Co., Ltd

Address before: 330096 Jiangxi Nanchang Nanchang hi tech Industrial Development Zone, east of six road, south of Tianxiang Avenue.

Applicant before: Oufei Microelectronics Technology Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant