CN114513602A - Lens motor step length determining method, device, equipment and medium - Google Patents

Lens motor step length determining method, device, equipment and medium Download PDF

Info

Publication number
CN114513602A
CN114513602A CN202011286790.6A CN202011286790A CN114513602A CN 114513602 A CN114513602 A CN 114513602A CN 202011286790 A CN202011286790 A CN 202011286790A CN 114513602 A CN114513602 A CN 114513602A
Authority
CN
China
Prior art keywords
value
image
motor
determining
brightness
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
CN202011286790.6A
Other languages
Chinese (zh)
Other versions
CN114513602B (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.)
Zhejiang Uniview Technologies Co Ltd
Original Assignee
Zhejiang Uniview Technologies 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 Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN202011286790.6A priority Critical patent/CN114513602B/en
Publication of CN114513602A publication Critical patent/CN114513602A/en
Application granted granted Critical
Publication of CN114513602B publication Critical patent/CN114513602B/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/665Control of cameras or camera modules involving internal camera communication with the image sensor, e.g. synchronising or multiplexing SSIS control signals

Landscapes

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

Abstract

The embodiment of the invention discloses a method, a device, equipment and a medium for determining the step length of a lens motor. The method comprises the following steps: when the exposure value of the shooting picture is adjusted to be a normal exposure value based on the automatic exposure mode, determining a shutter speed and a gain value corresponding to the normal exposure value; shooting a plurality of frames of first images based on the shutter speed and the gain value corresponding to the normal exposure value; controlling a motor in the electric iris lens to move in a preset direction for a preset step length, and shooting a second image at the position where the motor moves; based on the first image and the second image, a motor step size is determined. The embodiment of the invention can automatically determine the step length of the lens motor based on the acquired image, has strong usability, does not need manual configuration, and reduces the labor cost, thereby providing conditions for controlling the size of the aperture and prolonging the service life of the lens.

Description

Lens motor step length determining method, device, equipment and medium
Technical Field
The embodiment of the invention relates to the technical field of electronic equipment, in particular to a method, a device, equipment and a medium for determining the step length of a lens motor.
Background
Currently, many types of electric iris lenses (p-iris) may be used in the same electronic device (e.g., camera or projector). The electric aperture lens automatically and accurately controls the size of an aperture by controlling a motor (a stepping motor) in the lens. The lens mainly aims to set the optimal aperture position so that most of the lens centers and the parts with the optimal effect can be used, the lens at the optimal aperture position has the optimal effect, the optical error is greatly reduced, the image quality is improved, and the lens is widely applied to the field of electronic equipment.
Due to different manufacturers and lens types, the step length definition of the motor in each electric aperture lens is different. For example, the motor step size definition in the electric iris lens with high accuracy is larger than that in the electric iris lens with low accuracy. Therefore, when the electronic equipment controls the installed electric diaphragm lens, control abnormity easily occurs due to step length mismatching. In order to reduce the control abnormality of the electric aperture lens, in the related art, a lens parameter configuration interface is provided for the electronic device, so that when the electronic device uses any type of electric aperture lens, a motor step length parameter in the lens can be manually set for the electronic device through the lens parameter configuration interface, and therefore the electronic device controls the aperture size of the electric aperture lens according to the configured motor step length parameter.
However, the motor step size parameter in the electric iris lens is configured manually, so that the usability is poor, and the difficulty in obtaining the motor step size parameter is high. Moreover, if the wrong step length parameter is obtained, the electronic device cannot reach the corresponding optimal position when the size of the aperture is controlled based on the wrong step length parameter, so that the quality of an image shot by the electronic device is poor, and even the number of moving steps exceeds the actual step length, the motor collides with the inner wall of the electric aperture lens, so that the service life of the electric aperture lens is shortened.
Disclosure of Invention
The embodiment of the invention provides a method, a device, equipment and a medium for determining the step length of a lens motor, which can automatically determine the step length of the lens motor based on an acquired image, have strong usability, do not need manual configuration, reduce the labor cost and provide conditions for controlling the size of an aperture and prolonging the service life of a lens.
In a first aspect, an embodiment of the present invention provides a method for determining a step size of a lens motor, where the method is performed by an electronic device having an electric aperture lens, and the method includes:
when the exposure value of a shooting picture is adjusted to be a normal exposure value based on an automatic exposure mode, determining a shutter speed and a gain value corresponding to the normal exposure value;
shooting a plurality of frames of first images based on the shutter speed and the gain value corresponding to the normal exposure value;
controlling a motor in the electric aperture lens to move for a preset step length along a preset direction, and shooting a second image at the position where the motor moves;
determining the motor step size based on the first image and the second image.
In a second aspect, an embodiment of the present invention provides a lens motor step length determining apparatus configured in an electronic device having an electric aperture lens, including:
the first determining module is used for determining the shutter speed and the gain value corresponding to the normal exposure value when the exposure value of the shooting picture is adjusted to be the normal exposure value based on the automatic exposure mode;
the shooting module is used for shooting a plurality of frames of first images based on the shutter speed and the gain value corresponding to the normal exposure value;
the control module is used for controlling a motor in the electric iris lens to move for a preset step length along a preset direction and shooting a second image at the position where the motor moves;
a second determination module to determine the motor step size based on the first image and the second image.
In a third aspect, an embodiment of the present invention further provides an electronic device, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the lens motor step size determination method according to any one of the embodiments of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for determining a step size of a lens motor according to any one of the embodiments of the present invention.
The technical scheme disclosed by the embodiment of the invention has the following beneficial effects:
when the exposure value of a shooting picture is adjusted to be a normal exposure value based on the automatic exposure mode, the shutter speed and the gain value corresponding to the normal exposure value are determined, a plurality of frames of first images are shot based on the shutter speed and the gain value corresponding to the normal exposure value, then a motor in the electric aperture lens is controlled to move along the preset direction for a preset step length, a second image is shot at the position where the motor moves, and the motor step length is determined based on the plurality of frames of first images and the second image. From this, realize the step length of camera lens motor based on the image automatic determination of gathering, not only the ease for use is strong, and need not artifical configuration, has reduced the cost of labor, can effectively avoid leading to the control camera lens light ring size can not reach the optimum position because of artifical configuration mistake, the condition of motor collision camera lens inner wall even to provide the condition for control light ring size and extension camera lens life.
Drawings
Fig. 1 is a schematic flowchart of a method for determining a step size of a lens motor according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of another method for determining a step size of a lens motor according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of another method for determining a step length of a lens motor according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a lens motor step length determining apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The embodiments of the present invention will be described in further detail with reference to the drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the embodiments of the invention and do not delimit the embodiments. It should be further noted that, for convenience of description, only some structures, not all structures, relating to the embodiments of the present invention are shown in the drawings.
A method, an apparatus, a device, and a medium for determining a step size of a lens motor according to an embodiment of the present invention are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flow chart of a method for determining a step size of a lens motor according to an embodiment of the present invention. The embodiment of the invention can be suitable for a scene of determining the motor step length of the electric iris lens on the electronic equipment, and the method can be executed by a lens motor step length determining device which can be realized by software and/or hardware and can be integrated in the electronic equipment. The method comprises the following steps:
s101, when the exposure value of the shooting picture is adjusted to be a normal exposure value based on the automatic exposure mode, determining a shutter speed and a gain value corresponding to the normal exposure value.
Specifically, before S101 is executed, it is necessary to manually fix the electronic device to a scene in which no drastic change occurs, then mount the electric iris lens on the electronic device, and open the iris after the electric iris lens is mounted, and perform normal focusing. And then, the electronic equipment determines whether the current photographing mode of the electronic equipment is the automatic exposure mode, if the current photographing mode is not the automatic exposure mode, the current photographing mode is adjusted to be the automatic exposure mode, automatic exposure is carried out on the current photographing picture based on the automatic exposure mode, so that the picture brightness of the photographing picture reaches normal brightness, namely the exposure value of the photographing picture is the normal exposure value.
And then, determining a shutter speed and a gain value corresponding to the normal exposure value, and locking the shutter speed and the gain value to lay a foundation for image shooting based on the determined shutter speed and gain value.
And S102, shooting a plurality of frames of first images based on the shutter speed and the gain value corresponding to the normal exposure value.
Optionally, after obtaining the shutter speed and the gain value corresponding to the normal exposure value of the captured picture, the electronic device may control the image sensor to capture the multiple frames of the first image based on the shutter speed and the gain value corresponding to the normal exposure value.
The multi-frame first image may be all images acquired within a preset time period, or all images acquired within 1 second, and is not limited herein. The preset time period may be set according to actual application requirements, and is not specifically limited herein. For example, the preset time period may be set to 3 seconds or 5 seconds, etc.
For another example, if the image sensor in the electronic device can continuously acquire 25 frames of images in 1 second, the 25 frames of images acquired in 1 second can be used as the first image.
S103, controlling a motor in the electric iris lens to move in a preset direction for a preset step length, and shooting a second image at the position where the motor moves.
Wherein, preset the direction and include: a first direction and a second direction. In the embodiment of the present invention, the first direction may be a direction for enlarging an aperture in the electric iris lens, and the second direction may be a direction for reducing the aperture in the electric iris lens; alternatively, the first direction may be a direction to zoom out the aperture in the electric iris lens, and the second direction may be a direction to zoom in the aperture in the electric iris lens, which is not limited herein.
The preset step length can be a redundant step length which can move after the motor in the electric aperture lens moves the maximum step length along the first direction or the second direction. The redundant step length can be determined according to the manufacturer or the type of the electric aperture lens, and generally different manufacturers or types can meet 50 steps, so that the preset step length can be set to 50 steps or set to other steps optionally in the embodiment.
Optionally, the motor in the electric iris lens is controlled to move in the first direction or the second direction by a preset step length respectively, so that the motor changes from the initial position to the position where the motor is located after moving. Then, the electronic device controls the position of the image sensor after the motor moves to acquire one frame of image (second image) so as to lay a foundation for subsequently determining the motor step length.
And S104, determining the motor step length based on the first image and the second image.
After obtaining multiple frames of the first image and the second image, the embodiment may process each frame of the first image and the second image respectively to obtain the image parameters of each frame of the first image and the second image. Such as selectable image brightness values, image sharpness values, image brightness thresholds, image sharpness thresholds, etc. Then, the electronic device can determine the motor step length in the currently installed electric iris lens based on the obtained image parameters.
According to the technical scheme provided by the embodiment of the invention, when the exposure value of the shot picture is adjusted to be the normal exposure value based on the automatic exposure mode, the shutter speed and the gain value corresponding to the normal exposure value are determined, the multi-frame first image is shot based on the shutter speed and the gain value corresponding to the normal exposure value, then the motor in the electric aperture lens is controlled to move along the preset direction for the preset step length, the second image is shot at the position where the motor moves, and the motor step length is determined based on the multi-frame first image and the multi-frame second image. From this, realize the step length of camera lens motor based on the image automatic determination of gathering, not only the ease for use is strong, and need not artifical configuration, has reduced the cost of labor, can effectively avoid leading to the control camera lens light ring size can not reach the optimum position because of artifical configuration mistake, the condition of motor collision camera lens inner wall even to provide the condition for control light ring size and extension camera lens life.
As can be seen from the above description, the embodiment of the present invention determines the motor step size in the electric iris lens based on the first image and the second image of the plurality of frames taken. Next, with reference to fig. 2, on the basis of the above embodiment, the method for determining the step length of the lens motor provided in the embodiment of the present invention is further optimized. As shown in fig. 2, the method specifically includes:
s201, when the exposure value of the shooting picture is adjusted to be a normal exposure value based on the automatic exposure mode, determining a shutter speed and a gain value corresponding to the normal exposure value.
S202, shooting a plurality of frames of first images based on the shutter speed and the gain value corresponding to the normal exposure value.
S203, determining the brightness value and the definition value of the first image of each frame.
Alternatively, the present embodiment may determine the brightness value and the sharpness value of the first image of each frame in different manners. As an optional implementation manner, in this embodiment, the brightness value of each frame of the first image is determined, and it may be determined whether the color format of each frame of the first image is the preset color format; if the color format of the first image is a preset color format, determining the brightness value of the first image of each frame based on the preset color format; and if the color format of the first image is not the preset color format, converting the color format of the first image into the preset color format. Then, based on the converted preset color format, a brightness value of the first image of each frame is determined.
The preset color format is a YUV format or an HSL format.
For example, if it is determined that the color format of the first image is the RGB format, the RGB format of the first image may be converted into the YUV format, or the RGB format of the first image may be converted into the HSL format. The specific process of converting the RGB format into the YUV format or the HSL format refers to the existing scheme, and is not described herein in any greater detail.
Furthermore, the electronic device can determine the brightness value of the first image of each frame based on the YUV format or the HSL format. The method specifically comprises the following steps: if the preset color format is YUV format, determining Y (brightness) component and value in each frame of first image, and determining the Y component and value as brightness value of each frame of first image; if the preset color format is the HSL format, an L (luminance) component sum value in the first image per frame is determined, and the L component sum value is determined as a luminance value of the first image per frame.
Generally, as the image frame is clearer, the frame boundary is more obvious, and the corresponding gradient value is larger, so the embodiment may determine the sharpness value of each frame of the first image by determining the boundary pixels belonging to the boundary in each frame of the first image and based on the sum of the gradient values of all the boundary pixels. Specifically, each frame of the first image may be converted from a color image to a grayscale image, then a gradient value of each pixel in each frame of the first image is determined based on a preset gradient operator, then a pixel belonging to a boundary pixel in each frame of the first image is determined according to the gradient value of each pixel, and a gradient sum value of all edge pixels in each frame of the first image is determined, so as to determine the gradient sum value as a sharpness value of each frame of the first image.
Wherein, the conversion of the color image into the gray-scale image can be realized by various ways. For example, an optional weighting method, averaging method, or maximum method, etc.
Specifically, the present embodiment determines pixels belonging to the boundary pixel in each frame of the first image, compares the gradient value of each pixel with the gradient threshold, and determines which pixels belong to the boundary pixel according to the comparison result. If the gradient value of any pixel is larger than the gradient threshold value, determining the pixel as a boundary pixel; if the gradient value of any pixel is less than or equal to the gradient threshold, the pixel is determined not to be a boundary pixel. The gradient threshold is an empirical value, and can be flexibly set, and is not limited herein.
In this embodiment, the preset gradient operator may be selected as a Sobel gradient operator. Therefore, in the embodiment, when the gradient value of each pixel in each frame of the first image is determined based on the preset gradient operator, the gradient between each pixel and the adjacent pixel can be calculated through Sobel gradient operators in four directions, and whether the pixel is a boundary pixel is determined according to the gradient. If yes, determining the sum of the gradient values of all the boundary pixels as a definition value.
Determining a gradient value of each pixel in each frame of the first image based on a preset gradient operator, which can be specifically realized by the following formula (1) -formula (5):
Figure BDA0002782640450000061
gradient operator of 0 °:
Figure BDA0002782640450000062
gradient operator of 45 °:
Figure BDA0002782640450000063
gradient operator of 90 °:
Figure BDA0002782640450000064
gradient operator of 135 °:
Figure BDA0002782640450000065
wherein the content of the first and second substances,
Figure BDA0002782640450000066
for the gradient value of the ith pixel in the first image, g, per frame00、g450、g900And g1350Sobel gradient operator for four directions, f (x)i,yi) For the ith pixel in the first image per frame.
And S204, determining a brightness threshold value and a brightness mean value based on the brightness values of the multiple frames of first images.
Optionally, after the luminance value of each frame of the first image is determined, a maximum luminance value and a minimum luminance value may be selected from the luminance values of the plurality of frames of the first image. Then, the maximum luminance value and the minimum luminance value are subtracted, and the difference is determined as a luminance threshold value. Moreover, the embodiment may further calculate an arithmetic mean value based on all the first image brightness values, and use the arithmetic mean value as the brightness mean value.
For example, if the number of frames of the first image is n frames, then the luminance value of the n frames of the first image may be: y1, Y2, … and Yn. If the luminance value Y5 of the 5 th frame in the n-frame first image is maximum and the luminance value Ym of the m-th frame is minimum, then based on Y5 and Ym, the luminance threshold is calculated as: y isTY5-Ym. Meanwhile, calculating the mean value of the brightness to be Y based on the brightness values corresponding to the first images of the n framesc0
S205, determining a definition threshold value and a definition average value based on the definition values of the first images of the plurality of frames.
Optionally, after the sharpness value of each frame of the first image is determined, a maximum sharpness value and a minimum sharpness value may be selected from the sharpness values of the multiple frames of the first image. Then, the maximum sharpness value and the minimum sharpness value are subtracted, and the difference is determined as a sharpness threshold. Moreover, the embodiment may further calculate an arithmetic mean value based on the sharpness values of all the first images, and use the arithmetic mean value as the sharpness mean value.
For example, if the number of frames of the first image is n frames, then the sharpness value of the n frames of the first image may be: q1, Q2, …, Qn. If the 7 th frame in the n-frame first image has the largest sharpness value Q7 and the 15 th frame has the smallest sharpness value Q15, then based on Q7 and Q15, the sharpness threshold is calculated as: qTQ7-Q15. Meanwhile, the definition threshold value Q can be calculated based on the definition values corresponding to the n frames of the first imagec0
It should be noted that, the execution sequence of the steps S204 and S205 may be that S204 is executed first, and then S205 is executed; or, S205 may be executed first, and then S204 may be executed; alternatively, S204 and S205 may be executed simultaneously, which is not limited in this embodiment.
And S206, controlling a motor in the electric iris lens to move by a preset step length along a preset direction, and shooting a second image at the position where the motor moves.
Since the preset direction includes the first direction and the second direction, controlling the motor in the electric iris lens to move a preset step length along the preset direction may include: and controlling the motor to move a preset step length along the first direction, or controlling the motor to move the preset step length along the second direction. The sequence of controlling the motor to move along the first direction or the second direction by the preset step length is not limited, and the motor can be controlled to move along the first direction first and then move along the second direction; or the motor is controlled to move along the second direction firstly, and then the motor is controlled to move along the first direction.
Furthermore, after the motor is controlled to move in the preset direction by the preset step length, the electronic equipment can also shoot a second image at the position where the motor moves. Wherein the second image may be captured based on the shutter speed and gain value corresponding to the normal exposure value determined in the foregoing embodiment. Specifically, the step of taking the second image at the position where the motor moves includes: if the position of the motor is a first position after the motor moves along the first direction by a preset step length, shooting a second image at the first position based on the shutter speed and the gain value corresponding to the normal exposure value; and if the position of the motor after the motor moves along the second direction by the preset step length is the second position, shooting a second image at the second position based on the shutter speed and the gain value corresponding to the normal exposure value.
S207, determining the brightness value and the definition value of the second image.
The implementation principle of determining the brightness value and the sharpness value of the second image in S207 is the same as that of determining the brightness value and the sharpness value of the first image in S203, and the specific determination process refers to the aforementioned part of S203, which is not described in detail herein.
And S208, determining the motor step length based on the brightness value and the definition value of the second image and the brightness threshold value, the brightness mean value, the definition threshold value and the definition mean value corresponding to the first image.
Optionally, after obtaining image parameters of the second image, such as the selectable brightness value and the sharpness value, and image parameters of the multiple frames of the first image, such as the selectable brightness threshold, the brightness mean value, the sharpness threshold, and the sharpness mean value, the electronic device may determine the motor step length according to a preset calculation mode based on the several image parameters. Therefore, the motor is controlled to move based on the determined motor step length subsequently, the size of the diaphragm in the electric diaphragm lens is controlled to reach the optimal position, and conditions are provided for improving the image quality. And when the motor is controlled to move based on the determined motor step length, the condition that the motor collides with the inner wall of the lens can be avoided, so that the service life of the electric aperture lens is prolonged.
According to the technical scheme provided by the embodiment of the invention, when the exposure value of the shot picture is adjusted to be the normal exposure value based on the automatic exposure mode, the shutter speed and the gain value corresponding to the normal exposure value are determined, the multi-frame first image is shot based on the shutter speed and the gain value corresponding to the normal exposure value, then the motor in the electric aperture lens is controlled to move along the preset direction for the preset step length, the second image is shot at the position where the motor moves, and the motor step length is determined based on the multi-frame first image and the multi-frame second image. From this, realize the step length of camera lens motor based on the image automatic determination of gathering, not only the ease for use is strong, and need not artifical configuration, has reduced the cost of labor, can effectively avoid leading to the control camera lens light ring size can not reach the optimum position because of artifical configuration mistake, the condition of motor collision camera lens inner wall even to provide the condition for control light ring size and extension camera lens life.
Fig. 3 is a schematic flowchart of another method for determining a lens motor step according to an embodiment of the present invention. On the basis of the above embodiment, further explanation is made on determining the motor step length based on the brightness value and the definition value of the second image, and the brightness threshold value, the brightness mean value, the definition threshold value, and the definition mean value corresponding to the first image. As shown in fig. 3, the method is as follows:
s301, when the exposure value of the shooting picture is adjusted to be a normal exposure value based on the automatic exposure mode, determining a shutter speed and a gain value corresponding to the normal exposure value.
S302, shooting a plurality of frames of first images based on the shutter speed and the gain value corresponding to the normal exposure value.
And S303, controlling a motor in the electric iris lens to move in a preset direction for a preset step length, and shooting a second image at the position where the motor moves.
S304, determining a first difference absolute value of the brightness value of the second image and the brightness mean value, and a second difference absolute value of the definition value of the second image and the definition mean value.
S305, determining a first sum of the first difference absolute value and the second difference absolute value.
For example, if the brightness value of the second image is Yc1Resolution value of Qc1Then based on the luminance mean value YcoAnd a brightness value Yc1The first absolute difference can be calculated as: | Yco-Yc1L. And, based on the sharpness mean QcoAnd a brightness value Qc1The second absolute difference value can be calculated as: | Qco-Qc1L. Then, summing the first difference absolute value and the second difference absolute value to obtain a first sum value: | Yco-Yc1|+|Qco-Qc1|。
S306, determining the motor step length based on the first sum value and the second sum value of the brightness threshold value and the definition threshold value.
Continuing with the above example, assume that the luminance threshold is YTWith a resolution threshold of QTThen based on the sum of the luminance threshold and the sharpness threshold calculated as: y isT+QT. Further, the first sum | Yco-Yc1|+|Qco-Qc1| and a second sum Y of the luminance threshold and the sharpness thresholdT+QTComparing to determine | Yco-Yc1|+|Qco-Qc1|≤YT+QTIs also | Yco-Yc1|+|Qco-Qc1|>YT+QT. And then determining the motor step length in different modes according to the comparison result.
Specifically, the step length of the motor is determined in different ways according to the comparison result, which may include the following situations:
situation one
And if the first sum value is less than or equal to the second sum value, determining the preset step length as a target step length of the motor along the preset direction, and determining the sum value of the target step length as the motor step length.
It should be noted that, because the motor in the electric iris lens can move along the first direction and the second direction respectively, when the motor moves the preset step length in the first direction first and then the first difference absolute value of the brightness value and the brightness mean value of the second image at the first position and the sum of the definition value and the second difference absolute value of the definition mean value of the second image are less than or equal to the second sum value, it indicates that the target step length of the motor in the first direction is the preset step length.
Furthermore, the electronic device may further control the motor to move from the first position to the second direction to the initial position (the starting point of starting moving, i.e., the initial position of the aperture), and then control the motor to move from the initial position to the second position along the second direction by a preset step length, when a sum of a first absolute difference value between a luminance value and a luminance average value of the second image at the second position and a second absolute difference value between a sharpness value and a sharpness average value of the second image is less than or equal to the second sum value, it indicates that the target step length of the motor in the second direction is also the preset step length. Further, the electronic device may sum the target step size of the motor in the first direction and the target step size in the second direction, and take the sum as a final step size of the motor, i.e., a motor step size.
For example, if the preset step size is 50, the sum of the target step size in the first direction and the target step size in the second direction of the motor is: 50+50 is 100, i.e. the motor step size is 100.
Situation two
And if the first sum is larger than the second sum, controlling the motor to move a preset step length along the preset direction by taking the position where the motor is located after moving as a starting point, determining the brightness value and the definition value of a third image shot at the target position where the motor is located after moving, and determining the motor step length based on the brightness value and the definition value of the third image and the brightness threshold value, the brightness mean value, the definition threshold value and the definition mean value corresponding to the first image.
When the first sum is larger than the second sum, the motor does not reach the target step length in the first direction or the second direction after moving along the first direction or the second direction. At this time, the electronic device may further continue to control the motor to continue to move by a preset step length in the first direction with the first position as a starting point, or control the motor to continue to move by a preset step length in the second direction with the second position as a starting point. And determining the motor step length according to the brightness value and the definition value of a third image shot at a third position reached by the movement and the brightness threshold value, the brightness mean value, the definition threshold value and the definition mean value corresponding to the first image.
Specific implementations may include multiple implementations, with different implementations being described in detail below.
For the first implementation, the following steps may be included:
s11, if the preset direction is a first direction, when the brightness value of the third image is less than or equal to a first threshold, and the sum of the absolute difference between the brightness value and the brightness mean value and the absolute difference between the sharpness value and the sharpness mean value is less than or equal to a second sum, determining the sum of all preset step lengths in the first direction as the first step length of the motor.
In this embodiment, the motor is controlled to move by the preset step length along the first direction with the position where the motor is located after moving as a starting point, specifically, the motor is controlled to continue to move by the preset step length along the first direction with the first position where the motor is located after moving as a starting point.
The first threshold is a judgment index for determining whether the image shot after the motor is controlled to move continuously along the first direction by the preset step length will have an overexposure condition based on the brightness value of the third image. In this embodiment, the first threshold value may be determined based on the image resolution, the image maximum luminance value, and the index parameter of the image captured at the position where the motor is moved.
For example, the optional first threshold may be: image resolution 255% 80%. Wherein 255 is the maximum brightness value of the image, and 80% is the index parameter. It should be noted that the index parameter may be adjusted according to actual needs, and is not limited herein.
That is, when the electronic device controls the motor to move by a preset step length along the first direction, and then the sum of the first absolute difference value between the brightness value and the brightness mean value of the second image shot at the first position and the second absolute difference value between the definition value and the definition mean value of the second image is greater than the second sum value, it indicates that the motor has not reached the target step length in the first direction. At this time, the electronic device may further control the motor to continue moving by a preset step length along the first direction to reach a third position with the first position as a starting point, and shoot and determine a brightness value and a sharpness value of the third image at the third position. And then, determining whether the brightness value of the third image is smaller than a first threshold value, whether the absolute value of the difference between the brightness value and the brightness mean value and the sum of the absolute value of the difference between the definition value and the definition mean value are smaller than or equal to a second sum value, and if so, indicating that the first step length of the motor in the first direction is two preset step lengths.
And S12, if the preset direction is a second direction, when the sum of the absolute difference value between the brightness value of the third image and the brightness mean value and the absolute difference value between the sharpness value and the sharpness mean value is less than or equal to the second sum, determining the sum of all preset step lengths in the second direction as a second step length of the motor.
Specifically, when the electronic device controls the motor to move in the second direction by the preset step length, the sum of the first absolute difference value between the brightness value and the brightness mean value of the second image at the second position and the second absolute difference value between the sharpness value and the sharpness mean value of the second image is greater than the second sum value, it is determined that the motor has not reached the target step length in the second direction. At this time, the electronic device may further control the motor to continue moving by a preset step length along the second direction to reach a third position with the second position as a starting point, and shoot and determine a brightness value and a sharpness value of the third image at the third position. And then, determining whether the difference absolute value of the brightness value and the brightness mean value of the third image and the sum of the difference absolute values of the definition value and the definition mean value are less than or equal to a second sum value, if so, indicating that the second step length of the motor in the second direction is two preset step lengths.
In another implementation scenario, after the electronic device determines the first step length of the motor in the first direction, the embodiment may further control the motor to move from a third position located in the first direction to the initial position (a starting point of starting movement, i.e., an initial position of the aperture) in the second direction, and then control the motor to move from the initial position to the second position by a preset step length in the second direction, where when a sum of a first absolute difference value between a brightness value and a brightness mean value of the second image captured at the second position and a second absolute difference value between a sharpness value and a sharpness mean value of the second image is greater than a second sum value, it is determined that the motor has not reached the target step length in the second direction. At this time, the electronic device may further control the motor to continue moving by a preset step length along the second direction to reach a fourth position with the second position as a starting point, and shoot and determine the brightness value and the definition value of the third image at the fourth position. Then, it is determined whether the sum of the absolute difference between the luminance value and the luminance mean value of the third image and the absolute difference between the sharpness value and the sharpness mean value is less than or equal to the second sum. If yes, the second step length of the motor in the second direction is two preset step lengths.
S13, determining the motor step size based on the first step size and the second step size.
Alternatively, after obtaining a first step length of the motor in the first direction and a second step length in the second direction, the electronic device may sum the first step length and the second step length, and use the sum as a final step length of the motor, i.e., a motor step length.
For example, if the preset step size is 50, the sum of the target step size in the first direction and the target step size in the second direction of the motor is: 2 × 50+2 × 50 ═ 200, i.e., the motor steps are 200.
For the second implementation, the following steps may be included:
and S21, if the preset direction is a first direction, when the brightness value of the third image is larger than the first threshold value, reducing the shutter speed and the gain value, shooting a plurality of frames of fourth images based on the reduced shutter speed and gain value, shooting a fifth image at the position where the motor moves along the first direction, and determining the first step length of the motor based on the fourth image and the fifth image.
When the shutter speed and the gain value are reduced, the shutter speed and the gain value may be reduced to 20% or other values according to actual needs, which is not limited herein.
Specifically, when the electronic device controls the motor to move in the first direction by a preset step length, a sum of a first absolute difference value between a brightness value and a brightness mean value of a second image at a first position and a second absolute difference value between a definition value and a definition mean value of the second image is greater than a second sum value, it is determined that the motor has not reached the target step length in the first direction. At this time, the electronic device may further control the motor to continue moving by a preset step length along the first direction to reach a third position with the first position as a starting point, and shoot and determine a brightness value and a sharpness value of the third image at the third position. Then, it is determined whether the luminance value of the third image is less than the first threshold value, and whether the sum of the absolute value of the difference between the luminance value and the luminance mean value and the absolute value of the difference between the sharpness value and the sharpness mean value is less than or equal to the second sum value. If the brightness value of the third image is larger than the first threshold value, it indicates that the image shot after the motor is controlled to continuously move along the first direction by the preset step length has an overexposure condition, and indicates that the shutter speed and the gain value which are initially determined are too high, and at this time, the shutter speed and the gain value can be subjected to reduction processing. Then, multiple frames of fourth images are shot based on the reduced shutter speed and the reduced gain value, the motor is controlled to move along the first direction by a preset step length, a fifth image is shot at the position where the motor moves, and the motor step length is determined based on the multiple frames of fourth images and the fifth image.
S22, if the preset direction is the first direction, when the brightness value of the third image is less than or equal to the first threshold, the absolute value of the difference between the brightness value and the brightness mean value, when the sum of the absolute values of the differences from the sharpness value and the sharpness mean is greater than the second sum, controlling the motor to move by a preset step length along the first direction by taking the moved target position as a starting point until the brightness value of a sixth image shot at a new target position after the motor moves is less than or equal to the first threshold value and the absolute value of the difference between the brightness value of the sixth image and the brightness mean value, until the sum of the absolute values of the differences between the definition of the sixth image and the definition mean is less than or equal to the second sum, and determining the sum of all preset steps in the first direction as the first step of the motor.
The implementation principle of S22 is similar to that of the first implementation manner, and reference is specifically made to the first implementation manner, which is not described herein in detail.
Note that, the relationship between S21 and S22 is "or". Specifically, S21 may be performed; alternatively, S22 is executed.
S23, if the preset direction is a second direction, when the sum of the absolute difference between the brightness value of the third image and the brightness mean value and the absolute difference between the sharpness value and the sharpness mean value is greater than the second sum, controlling the motor to move a preset step length along the second direction with the moved target position as a starting point until the sum of the absolute difference between the brightness value of the seventh image captured at the new target position after the motor moves and the brightness mean value and the absolute difference between the sharpness and the sharpness mean value of the seventh image is less than or equal to the second sum, and determining the sum of all preset step lengths in the second direction as the second step length of the motor.
Specifically, when the electronic device controls the motor to move in the second direction by the preset step length, the sum of the first absolute difference value between the brightness value and the brightness mean value of the second image at the second position and the second absolute difference value between the sharpness value and the sharpness mean value of the second image is greater than the second sum value, it is determined that the motor has not reached the target step length in the second direction. At this time, the electronic device may further control the motor to continue moving by a preset step length along the second direction to reach a third position with the second position as a starting point, and shoot and determine a brightness value and a sharpness value of the third image at the third position. And then, determining whether the difference absolute value of the brightness value and the brightness mean value of the third image and the sum of the difference absolute value of the definition value and the definition mean value are less than or equal to a second sum value, if not, indicating that the motor can be controlled to move in the second direction.
In another implementation scenario, after the electronic device determines the first step length of the motor in the first direction, the embodiment may further control the motor to move from the position located in the first direction to the second direction to the initial position (the starting point of starting the movement, i.e., the initial position of the aperture), and then control the motor to move from the initial position to the second position by the preset step length in the second direction, and when the sum of the first absolute difference value between the brightness value and the brightness mean value of the second image captured at the second position and the second absolute difference value between the sharpness value and the sharpness mean value of the second image is greater than the second sum value, it is determined that the motor has not reached the target step length in the second direction. And when the electronic device controls the motor to continuously move a preset step length along the second direction to reach the third position by taking the second position as a starting point, and when the sum of the absolute value of the difference between the brightness value and the brightness mean value of the third image shot at the third position and the absolute value of the difference between the definition value and the definition mean value is greater than the second sum, the electronic device can also control the motor to continuously move a preset step length along the second direction to reach the fourth position by taking the third position as a starting point. Then, it is determined whether the sum of the absolute value of the difference between the luminance value and the luminance average value of the seventh image photographed at the fourth position and the absolute value of the difference between the sharpness and the sharpness average value of the seventh image is less than the second sum. If yes, the second step length of the motor in the second direction is the sum of the moving times multiplied by the preset step length.
S24, determining the motor step size based on the first step size and the second step size.
According to the technical scheme provided by the embodiment of the invention, when the exposure value of the shot picture is adjusted to be the normal exposure value based on the automatic exposure mode, the shutter speed and the gain value corresponding to the normal exposure value are determined, so that a plurality of frames of first images are shot based on the shutter speed and the gain value corresponding to the normal exposure value, then the motor in the electric aperture lens is controlled to move along the preset direction for the preset step length, the second image is shot at the position where the motor moves, and the motor step length is determined based on the plurality of frames of the first images and the second images. From this, realize the step length of camera lens motor based on the image automatic determination of gathering, not only the ease for use is strong, and need not artifical configuration, has reduced the cost of labor, can effectively avoid leading to the control camera lens light ring size can not reach the optimum position because of artifical configuration mistake, the condition of motor collision camera lens inner wall even to provide the condition for control light ring size and extension camera lens life.
Fig. 4 is a schematic structural diagram of a lens motor step length determining apparatus according to an embodiment of the present invention. The lens motor step length determining device can be realized in a hardware and/or software mode and is configured in the electronic equipment. As shown in fig. 4, the apparatus 400 for determining a step size of a lens motor according to an embodiment of the present invention includes: a first determination module 410, a photographing module 420, a control module 430, and a second determination module 440.
The first determining module 410 is configured to determine a shutter speed and a gain value corresponding to a normal exposure value when the exposure value of a shooting picture is adjusted to be the normal exposure value based on an automatic exposure mode;
a shooting module 420, configured to shoot multiple frames of first images based on the shutter speed and the gain value corresponding to the normal exposure value;
the control module 430 is used for controlling a motor in the electric iris lens to move by a preset step length along a preset direction and shooting a second image at the position where the motor moves;
a second determining module 440 for determining the motor step size based on the first image and the second image.
As an optional implementation manner of the embodiment of the present invention, the apparatus 400 further includes: a third determination module, a fourth determination module and a fifth determination module;
the third determining module is used for determining the brightness value and the definition value of each frame of the first image;
the fourth determining module is used for determining a brightness threshold value and a brightness mean value based on the brightness values of the plurality of frames of the first images;
and the fifth determining module is used for determining a definition threshold value and a definition mean value based on the definition values of the plurality of frames of the first image.
As an optional implementation manner of the embodiment of the present invention, the preset direction includes: a first direction and a second direction; the control module 430 is specifically configured to:
controlling the motor to move a preset step length along a first direction, or controlling the motor to move the preset step length along a second direction;
accordingly, the control module 430 is further configured to:
if the position of the motor is a first position after the motor moves along a first direction by a preset step length, shooting a second image at the first position;
and if the motor moves in the second direction by the preset step length and then is located at a second position, shooting a second image at the second position.
As an optional implementation manner of the embodiment of the present invention, the apparatus 400 further includes: a sixth determining module;
the sixth determining module is configured to determine a brightness value and a sharpness value of the second image.
As an optional implementation manner of the embodiment of the present invention, the second determining module 440 is specifically configured to:
and determining the motor step length based on the brightness value and the definition value of the second image and the brightness threshold value, the brightness mean value, the definition threshold value and the definition mean value corresponding to the first image.
As an optional implementation manner of the embodiment of the present invention, the second determining module 440 is further configured to:
determining a first difference absolute value of the brightness value of the second image and the brightness mean value and a second difference absolute value of the definition value of the second image and the definition mean value;
determining a first sum of the first difference absolute value and the second difference absolute value;
determining the motor step size based on the first sum and a second sum of the brightness threshold and the sharpness threshold.
As an optional implementation manner of the embodiment of the present invention, the second determining module 440 is further configured to:
if the first sum is smaller than or equal to the second sum, determining the preset step as a target step of the motor along a preset direction, and determining the sum of the target steps as the motor step;
and if the first sum is larger than the second sum, controlling the motor to move a preset step length along the preset direction by taking the position where the motor is located after moving as a starting point, determining the brightness value and the definition value of a third image shot at the target position where the motor is located after moving, and determining the motor step length based on the brightness value and the definition value of the third image and the brightness threshold value, the brightness mean value, the definition threshold value and the definition mean value corresponding to the first image.
As an optional implementation manner of the embodiment of the present invention, the second determining module 440 is further configured to:
if the preset direction is a first direction, determining the sum of all preset step lengths in the first direction as a first step length of the motor when the brightness value of the third image is less than or equal to a first threshold value, and the sum of the absolute value of the difference between the brightness value and the brightness mean value and the absolute value of the difference between the definition value and the definition mean value is less than or equal to a second sum value;
if the preset direction is a second direction, determining the sum of all preset step lengths in the second direction as a second step length of the motor when the sum of the absolute difference value between the brightness value of the third image and the brightness mean value and the absolute difference value between the definition value and the definition mean value is less than or equal to the second sum value;
determining the motor step size based on the first step size and the second step size.
As an optional implementation manner of the embodiment of the present invention, the second determining module 440 is further configured to:
if the preset direction is a first direction, when the brightness value of the third image is larger than the first threshold value, reducing the shutter speed and the gain value, shooting a plurality of frames of fourth images based on the reduced shutter speed and the reduced gain value, shooting a fifth image at the position where the motor moves along the first direction, and determining a first step length of the motor based on the fourth image and the fifth image; alternatively, the first and second electrodes may be,
if the preset direction is a first direction, when the brightness value of the third image is less than or equal to the first threshold, the absolute value of the difference between the brightness value and the brightness mean value, when the sum of the absolute values of the differences from the sharpness value and the sharpness mean is greater than the second sum, controlling the motor to move by a preset step length along the first direction by taking the moved target position as a starting point until the brightness value of a sixth image shot at a new target position after the motor moves is less than or equal to the first threshold value and the absolute value of the difference between the brightness value of the sixth image and the brightness mean value, until the sum of the absolute values of the differences between the definition of the sixth image and the definition mean is less than or equal to the second sum, determining the sum of all preset step lengths in the first direction as a first step length of the motor;
if the preset direction is a second direction, when the absolute value of the difference between the brightness value of the third image and the average brightness value and the sum of the absolute value of the difference between the definition value and the average definition value are greater than the second sum, controlling the motor to move a preset step length along the second direction by taking the moved target position as a starting point until the absolute value of the difference between the brightness value of a seventh image shot at a new target position after the motor moves and the absolute value of the difference between the definition of the seventh image and the average definition value are less than or equal to the second sum, and determining the sum of all preset step lengths in the second direction as the second step length of the motor;
determining the motor step size based on the first step size and the second step size.
As an optional implementation manner of the embodiment of the present invention, the third determining module is specifically configured to:
converting the color format of the image into a preset color format;
determining a brightness value of the image based on the preset color format.
As an optional implementation manner of the embodiment of the present invention, the preset color format is a YUV format or an HSL format;
the third determining module is further configured to:
if the preset color format is a YUV format, determining a Y component and a value in the image, and determining the Y component and the value as the brightness value of the image;
and if the preset color format is the HSL format, determining an L component sum value in the image, and determining the L component sum value as the brightness value of the image.
As an optional implementation manner of the embodiment of the present invention, the third determining module is specifically configured to: converting the image into a gray scale image, and determining the gradient value of each pixel in the image based on a preset gradient operator;
determining pixels belonging to boundary pixels in the image according to the gradient values;
determining gradients and values of all edge pixels, and determining the gradients and values as a sharpness value of the image.
It should be noted that the foregoing explanation of the embodiment of the method for determining the lens motor step size is also applicable to the apparatus for determining the lens motor step size of this embodiment, and the implementation principle is similar, and is not repeated here.
According to the technical scheme provided by the embodiment of the invention, when the exposure value of the shot picture is adjusted to be the normal exposure value based on the automatic exposure mode, the shutter speed and the gain value corresponding to the normal exposure value are determined, the multi-frame first image is shot based on the shutter speed and the gain value corresponding to the normal exposure value, then the motor in the electric aperture lens is controlled to move along the preset direction for the preset step length, the second image is shot at the position where the motor moves, and the motor step length is determined based on the multi-frame first image and the multi-frame second image. From this, realize the step length of camera lens motor based on the image automatic determination of gathering, not only the ease for use is strong, and need not artifical configuration, has reduced the cost of labor, can effectively avoid leading to the control camera lens light ring size can not reach the optimum position because of artifical configuration mistake, the condition of motor collision camera lens inner wall even to provide the condition for control light ring size and extension camera lens life.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. Fig. 5 illustrates a block diagram of an exemplary electronic device 500 suitable for use in implementing embodiments of the present invention. The electronic device 500 shown in fig. 5 is only an example and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 5, the electronic device 500 is embodied in the form of a general purpose computing device. The components of the electronic device 500 may include, but are not limited to: one or more processors or processing units 510, a system memory 520, and a bus 530 that couples the various system components (including the system memory 520 and the processing unit 510).
Bus 530 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 500 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by electronic device 500 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 520 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)521 and/or cache memory 522. The electronic device 500 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 523 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 5 and commonly referred to as a "hard disk drive"). Although not shown in FIG. 5, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 530 by one or more data media interfaces. Memory 520 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 524 having a set (at least one) of program modules 525 may be stored, for example, in memory 520, such program modules 525 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 525 generally perform the functions and/or methodologies of the described embodiments of the invention.
Electronic device 500 may also communicate with one or more external devices 540 (e.g., keyboard, pointing device, display 541, etc.), one or more devices that enable a user to interact with electronic device 500, and/or any devices (e.g., network card, modem, etc.) that enable electronic device 500 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 550. Also, the electronic device 500 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 560. As shown, the network adapter 560 communicates with the other modules of the electronic device 500 over the bus 530. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 510 executes various functional applications and data processing by running a program stored in the system memory 520, for example, implementing a method for determining a step size of a lens motor according to an embodiment of the present invention, where the method includes:
when the exposure value of a shooting picture is adjusted to be a normal exposure value based on an automatic exposure mode, determining a shutter speed and a gain value corresponding to the normal exposure value;
shooting a plurality of frames of first images based on the shutter speed and the gain value corresponding to the normal exposure value;
controlling a motor in the electric aperture lens to move for a preset step length along a preset direction, and shooting a second image at the position where the motor moves;
determining the motor step size based on the first image and the second image.
In order to achieve the above object, the present invention also provides a computer-readable storage medium.
A computer-readable storage medium provided in an embodiment of the present invention stores thereon a computer program, which when executed by a processor implements a method for determining a step size of a lens motor according to an embodiment of the present invention, where the method includes:
when the exposure value of a shot picture is adjusted to be a normal exposure value based on an automatic exposure mode, determining a shutter speed and a gain value corresponding to the normal exposure value;
shooting a plurality of frames of first images based on the shutter speed and the gain value corresponding to the normal exposure value;
controlling a motor in the electric aperture lens to move for a preset step length along a preset direction, and shooting a second image at the position where the motor moves;
determining the motor step size based on the first image and the second image.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, or the like, as well as conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (15)

1. A lens motor step size determination method, performed by an electronic device having an electric iris lens, the method comprising:
when the exposure value of a shooting picture is adjusted to be a normal exposure value based on an automatic exposure mode, determining a shutter speed and a gain value corresponding to the normal exposure value;
shooting a plurality of frames of first images based on the shutter speed and the gain value corresponding to the normal exposure value;
controlling a motor in the electric aperture lens to move for a preset step length along a preset direction, and shooting a second image at the position where the motor moves;
determining the motor step size based on the first image and the second image.
2. The method according to claim 1, wherein after the capturing the plurality of frames of the first image based on the shutter speed and the gain value corresponding to the normal exposure value, further comprising:
determining a brightness value and a definition value of each frame of the first image;
determining a brightness threshold value and a brightness mean value based on the brightness values of the plurality of frames of first images;
and determining a definition threshold value and a definition mean value based on the definition values of the plurality of frames of the first image.
3. The method of claim 1, wherein the preset direction comprises: a first direction and a second direction; control the motor of electronic light ring camera lens moves along predetermineeing the direction and predetermineeing the step length, include:
controlling the motor to move a preset step length along a first direction, or controlling the motor to move the preset step length along a second direction;
correspondingly, the taking of the second image at the position where the motor moves comprises:
if the position of the motor is a first position after the motor moves along a first direction by a preset step length, shooting a second image at the first position;
and if the motor moves in the second direction by the preset step length and then is located at a second position, shooting a second image at the second position.
4. The method of claim 3, wherein after capturing the second image at the location after the motor has moved, further comprising:
determining a brightness value and a sharpness value of the second image.
5. The method of any of claims 1-4, wherein determining the motor step size based on the first image and the second image comprises:
and determining the motor step length based on the brightness value and the definition value of the second image and the brightness threshold value, the brightness mean value, the definition threshold value and the definition mean value corresponding to the first image.
6. The method of claim 5, wherein determining the motor step size based on the brightness value and the sharpness value of the second image and the corresponding brightness threshold, brightness mean, sharpness threshold, and sharpness mean of the first image comprises:
determining a first difference absolute value of the brightness value of the second image and the brightness mean value and a second difference absolute value of the definition value of the second image and the definition mean value;
determining a first sum of the first difference absolute value and the second difference absolute value;
determining the motor step size based on the first sum and a second sum of the brightness threshold and the sharpness threshold.
7. The method of claim 6, wherein determining the motor step size based on the first sum and a second sum of the brightness threshold and the sharpness threshold comprises:
if the first sum is smaller than or equal to the second sum, determining the preset step as a target step of the motor along a preset direction, and determining the sum of the target steps as the motor step;
and if the first sum is larger than the second sum, controlling the motor to move a preset step length along the preset direction by taking the position where the motor is located after moving as a starting point, determining the brightness value and the definition value of a third image shot at the target position where the motor is located after moving, and determining the motor step length based on the brightness value and the definition value of the third image and the brightness threshold value, the brightness mean value, the definition threshold value and the definition mean value corresponding to the first image.
8. The method of claim 7, wherein determining the motor step size based on the brightness value and the sharpness value of the third image and the corresponding brightness threshold, brightness mean, sharpness threshold, and sharpness mean of the first image comprises:
if the preset direction is a first direction, determining the sum of all preset step lengths in the first direction as a first step length of the motor when the brightness value of the third image is less than or equal to a first threshold value, and the sum of the absolute value of the difference between the brightness value and the brightness mean value and the absolute value of the difference between the definition value and the definition mean value is less than or equal to a second sum value;
if the preset direction is a second direction, determining the sum of all preset step lengths in the second direction as a second step length of the motor when the sum of the absolute difference value between the brightness value of the third image and the brightness mean value and the absolute difference value between the definition value and the definition mean value is less than or equal to the second sum value;
determining the motor step size based on the first step size and the second step size.
9. The method of claim 7, wherein determining the motor step size based on the brightness value and the sharpness value of the third image and the corresponding brightness threshold, brightness mean, sharpness threshold, and sharpness mean of the first image comprises:
if the preset direction is a first direction, when the brightness value of the third image is larger than the first threshold value, reducing the shutter speed and the gain value, shooting a plurality of frames of fourth images based on the reduced shutter speed and the reduced gain value, shooting a fifth image at the position where the motor moves along the first direction, and determining a first step length of the motor based on the fourth image and the fifth image; alternatively, the first and second electrodes may be,
if the preset direction is a first direction, when the brightness value of the third image is less than or equal to the first threshold, the absolute value of the difference between the brightness value and the brightness mean value, when the sum of the absolute values of the differences from the sharpness value and the sharpness mean is greater than the second sum, controlling the motor to move by a preset step length along the first direction by taking the moved target position as a starting point until the brightness value of a sixth image shot at a new target position after the motor moves is less than or equal to the first threshold value and the absolute value of the difference between the brightness value of the sixth image and the brightness mean value, until the sum of the absolute values of the differences between the definition of the sixth image and the definition mean is less than or equal to the second sum, determining the sum of all preset step lengths in the first direction as a first step length of the motor;
if the preset direction is a second direction, when the absolute value of the difference between the brightness value of the third image and the average brightness value and the sum of the absolute value of the difference between the definition value and the average definition value are greater than the second sum, controlling the motor to move a preset step length along the second direction by taking the moved target position as a starting point until the absolute value of the difference between the brightness value of a seventh image shot at a new target position after the motor moves and the absolute value of the difference between the definition of the seventh image and the average definition value are less than or equal to the second sum, and determining the sum of all preset step lengths in the second direction as the second step length of the motor;
determining the motor step size based on the first step size and the second step size.
10. The method of claim 2 or 4, wherein said determining a luminance value of an image comprises:
converting the color format of the image into a preset color format;
determining a brightness value of the image based on the preset color format.
11. The method according to claim 10, wherein the preset color format is YUV format or HSL format;
correspondingly, the determining the brightness value of the image based on the preset color format includes:
if the preset color format is a YUV format, determining a Y component and a value in the image, and determining the Y component and the value as the brightness value of the image;
and if the preset color format is the HSL format, determining an L component sum value in the image, and determining the L component sum value as the brightness value of the image.
12. The method of claim 2 or 4, wherein determining the sharpness value of the image comprises:
converting the image into a gray scale image, and determining the gradient value of each pixel in the image based on a preset gradient operator;
determining pixels belonging to boundary pixels in the image according to the gradient values;
determining gradients and values of all edge pixels, and determining the gradients and values as a sharpness value of the image.
13. A lens motor step length determining device, which is provided in an electronic apparatus having an electric aperture lens, includes:
the first determining module is used for determining the shutter speed and the gain value corresponding to the normal exposure value when the exposure value of the shooting picture is adjusted to be the normal exposure value based on the automatic exposure mode;
the shooting module is used for shooting a plurality of frames of first images based on the shutter speed and the gain value corresponding to the normal exposure value;
the control module is used for controlling a motor in the electric iris lens to move for a preset step length along a preset direction and shooting a second image at the position where the motor moves;
a second determination module to determine the motor step size based on the first image and the second image.
14. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement a lens motor step size determination method as recited in any of claims 1-12.
15. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out a lens motor step size determination method according to any one of claims 1 to 12.
CN202011286790.6A 2020-11-17 2020-11-17 Lens motor step length determining method, device, equipment and medium Active CN114513602B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011286790.6A CN114513602B (en) 2020-11-17 2020-11-17 Lens motor step length determining method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011286790.6A CN114513602B (en) 2020-11-17 2020-11-17 Lens motor step length determining method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN114513602A true CN114513602A (en) 2022-05-17
CN114513602B CN114513602B (en) 2024-02-20

Family

ID=81546538

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011286790.6A Active CN114513602B (en) 2020-11-17 2020-11-17 Lens motor step length determining method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN114513602B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050156871A1 (en) * 2003-12-30 2005-07-21 Texas Instruments Incorporated Automatic gain control for image display systems
CN108881736A (en) * 2018-06-30 2018-11-23 浙江大华技术股份有限公司 A kind of iris correction method and device
CN110139042A (en) * 2019-04-18 2019-08-16 浙江大华技术股份有限公司 Aperture method of adjustment and device, storage medium and monitoring device
CN111935413A (en) * 2019-05-13 2020-11-13 杭州海康威视数字技术股份有限公司 Aperture control method and camera

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050156871A1 (en) * 2003-12-30 2005-07-21 Texas Instruments Incorporated Automatic gain control for image display systems
CN108881736A (en) * 2018-06-30 2018-11-23 浙江大华技术股份有限公司 A kind of iris correction method and device
CN110139042A (en) * 2019-04-18 2019-08-16 浙江大华技术股份有限公司 Aperture method of adjustment and device, storage medium and monitoring device
CN111935413A (en) * 2019-05-13 2020-11-13 杭州海康威视数字技术股份有限公司 Aperture control method and camera

Also Published As

Publication number Publication date
CN114513602B (en) 2024-02-20

Similar Documents

Publication Publication Date Title
US11089207B2 (en) Imaging processing method and apparatus for camera module in night scene, electronic device and storage medium
CN109218628B (en) Image processing method, image processing device, electronic equipment and storage medium
CN106707674B (en) Automatic focusing method of projection equipment and projection equipment
US8629915B2 (en) Digital photographing apparatus, method of controlling the same, and computer readable storage medium
US11532076B2 (en) Image processing method, electronic device and storage medium
US20190014249A1 (en) Image Fusion Method and Apparatus, and Terminal Device
CN111028191B (en) Anti-shake method and device for video image, electronic equipment and storage medium
US9049372B2 (en) Electronic camera, computer readable medium recording imaging control program thereon and imaging control method
CN110493524B (en) Photometric adjustment method, device and equipment and storage medium
CN108289173B (en) Camera shooting control method and device, terminal equipment and storage medium
CN113747071B (en) Unmanned aerial vehicle shooting method and device, unmanned aerial vehicle and storage medium
CN110533618B (en) Lens distortion correction method and photographic device
WO2021104394A1 (en) Image processing method and apparatus, electronic device, and storage medium
CN112601008A (en) Camera switching method, terminal, device and computer readable storage medium
CN111405185B (en) Zoom control method and device for camera, electronic equipment and storage medium
US9686470B2 (en) Scene stability detection
CN110933304B (en) Method and device for determining to-be-blurred region, storage medium and terminal equipment
CN114513602B (en) Lens motor step length determining method, device, equipment and medium
CN115526782A (en) Video image filtering constraint method and device
CN112804477A (en) Method and device for determining image parameters of preset points, electronic equipment and storage medium
CN113572968A (en) Image fusion method and device, camera equipment and storage medium
CN115720293B (en) Camera focusing control method and system
CN114697566B (en) Zoom lens dark angle compensation method and device, electronic equipment and storage medium
US20230064826A1 (en) Method and device for controlling exposure level
US20160173756A1 (en) Focus control device and method and imaging apparatus

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