CN111246082A - Direct current motor focusing method and device, terminal equipment and storage medium - Google Patents

Direct current motor focusing method and device, terminal equipment and storage medium Download PDF

Info

Publication number
CN111246082A
CN111246082A CN201911426330.6A CN201911426330A CN111246082A CN 111246082 A CN111246082 A CN 111246082A CN 201911426330 A CN201911426330 A CN 201911426330A CN 111246082 A CN111246082 A CN 111246082A
Authority
CN
China
Prior art keywords
image
frame
direct current
current motor
definition
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
CN201911426330.6A
Other languages
Chinese (zh)
Other versions
CN111246082B (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.)
Sunell Technology Corp
Original Assignee
Sunell Technology Corp
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 Sunell Technology Corp filed Critical Sunell Technology Corp
Priority to CN201911426330.6A priority Critical patent/CN111246082B/en
Publication of CN111246082A publication Critical patent/CN111246082A/en
Application granted granted Critical
Publication of CN111246082B publication Critical patent/CN111246082B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • H04N23/81Camera processing pipelines; Components thereof for suppressing or minimising disturbance in the image signal generation

Landscapes

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

Abstract

The invention belongs to the technical field of automatic focusing, and particularly relates to a direct current motor focusing method, a direct current motor focusing device, terminal equipment and a storage medium. The embodiment of the invention drives the lens to move step by step through the direct current motor, and sequentially collects each frame of image through the lens; processing each frame image respectively to obtain the definition of each frame image; adjusting the moving step number of the direct current motor according to the variable quantity of the definition, wherein the moving step number of the direct current motor is negatively related to the variable quantity of the definition; for each frame of image, acquiring the position of a potentiometer during image acquisition, determining a correction step value according to a preset corresponding relation, and replacing the current step value of the direct current motor with the correction step value, wherein the correction step value is the step value corresponding to the position of the potentiometer during image acquisition; and finishing the movement when a second preset condition is met, and finishing the focusing. The problem that the existing direct current motor is large in focusing deviation is solved in the process.

Description

Direct current motor focusing method and device, terminal equipment and storage medium
Technical Field
The invention belongs to the technical field of automatic focusing, and particularly relates to a direct current motor focusing method, a direct current motor focusing device, terminal equipment and a storage medium.
Background
With the continuous improvement of the technological development level, some photographable devices are more and more common in the life of people, and clear images can be obtained by the photographable devices through focusing. However, due to the problems of complex production process and high cost of the thermal imaging stepping motor, the direct current motor lens is mainly used for thermal imaging focusing at present, and the direct current motor can rotate by applying proper voltage, but the direct current motor is difficult to achieve accurate control, so that the deviation of final focusing is large.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for focusing a dc motor, a terminal device, and a storage medium, so as to solve the problem of large focus offset of the existing dc motor.
A first aspect of an embodiment of the present invention provides a dc motor focusing method, including:
driving a lens to move step by step through a direct current motor, and sequentially collecting each frame of image through the lens;
processing each frame of image respectively to obtain the definition of each frame of image;
adjusting the moving steps of the direct current motor according to the variable quantity of the definition, wherein the moving steps of the direct current motor are inversely related to the variable quantity of the definition;
for each frame of image, acquiring the position of a potentiometer during image acquisition, determining a correction step value according to a preset corresponding relation, and replacing the current step value of the direct current motor with the correction step value, wherein the correction step value is the step value corresponding to the position of the potentiometer during image acquisition;
and finishing the movement when a second preset condition is met, and finishing the focusing.
Optionally, before determining the correction step number according to the preset corresponding relationship, the method further includes:
when the step number is an initial value, driving the direct current motor to move from a near focus section to a far focus section;
in the moving process, every time one frame of image is obtained, the position of a potentiometer in the direct current motor and the rotating step number of the direct current motor are recorded once to form a corresponding relation.
Optionally, the processing the frame images respectively to obtain the sharpness of the frame images includes:
respectively carrying out image optimization processing and noise filtering processing on each frame of image to obtain processed each frame of image;
extracting detail information of each processed frame image, and acquiring corresponding weight of the detail information;
and calculating the definition of each frame of image according to the detail information and the weight.
Optionally, the ending the movement when the second preset condition is met includes:
after the peak value of the definition change is confirmed, acquiring the position of a potentiometer corresponding to the peak value;
and the turning direction moves to the position of the corresponding potentiometer, the potentiometer moves in preset steps, and the movement is finished when the definition meets a preset threshold value.
A second aspect of an embodiment of the present invention provides a dc motor focusing apparatus, including:
the acquisition module is used for driving the lens to move step by step through the direct current motor and sequentially acquiring each frame of image through the lens;
the processing module is used for respectively processing the frame images to obtain the definition of each frame image;
the adjusting module is used for adjusting the moving step number of the direct current motor according to the variable quantity of the definition, and the moving step number of the direct current motor is inversely related to the variable quantity of the definition;
the correction module is used for acquiring the position of the potentiometer during image acquisition for each frame of image, determining a correction step value according to a preset corresponding relation, and replacing the current step value of the direct current motor with the correction step value, wherein the correction step value is the step value corresponding to the position of the potentiometer during image acquisition;
and the completion module is used for finishing the movement after meeting a second preset condition to complete the focusing.
Optionally, the dc motor focusing apparatus includes:
the driving module is used for driving the direct current motor to move from the near focus section to the far focus section when the step number is an initial value;
and the recording module is used for recording the position of the potentiometer in the direct current motor and the rotating step number of the direct current motor once every time one frame of image is obtained in the moving process to form a corresponding relation.
Optionally, the dc motor focusing apparatus includes:
the detail processing module is used for respectively carrying out image optimization processing and noise filtering processing on each frame of image to obtain each processed frame of image;
the extraction module is used for extracting the detail information of each processed frame image and acquiring the corresponding weight of the detail information;
and the calculating module is used for calculating the definition of each frame of image according to the detail information and the weight.
Optionally, the dc motor focusing apparatus includes:
the acquisition module is used for acquiring the position of the potentiometer corresponding to the peak value after the peak value of the definition change is confirmed;
and the moving module is used for turning the direction to move to the corresponding potentiometer position, moving in preset steps, and ending the movement when the definition meets a preset threshold value.
A third aspect of the embodiments of the present invention provides a terminal device, including a processor, a memory connected to the processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the above-mentioned dc motor focusing method when executing the computer program.
A fourth aspect of embodiments of the present invention provides a computer-readable storage medium, which stores a computer program that, when executed by a processor, implements the steps of a dc motor focusing method as described above.
The embodiment of the invention drives the lens to move step by step through the direct current motor, and sequentially collects each frame of image through the lens; processing each frame image respectively to obtain the definition of each frame image; adjusting the moving step number of the direct current motor according to the variable quantity of the definition, wherein the moving step number of the direct current motor is negatively related to the variable quantity of the definition; for each frame of image, acquiring the position of a potentiometer during image acquisition, determining a correction step value according to a preset corresponding relation, and replacing the current step value of the direct current motor with the correction step value, wherein the correction step value is the step value corresponding to the position of the potentiometer during image acquisition; and finishing the movement when a second preset condition is met, and finishing the focusing. The embodiment of the invention drives the lens to move step by step through the direct current motor, collects each frame of image through the lens, respectively processes each frame of image to obtain the definition of each frame of image, thereby searching the image with the highest definition through the definition to complete focusing, adjusts the moving step number of the direct current motor according to the variation of the definition, the moving step number of the direct current motor is negatively related to the variation of the definition, and is convenient to quickly find the image with high definition, for each frame of image, the potentiometer position during image collection is obtained, the correction step number value is determined according to the preset corresponding relation, the current step number value of the direct current motor is replaced by the correction step number value, the correction step number value is the step number value corresponding to the potentiometer position during image collection, thereby correcting the step number position in real time during focusing, preventing focusing deviation from increasing, and finishing the movement when a second preset condition is met, the focusing is completed, and the problem of large focusing deviation of the existing direct current motor is solved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed for the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic flow chart of a dc motor focusing method according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of a dc motor focusing method according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a relationship between positions and step numbers of a DC motor focusing method according to an embodiment of the present invention;
fig. 4 is a focusing definition curve diagram of a dc motor focusing method according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a DC motor focusing device provided in an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood by those skilled in the art, the technical solutions in the embodiments of the present invention will be clearly described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "comprises" and "comprising," and any variations thereof, in the description and claims of this invention and the above-described drawings are intended to cover non-exclusive inclusions. For example, a process, method, or system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus. Furthermore, the terms "first," "second," and "third," etc. are used to distinguish between different objects and are not used to describe a particular order.
As shown in fig. 1, which is a first schematic flow chart of a dc motor focusing method according to an embodiment of the present invention, the dc motor focusing method may include:
and S101, driving a lens to move step by step through a direct current motor, and sequentially collecting each frame of image through the lens.
In specific application, the lens is driven to move step by the direct current motor, and each frame of image is collected by the lens in sequence. Wherein the focusing can be performed by PWM setting the number of steps.
Optionally, corresponding parameters of the PWM are set in advance, that is, driving parameters of the PWM are configured, where the parameters include, but are not limited to, duty ratio and frequency, and the rotation speed and frequency can be controlled by setting the PWM parameters, so as to control the speed of the motor rotation speed, so that the motor rotation speed is stable, where one rotation period corresponds to one step in the number of steps. It can be understood that the duty ratio is set to control the rotation speed of the motor, because the duty ratios are different, the driving forces of the corresponding motors are different, the larger the duty ratio is, the larger the driving force is, the faster the motor rotates, but the motor cannot rotate too fast or too slow, the value can be matched according to the algorithm of each motor, and under the condition that the motor can normally operate, the value can be taken from 1% to 100% of the duty ratio; the frequency is set to control the rotational accuracy of the motor, i.e. 1s number of pulses. When the frequency is higher, the number of pulses corresponding to 1s is more, the rotating angle of a corresponding pulse motor is smaller, and the precision is higher.
By way of specific example and not limitation, when the duty ratio is 50%, 1s is required for one rotation of the motor, but when the duty ratio is adjusted to 25%, 2s is required for one rotation of the motor.
Optionally, since one pulse corresponds to one step, the total number of steps of the motor rotation is determined, and the total number of steps of the motor rotation is generally set between 1000 and 3000, if the number of steps is too large, the focusing speed will be slow, and if the number of steps is too small, the accuracy may be insufficient, so that the optimal focusing position cannot be found.
And step S102, processing each frame image respectively to obtain the definition of each frame image.
In specific application, each frame of image is respectively processed to obtain the definition of each frame of image, and it can be understood that the definition of each frame of image can be obtained after the image is processed, so that the accuracy of the definition of each frame of image can be improved to the maximum extent.
As shown in fig. 2, which is a second schematic flow chart of the dc motor focusing method provided in the embodiment of the present invention, the processing the frame images respectively to obtain the sharpness of the frame images includes:
step S201, performing image optimization processing and noise filtering processing on each frame of image respectively to obtain processed each frame of image.
In specific application, performing image optimization processing and noise filtering processing on each frame of image respectively to obtain processed each frame of image, wherein the image optimization processing mode includes but is not limited to an image signal processing mode; the noise filtering process includes, but is not limited to, a 3D noise reduction process. It can be understood that the two processing manners mainly aim to filter out temporal noise in the image, see whether the image becomes relatively clear, and see whether the detail information of the image is more or less.
Step S202, extracting the detail information of each processed frame image, and acquiring the corresponding weight of the detail information.
In specific application, extracting detail information of each processed frame image, and acquiring weights corresponding to all the detail information, wherein the extraction mode can be a laplacian calculation mode to extract edge information in the image; the detail information comprises the number of low-frequency, intermediate-frequency and high-frequency detail nodes, and is divided into three parts of low frequency, intermediate frequency and high frequency according to the strength of the edge; the corresponding weight refers to different corresponding weights of different detailed information, and the setting of the weight can be set according to requirements.
And step S203, calculating the definition of each frame of image according to the detail information and the weight.
In specific application, the definition of each frame of image is calculated according to the detail information and the weights corresponding to different detail information. It can be understood that the definition value of the image according with the requirement can be obtained through calculation according to the detail information of different weights, and people can find the image with the high definition value as soon as possible.
Optionally, usually, low-frequency detail information is directly filtered, only the detail information of the middle frequency and the detail information of the high frequency are adopted, and in the edge image obtained by the laplacian calculation, some thresholds may be set, for example, when the pixel value is less than 100, the detail information may be regarded as the low frequency, when the pixel value is greater than 200, the detail information may be regarded as the high frequency, and in the middle, the detail information may be regarded as the middle frequency. It will be appreciated that the threshold values and weights may be adjusted accordingly according to actual circumstances.
By way of specific example, but not limitation, when the number of low-frequency pixels is filtered; the number of the intermediate frequency pixel points is m, and the weight is 0.6; when the high-frequency pixel point is n and the weight is 0.4, the definition value is v ═ 0.6 × m +0.4 × n, wherein v refers to the definition value.
And S103, adjusting the moving step number of the direct current motor according to the variable quantity of the definition, wherein the moving step number of the direct current motor is inversely related to the variable quantity of the definition.
In a specific application, the moving step number of the direct current motor is adjusted according to the variation of the definition, and the moving step number of the direct current motor is in negative correlation with the variation of the definition. It can be understood that when the change of the definition is small, the movement is performed in the maximum number of steps, that is, when the current image is blurred, the movement speed of the motor can be increased; when the change of the definition is larger, the number of moving steps is gradually reduced, and the step is moved in small steps. The above-mentioned how to judge the size of the change of the definition can be judged according to an empirical value, because the methods for calculating the definition values are different, the above-mentioned empirical values are also different; the maximum step number can be determined according to the set PWM frequency, and the maximum step number of the number of PWM pulses corresponding to one frame; the small steps can be set by self.
By way of specific example and not limitation, the change in sharpness value may refer to the average of sharpness values of the previous 5 frames, when the change is less than 5%, the change is considered to be small, when the sharpness change is fast, the number of moving steps per frame may be set according to a threshold, for example, the maximum number of moving steps per frame is 40, when the change in sharpness value is 8%, the number of steps is set to 30, when the change in sharpness value is 15%, the number of steps is set to 20, and when the change in sharpness value is 20%, the number of steps is set to 10.
And S104, acquiring the position of the potentiometer during image acquisition for each frame of image, determining a correction step value according to a preset corresponding relation, and replacing the current step value of the direct current motor with the correction step value, wherein the correction step value is the step value corresponding to the position of the potentiometer during image acquisition.
In specific application, for each frame of image, the position of the potentiometer during image acquisition is obtained, a correction step value is determined according to a preset corresponding relation, and the current step value of the direct current motor is replaced by the correction step value, wherein the correction step value is the step value corresponding to the position of the potentiometer during image acquisition.
Optionally, for different dc motors with potentiometers, the corresponding relationship between the potentiometer position and the step number is different, where the different dc motors with potentiometers refer to motors produced by different manufacturers, and the processes thereof are different, but the focusing means are the same. It can be understood that the direct current motor with the potentiometer is to match the motor with the potentiometer on the lens, the sliding rheostat is added in the circuit, when the motor rotates, the lens in the lens can move back and forth, the scriber of the sliding rheostat of the potentiometer and the lens can move together, the corresponding voltage value of the sliding rheostat can change, and the added voltage AD is converted into a digital signal, namely the position value of the potentiometer.
Optionally, after the image of each frame moves, the position of the potentiometer changes, and the position of the potentiometer needs to be read and the step number needs to be corrected through a preset corresponding relation, so that the phenomenon that the motor impacts the boundary and runs reversely after the step number reaches the range boundary due to errors caused by motor blockage and the like can be prevented, and the boundary is considered to be reversed when the image does not move to a clear position, so that focusing fails.
Optionally, before determining the correction step number according to the preset corresponding relationship, the method further includes:
and when the step number is an initial value, driving the direct current motor to move from the near focus section to the far focus section.
In the moving process, every time a frame of image is obtained, recording the potentiometer position in the direct current motor and the rotating step number of the direct current motor once to form a corresponding relation, wherein the relation that the potentiometer position and the rotating step number of the direct current motor correspond is shown in figure 3, the change of the potentiometer position value in the full range is 99 to 141, the change is only 42, the focusing precision is very low through the potentiometer position value, and a clear position is difficult to find to complete focusing.
In specific application, when the step number is an initial value, the direct current motor is driven to move from a near focus section to a far focus end, in the moving process, the position and the step number of a potentiometer in the direct current motor are recorded once every time one frame of image is obtained, and the value recorded every time in the process is stored to serve as the corresponding relation between the position of the potentiometer and the step number. It can be understood that the corresponding step number of the potentiometer position value is counted at different values, so that the corresponding step number is used for replacing the current step number according to the potentiometer position value in real time during the focusing process.
And S105, finishing the movement when a second preset condition is met, and finishing the focusing.
In a specific application, when a second preset condition is met, the movement is ended, and the focusing is completed, wherein the second preset condition means that the definition of the image meets a preset threshold condition.
Optionally, the ending the movement when the second preset condition is met includes:
and after the peak value of the definition change is confirmed, acquiring the position of the potentiometer corresponding to the peak value.
And the turning direction moves to the position of the corresponding potentiometer, the potentiometer moves in preset steps, and the movement is finished when the definition meets a preset threshold value.
In a specific application, in the moving process of the direct current motor, after a peak value of definition change is confirmed, the position of a potentiometer corresponding to the peak value is obtained, the direction is reversed to move to the position of the potentiometer corresponding to the peak value, then the potentiometer moves in small steps with a preset step number, and the movement is finished when the definition meets a preset threshold value. The preset threshold value can be 0.98 times of the peak definition, and in the process of small-step movement, if the current definition is counted to be greater than 0.98 times of the peak definition, the movement is ended, wherein 0.98 is an empirical value and can be set according to the situation; the turning mode is to control the motor to move in two directions, and the motor has two pins corresponding to the two directions and can control the motor to rotate by giving pulse signals to one of the pins.
As shown in fig. 4, when the resolution changes to a peak value quickly, the small-step focusing slowly finds the peak value, records the corresponding potentiometer position value and resolution value, when the resolution starts to go down a slope, the turning direction moves to a position close to the potentiometer position of the peak value, and the small-step focusing finds a position meeting the resolution requirement to complete the focusing.
The embodiment of the invention drives the lens to move step by step through the direct current motor, and sequentially collects each frame of image through the lens; processing each frame image respectively to obtain the definition of each frame image; adjusting the moving step number of the direct current motor according to the variable quantity of the definition, wherein the moving step number of the direct current motor is negatively related to the variable quantity of the definition; for each frame of image, acquiring the position of a potentiometer during image acquisition, determining a correction step value according to a preset corresponding relation, and replacing the current step value of the direct current motor with the correction step value, wherein the correction step value is the step value corresponding to the position of the potentiometer during image acquisition; and finishing the movement when a second preset condition is met, and finishing the focusing. The embodiment of the invention drives the lens to move step by step through the direct current motor, collects each frame of image through the lens, respectively processes each frame of image to obtain the definition of each frame of image, thereby searching the image with the highest definition through the definition to complete focusing, adjusts the moving step number of the direct current motor according to the variation of the definition, the moving step number of the direct current motor is negatively related to the variation of the definition, and is convenient to quickly find the image with high definition, for each frame of image, the potentiometer position during image collection is obtained, the correction step number value is determined according to the preset corresponding relation, the current step number value of the direct current motor is replaced by the correction step number value, the correction step number value is the step number value corresponding to the potentiometer position during image collection, thereby correcting the step number position in real time during focusing, preventing focusing deviation from increasing, and finishing the movement when a second preset condition is met, the focusing is completed, and the problem of large focusing deviation of the existing direct current motor is solved.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
As shown in fig. 5, a dc motor focusing apparatus 5 provided in an embodiment of the present invention is configured to perform the method steps in the above dc motor focusing method embodiment, where the dc motor focusing apparatus may include:
the acquisition module 501 is configured to drive the lens to move step by step through the dc motor, and sequentially acquire each frame of image through the lens.
The processing module 502 is configured to process each frame of image respectively to obtain the sharpness of each frame of image.
An adjusting module 503, configured to adjust the number of moving steps of the dc motor according to the variation of the definition, where the number of moving steps of the dc motor is inversely related to the variation of the definition.
The correction module 504 is configured to, for each frame of image, obtain a potentiometer position during image acquisition, determine a correction step value according to a preset corresponding relationship, and replace the current step value of the dc motor with the correction step value, where the correction step value is a step value corresponding to the potentiometer position during image acquisition.
And a finishing module 505, configured to finish the movement when a second preset condition is met, and finish the focusing.
Optionally, the dc motor focusing apparatus further includes:
and the driving module is used for driving the direct current motor to move from the near-focus section to the far-focus section when the step number is an initial value.
And the recording module is used for recording the position of the potentiometer in the direct current motor and the rotating step number of the direct current motor once every time one frame of image is obtained in the moving process to form a corresponding relation.
Optionally, the dc motor focusing apparatus further includes:
and the detail processing module is used for respectively carrying out image optimization processing and noise filtering processing on each frame of image to obtain each processed frame of image.
And the extraction module is used for extracting the detail information of each processed frame image and acquiring the corresponding weight of the detail information.
And the calculating module is used for calculating the definition of each frame of image according to the detail information and the weight.
Optionally, the dc motor focusing apparatus further includes:
and the acquisition module is used for acquiring the position of the potentiometer corresponding to the peak value after the peak value of the definition change is confirmed.
And the moving module is used for turning the direction to move to the corresponding potentiometer position, moving in preset steps, and ending the movement when the definition meets a preset threshold value.
The embodiment of the invention drives the lens to move step by step through the direct current motor, and sequentially collects each frame of image through the lens; processing each frame image respectively to obtain the definition of each frame image; adjusting the moving step number of the direct current motor according to the variable quantity of the definition, wherein the moving step number of the direct current motor is negatively related to the variable quantity of the definition; for each frame of image, acquiring the position of a potentiometer during image acquisition, determining a correction step value according to a preset corresponding relation, and replacing the current step value of the direct current motor with the correction step value, wherein the correction step value is the step value corresponding to the position of the potentiometer during image acquisition; and finishing the movement when a second preset condition is met, and finishing the focusing. The embodiment of the invention drives the lens to move step by step through the direct current motor, collects each frame of image through the lens, respectively processes each frame of image to obtain the definition of each frame of image, thereby searching the image with the highest definition through the definition to complete focusing, adjusts the moving step number of the direct current motor according to the variation of the definition, the moving step number of the direct current motor is negatively related to the variation of the definition, and is convenient to quickly find the image with high definition, for each frame of image, the potentiometer position during image collection is obtained, the correction step number value is determined according to the preset corresponding relation, the current step number value of the direct current motor is replaced by the correction step number value, the correction step number value is the step number value corresponding to the potentiometer position during image collection, thereby correcting the step number position in real time during focusing, preventing focusing deviation from increasing, and finishing the movement when a second preset condition is met, the focusing is completed, and the problem of large focusing deviation of the existing direct current motor is solved.
As shown in fig. 6, an embodiment of the present invention further provides a terminal device 6 including: a processor 600, a memory 601 connected to said processor 600, and a computer program 602, such as a dc motor focusing program, stored in said memory 601 and executable on said processor 600. The processor 600 executes the computer program 602 to implement the steps in the above-described embodiments of the dc motor focusing method, such as the steps S101 to S105 shown in fig. 1. Alternatively, the processor 600 executes the computer program 602 to implement the functions of the modules in the device embodiments, such as the functions of the modules 501 to 505 shown in fig. 5.
Illustratively, the computer program 602 may be partitioned into one or more modules that are stored in the memory 601 and executed by the processor 600 to implement the present invention. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 602 in the terminal device 6. For example, the computer program 602 may be divided into an acquisition module 501, a processing module 502, an adjustment module 503, a correction module 504, and a completion module 505, and the specific functions of each module are as follows:
the acquisition module 501 is configured to drive a lens to move step by step through a dc motor, and sequentially acquire each frame of image through the lens;
a processing module 502, configured to process each frame of image respectively to obtain a definition of each frame of image;
an adjusting module 503, configured to adjust a moving step number of the dc motor according to the variation of the definition, where the moving step number of the dc motor is inversely related to the variation of the definition;
a correction module 504, configured to obtain, for each frame of image, a potentiometer position during image acquisition, determine a correction step value according to a preset corresponding relationship, and replace the current step value of the dc motor with the correction step value, where the correction step value is a step value corresponding to the potentiometer position during image acquisition;
and a finishing module 505, configured to finish the movement when a second preset condition is met, and finish the focusing.
The terminal device 6 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device 6 may include, but is not limited to, a processor 600, a memory 601. Those skilled in the art will appreciate that fig. 6 is merely an example of a terminal device 6 and does not constitute a limitation of terminal device 6 and may include more or less components than those shown, or some components in combination, or different components, for example, the terminal device may also include input output devices, network access devices, buses, etc.
The Processor 600 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 601 may be an internal storage unit of the terminal device 6, such as a hard disk or a memory of the terminal device 6. The memory 601 may also be an external storage device of the terminal device 6, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the terminal device 6. Further, the memory 601 may also include both an internal storage unit and an external storage device of the terminal device 6. The memory 601 is used for storing the computer programs and other programs and data required by the terminal device. The memory 601 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated module, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, etc. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (10)

1. A dc motor focusing method, comprising:
driving a lens to move step by step through a direct current motor, and sequentially collecting each frame of image through the lens;
processing each frame of image respectively to obtain the definition of each frame of image;
adjusting the moving steps of the direct current motor according to the variable quantity of the definition, wherein the moving steps of the direct current motor are inversely related to the variable quantity of the definition;
for each frame of image, acquiring the position of a potentiometer during image acquisition, determining a correction step value according to a preset corresponding relation, and replacing the current step value of the direct current motor with the correction step value, wherein the correction step value is the step value corresponding to the position of the potentiometer during image acquisition;
and finishing the movement when a second preset condition is met, and finishing the focusing.
2. The dc motor focusing method of claim 1, further comprising, before determining the correction step number according to the predetermined correspondence:
when the step number is an initial value, driving the direct current motor to move from a near focus section to a far focus section;
in the moving process, every time one frame of image is obtained, the position of a potentiometer in the direct current motor and the rotating step number of the direct current motor are recorded once to form a corresponding relation.
3. The dc motor focusing method according to claim 1, wherein said processing the frame images respectively to obtain the sharpness of the frame images comprises:
respectively carrying out image optimization processing and noise filtering processing on each frame of image to obtain processed each frame of image;
extracting detail information of each processed frame image, and acquiring corresponding weight of the detail information;
and calculating the definition of each frame of image according to the detail information and the weight.
4. The dc motor focusing method of claim 1, wherein said ending the movement when a second predetermined condition is satisfied comprises:
after the peak value of the definition change is confirmed, acquiring the position of a potentiometer corresponding to the peak value;
and the turning direction moves to the position of the corresponding potentiometer, the potentiometer moves in preset steps, and the movement is finished when the definition meets a preset threshold value.
5. A dc motor focusing assembly, comprising:
the acquisition module is used for driving the lens to move step by step through the direct current motor and sequentially acquiring each frame of image through the lens;
the processing module is used for respectively processing the frame images to obtain the definition of each frame image;
the adjusting module is used for adjusting the moving step number of the direct current motor according to the variable quantity of the definition, and the moving step number of the direct current motor is inversely related to the variable quantity of the definition;
the correction module is used for acquiring the position of the potentiometer during image acquisition for each frame of image, determining a correction step value according to a preset corresponding relation, and replacing the current step value of the direct current motor with the correction step value, wherein the correction step value is the step value corresponding to the position of the potentiometer during image acquisition;
and the completion module is used for finishing the movement after meeting a second preset condition to complete the focusing.
6. The dc motor focusing assembly of claim 5, comprising:
the driving module is used for driving the direct current motor to move from the near focus section to the far focus section when the step number is an initial value;
and the recording module is used for recording the position of the potentiometer in the direct current motor and the rotating step number of the direct current motor once every time one frame of image is obtained in the moving process to form a corresponding relation.
7. The dc motor focusing assembly of claim 5, comprising:
the detail processing module is used for respectively carrying out image optimization processing and noise filtering processing on each frame of image to obtain each processed frame of image;
the extraction module is used for extracting the detail information of each processed frame image and acquiring the corresponding weight of the detail information;
and the calculating module is used for calculating the definition of each frame of image according to the detail information and the weight.
8. The dc motor focusing assembly of claim 5, comprising:
the acquisition module is used for acquiring the position of the potentiometer corresponding to the peak value after the peak value of the definition change is confirmed;
and the moving module is used for turning the direction to move to the corresponding potentiometer position, moving in preset steps, and ending the movement when the definition meets a preset threshold value.
9. A terminal device comprising a processor, a memory connected to the processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor, when executing the computer program, implements the steps of a dc motor focusing method as claimed in any one of claims 1 to 4.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of a method for dc-motor focusing as claimed in any one of claims 1 to 4.
CN201911426330.6A 2019-12-31 2019-12-31 Direct current motor focusing method and device, terminal equipment and storage medium Active CN111246082B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911426330.6A CN111246082B (en) 2019-12-31 2019-12-31 Direct current motor focusing method and device, terminal equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911426330.6A CN111246082B (en) 2019-12-31 2019-12-31 Direct current motor focusing method and device, terminal equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111246082A true CN111246082A (en) 2020-06-05
CN111246082B CN111246082B (en) 2021-03-09

Family

ID=70865656

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911426330.6A Active CN111246082B (en) 2019-12-31 2019-12-31 Direct current motor focusing method and device, terminal equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111246082B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101660946A (en) * 2009-09-28 2010-03-03 山东神戎电子股份有限公司 Auto-focusing method and device of thermal imager
CN103513395A (en) * 2012-06-15 2014-01-15 中兴通讯股份有限公司 Passive auto-focusing method and device
CN106210519A (en) * 2016-07-12 2016-12-07 山东神戎电子股份有限公司 A kind of focus method of the autofocus system of band memory function
CN106375647A (en) * 2015-07-23 2017-02-01 杭州海康威视数字技术股份有限公司 Method, device and system for adjusting camera back focus
CN106534676A (en) * 2016-11-02 2017-03-22 西安电子科技大学 Automatic focus adjustment method for zoom camera systems
CN108200319A (en) * 2018-01-09 2018-06-22 佛山华国光学器材有限公司 A kind of big zoom integrated camera and its autocontrol method
CN108540723A (en) * 2018-04-27 2018-09-14 中国科学院半导体研究所 More camera lenses for Active Imaging calculate synchronisation control means
CN108924427A (en) * 2018-08-13 2018-11-30 浙江大华技术股份有限公司 A kind of video camera focus method, device and video camera
US10678119B2 (en) * 2017-03-03 2020-06-09 Sony Corporation Interchangeable lens, imaging apparatus, and camera system

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101660946A (en) * 2009-09-28 2010-03-03 山东神戎电子股份有限公司 Auto-focusing method and device of thermal imager
CN103513395A (en) * 2012-06-15 2014-01-15 中兴通讯股份有限公司 Passive auto-focusing method and device
CN106375647A (en) * 2015-07-23 2017-02-01 杭州海康威视数字技术股份有限公司 Method, device and system for adjusting camera back focus
CN106210519A (en) * 2016-07-12 2016-12-07 山东神戎电子股份有限公司 A kind of focus method of the autofocus system of band memory function
CN106534676A (en) * 2016-11-02 2017-03-22 西安电子科技大学 Automatic focus adjustment method for zoom camera systems
US10678119B2 (en) * 2017-03-03 2020-06-09 Sony Corporation Interchangeable lens, imaging apparatus, and camera system
CN108200319A (en) * 2018-01-09 2018-06-22 佛山华国光学器材有限公司 A kind of big zoom integrated camera and its autocontrol method
CN108540723A (en) * 2018-04-27 2018-09-14 中国科学院半导体研究所 More camera lenses for Active Imaging calculate synchronisation control means
CN108924427A (en) * 2018-08-13 2018-11-30 浙江大华技术股份有限公司 A kind of video camera focus method, device and video camera

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
范栋梁: "电位器在直线步进电机中的应用", 《机械工程师》 *

Also Published As

Publication number Publication date
CN111246082B (en) 2021-03-09

Similar Documents

Publication Publication Date Title
EP3480784B1 (en) Image processing method, and device
CN110570368B (en) Depth image distortion correction method, depth image distortion correction device, electronic device and storage medium
CN107395993A (en) Full-automatic focusing method and system
CN111757008B (en) Focusing method, device and computer readable storage medium
CN108093158B (en) Image blurring processing method and device, mobile device and computer readable medium
CN106231201A (en) Atomatic focusing method and device
CN113298761B (en) Image filtering method, device, terminal and computer readable storage medium
CN110852997A (en) Dynamic image definition detection method and device, electronic equipment and storage medium
CN109151328B (en) Lens focusing method and device and zoom lens
CN114760415A (en) Lens focusing method, system, device and medium
CN108052943A (en) A kind of instrument character wheel recognition methods and equipment
CN111698426B (en) Test question shooting method and device, electronic equipment and storage medium
CN105407281A (en) Scene based photographing device and method
CN111246082B (en) Direct current motor focusing method and device, terminal equipment and storage medium
CN108765346B (en) Auxiliary focusing method and device and readable medium
CN113538545B (en) Monocular depth estimation method based on electro-hydraulic adjustable-focus lens and corresponding camera and storage medium
EP1686793A1 (en) Automatic focus for image sensors
CN109698902B (en) Synchronous focusing method and device
CN109168001B (en) Method and device for detecting video scene change and video acquisition equipment
CN114757855A (en) Method, device, equipment and storage medium for correcting action data
CN115242979A (en) Focusing method and system applied to blood shooting, intelligent equipment and storage medium
CN112672008B (en) Lens adjusting method and device
CN110475071B (en) Phase focusing method, phase focusing device, electronic equipment and machine-readable storage medium
CN111275739B (en) Automatic tracking device and method
DE102013004120B4 (en) Electronic device and focus adjustment method of this

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