CN110568699A - control method for simultaneously automatically focusing most 12 cameras - Google Patents
control method for simultaneously automatically focusing most 12 cameras Download PDFInfo
- Publication number
- CN110568699A CN110568699A CN201910809676.8A CN201910809676A CN110568699A CN 110568699 A CN110568699 A CN 110568699A CN 201910809676 A CN201910809676 A CN 201910809676A CN 110568699 A CN110568699 A CN 110568699A
- Authority
- CN
- China
- Prior art keywords
- focusing
- lens
- personal computer
- controller
- industrial
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G03—PHOTOGRAPHY; CINEMATOGRAPHY; ANALOGOUS TECHNIQUES USING WAVES OTHER THAN OPTICAL WAVES; ELECTROGRAPHY; HOLOGRAPHY
- G03B—APPARATUS OR ARRANGEMENTS FOR TAKING PHOTOGRAPHS OR FOR PROJECTING OR VIEWING THEM; APPARATUS OR ARRANGEMENTS EMPLOYING ANALOGOUS TECHNIQUES USING WAVES OTHER THAN OPTICAL WAVES; ACCESSORIES THEREFOR
- G03B13/00—Viewfinders; Focusing aids for cameras; Means for focusing for cameras; Autofocus systems for cameras
- G03B13/32—Means for focusing
- G03B13/34—Power focusing
- G03B13/36—Autofocus systems
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N23/00—Cameras or camera modules comprising electronic image sensors; Control thereof
- H04N23/60—Control of cameras or camera modules
- H04N23/67—Focus control based on electronic image sensor signals
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Automatic Focus Adjustment (AREA)
- Studio Devices (AREA)
Abstract
The invention relates to the technical field of visual detection, in particular to a control method for automatic focusing of at most 12 cameras simultaneously; it comprises the following steps: s1, mounting a common lens on the industrial camera through an electric sliding table or mounting a liquid lens through a liquid lens controller; s2, the electric sliding table or the liquid lens controller is in signal connection with the automatic focusing controller, and the industrial camera is in signal connection with the industrial personal computer; s3 the automatic focusing controller interacts with the industrial personal computer through the industrial communication protocol; an industrial personal computer (S4) issues an instruction to enable an electric sliding table or a liquid lens controller to control the focus of the common lens or the liquid lens to move back and forth circularly; s5 the industrial camera feeds back image information to the industrial personal computer; the industrial personal computer of S6 judges whether the current lens is the best focusing position according to the automatic focusing algorithm, if so, the movement is stopped and a clear image is obtained, otherwise, the steps of S4-S6 are repeated until the best focusing position is obtained; the rapid completion of the visual detection is facilitated.
Description
Technical Field
The invention relates to the technical field of visual detection, in particular to a control method for automatic focusing of at most 12 cameras simultaneously.
background
In the production of some precision parts, visual inspection of multiple faces of the part using a visual camera is required. Because the product size is inconsistent, when equipment or production line switch different specification products, can produce a difficult point of present industry vision trade, the debugging camera lens degree of depth problem: at present, industrial products with multiple detection faces can only confirm the focusing condition of each face and adjust the working distance through engineers.
disclosure of Invention
Aiming at the defects of the prior art, the invention provides an industrial camera control method capable of automatically focusing multiple surfaces of a product.
The technical scheme of the invention is as follows:
a control method for automatic focusing of at most 12 cameras simultaneously is characterized by comprising the following steps: it comprises the following steps:
S1, mounting a common lens on the industrial camera through an electric sliding table or mounting a liquid lens through a liquid lens controller;
S2, the electric sliding table or the liquid lens controller is in signal connection with the automatic focusing controller, and the industrial camera is in signal connection with the industrial personal computer;
S3 the automatic focusing controller interacts with the industrial personal computer through the industrial communication protocol;
An industrial personal computer (S4) issues an instruction to enable an electric sliding table or a liquid lens controller to control the focus of the common lens or the liquid lens to move back and forth circularly;
S5 the industrial camera feeds back image information to the industrial personal computer;
And the industrial personal computer of S6 judges whether the current lens is the best focusing position according to the automatic focusing algorithm, if so, the movement is stopped and a clear image is obtained, otherwise, the steps of S4-S6 are repeated until the best focusing position is obtained.
in one embodiment, twelve electric sliding tables, twelve industrial cameras and twelve common lenses are arranged, one automatic focusing controller is arranged, and one industrial personal computer is arranged. This embodiment mainly employs an electric slide table for performing the position (i.e., focus) movement of the lens.
in one embodiment, twelve liquid lens controllers, twelve industrial cameras and twelve liquid lenses are provided, one automatic focusing controller and one industrial personal computer are provided. This embodiment mainly uses a liquid lens controller to perform the focus movement of the lens.
In one embodiment, the auto-focusing algorithm specifically includes the following steps:
acquiring an image with a fixed resolution of X Y, wherein the image is provided with X Y pixel points; x and Y are integers greater than 1; converting the RGB value of each pixel point into a brightness value M, wherein the conversion formula is M ═ ((R × 299) + (G × 587) + (B × 114))/1000; calculating the absolute value of the brightness difference between a pixel point and a transversely adjacent pixel point, calculating the absolute value of the brightness difference between the pixel point and a longitudinally adjacent pixel point, and calculating the sum of the absolute values of the brightness differences of all the pixel points on an image; the position where the sum value is maximum is the focusing position. That is, the industrial control machine calculates the sum of the absolute values of the brightness difference values in real time in the process that the electric sliding table drives the lens to move back and forth, and the focus position can be known after one cycle.
In one embodiment, the auto-focusing algorithm specifically includes the following steps:
S11: assigning the search boundary InitL and InitR of the movement of the focusing lens to L and R correspondingly, and obtaining the resolution f (L) and f (R) of the focusing module when the focusing lens is positioned at the search boundary; wherein, L and R are variables, and InitL and InitR are constants; f (x) is the resolution of the focusing module when the focusing lens is searched to the x position; x is a variable, and x is a value between InitL and InitR. L ═ InitL ═ 0.2A, R ═ InitR ═ 2A, f (L) ═ 0.07, and f (R) ═ 0.07.
S12: setting focusing points x1 and x2 of the focusing lens by a golden section method, wherein x1 is L + (1-tau) x (R-L), x2 is L + tau (R-L), and tau is 0.618, and acquiring f (x1) and f (x 2); wherein x1 and x2 are variables. x1 is 0.8696, x2 is 1.3124, f (x1) is 0.19, f (x2) is 0.15, and since f (x1) > f (x2), the operation proceeds to step S15.
S13: it is determined whether f (x1) is greater than f (x 2).
s14: when f (x1) < f (x2), L ═ x1, x1 ═ x2, and x2 ═ L + τ x (R-L), which respectively indicate that x1 is assigned to L, x2 is assigned to x1, and x2 is calculated using the reassigned L according to the golden section method.
S15: when f (x1) > f (x2), R is x2, x2 is x1, and x1 is L + (1- τ) x (R-L), which respectively indicate that x2 is assigned to R and x1 is assigned to x2, and x1 is calculated according to the golden section method using the re-assigned R. In this embodiment, R is 1.3124, x2 is 0.8696, and x1 is 0.6138.
S16: judging whether L is not equal to InitL and R is not equal to InitR; when L ≠ InitL and R ≠ InitR does not hold, it returns to step S13. Since the value of L does not change, L ≠ InitL and R ≠ InitR are not true, and it is necessary to return to S13 to compare the size between f (x1) and f (x2) when x1 ≠ 0.6138 and x2 ≠ 0.8696.
s17: when L ≠ InitL and R ≠ InitR are established, the corresponding focus L is acquired.
The invention has the beneficial effects that: and judging the clearest focusing surface of a plurality of surfaces of the product, if so, capturing the image, otherwise, automatically focusing, and carrying out omnibearing data acquisition and recording on the appearance of the product in a short time, so that the rapid visual detection is facilitated.
drawings
FIG. 1 is a schematic structural view of example 1 of the present invention;
Fig. 2 is a schematic structural diagram of embodiment 2 of the present invention.
Detailed Description
The following further describes embodiments of the present invention with reference to the accompanying drawings:
example 1
as shown in fig. 1, a method for controlling simultaneous auto-focusing of at most 12 cameras is characterized in that: it comprises the following steps:
S1, mounting a common lens on the industrial camera through an electric sliding table;
s2, the electric sliding table is in signal connection with an automatic focusing controller, and the industrial camera is in signal connection with an industrial personal computer;
s3 the automatic focusing controller interacts with the industrial personal computer through the industrial communication protocol;
an industrial personal computer (S4) issues an instruction to enable an electric sliding table to control the front and back circular movement of the focus of the common lens;
s5 the industrial camera feeds back image information to the industrial personal computer;
And the industrial personal computer of S6 judges whether the current lens is the best focusing position according to the automatic focusing algorithm, if so, the movement is stopped and a clear image is obtained, otherwise, the steps of S4-S6 are repeated until the best focusing position is obtained.
The automatic focusing device comprises an electric sliding table, an industrial camera and a common lens, wherein the electric sliding table, the industrial camera and the common lens are twelve in number, one automatic focusing controller is arranged, and one industrial personal computer is arranged. This embodiment mainly employs an electric slide table for performing the position (i.e., focus) movement of the lens.
The automatic focusing algorithm specifically comprises the following steps:
Acquiring an image with a fixed resolution of X Y, wherein the image is provided with X Y pixel points; x and Y are integers greater than 1; converting the RGB value of each pixel point into a brightness value M, wherein the conversion formula is M ═ ((R × 299) + (G × 587) + (B × 114))/1000; calculating the absolute value of the brightness difference between a pixel point and a transversely adjacent pixel point, calculating the absolute value of the brightness difference between the pixel point and a longitudinally adjacent pixel point, and calculating the sum of the absolute values of the brightness differences of all the pixel points on an image; the position where the sum value is maximum is the focusing position. That is, the industrial control machine calculates the sum of the absolute values of the brightness difference values in real time in the process that the electric sliding table drives the lens to move back and forth, and the focus position can be known after one cycle.
Example 2
a control method for automatic focusing of at most 12 cameras simultaneously is characterized by comprising the following steps: it comprises the following steps:
S1, mounting the industrial camera on a liquid lens through a liquid lens controller;
s2 the liquid lens controller is connected with the automatic focusing controller by signal, and the industrial camera is connected with the industrial personal computer by signal;
S3 the automatic focusing controller interacts with the industrial personal computer through the industrial communication protocol;
An industrial personal computer (S4) issues an instruction to enable a liquid lens controller to control the focus of the liquid lens to move back and forth circularly;
S5 the industrial camera feeds back image information to the industrial personal computer;
and the industrial personal computer of S6 judges whether the current lens is the best focusing position according to the automatic focusing algorithm, if so, the movement is stopped and a clear image is obtained, otherwise, the steps of S4-S6 are repeated until the best focusing position is obtained.
The automatic focusing system comprises a liquid lens controller, an industrial camera, a liquid lens, an automatic focusing controller and an industrial personal computer, wherein the liquid lens controller, the industrial camera and the liquid lens are twelve respectively, and the automatic focusing controller and the industrial personal computer are one. This embodiment mainly uses a liquid lens controller to perform the focus movement of the lens.
The automatic focusing algorithm specifically comprises the following steps:
S11: assigning the search boundary InitL and InitR of the movement of the focusing lens to L and R correspondingly, and obtaining the resolution f (L) and f (R) of the focusing module when the focusing lens is positioned at the search boundary; wherein, L and R are variables, and InitL and InitR are constants; f (x) is the resolution of the focusing module when the focusing lens is searched to the x position; x is a variable, and x is a value between InitL and InitR. L ═ InitL ═ 0.2A, R ═ InitR ═ 2A, f (L) ═ 0.07, and f (R) ═ 0.07.
S12: setting focusing points x1 and x2 of the focusing lens by a golden section method, wherein x1 is L + (1-tau) x (R-L), x2 is L + tau (R-L), and tau is 0.618, and acquiring f (x1) and f (x 2); wherein x1 and x2 are variables. x1 is 0.8696, x2 is 1.3124, f (x1) is 0.19, f (x2) is 0.15, and since f (x1) > f (x2), the operation proceeds to step S15.
s13: it is determined whether f (x1) is greater than f (x 2).
s14: when f (x1) < f (x2), L ═ x1, x1 ═ x2, and x2 ═ L + τ x (R-L), which respectively indicate that x1 is assigned to L, x2 is assigned to x1, and x2 is calculated using the reassigned L according to the golden section method.
s15: when f (x1) > f (x2), R is x2, x2 is x1, and x1 is L + (1- τ) x (R-L), which respectively indicate that x2 is assigned to R and x1 is assigned to x2, and x1 is calculated according to the golden section method using the re-assigned R. In this embodiment, R is 1.3124, x2 is 0.8696, and x1 is 0.6138.
s16: judging whether L is not equal to InitL and R is not equal to InitR; when L ≠ InitL and R ≠ InitR does not hold, it returns to step S13. Since the value of L does not change, L ≠ InitL and R ≠ InitR are not true, and it is necessary to return to S13 to compare the size between f (x1) and f (x2) when x1 ≠ 0.6138 and x2 ≠ 0.8696.
S17: when L ≠ InitL and R ≠ InitR are established, the corresponding focus L is acquired.
The foregoing embodiments and description have been presented only to illustrate the principles and preferred embodiments of the invention, and various changes and modifications may be made therein without departing from the spirit and scope of the invention as hereinafter claimed.
Claims (5)
1. a control method for automatic focusing of at most 12 cameras simultaneously is characterized by comprising the following steps: it comprises the following steps:
S1, mounting a common lens on the industrial camera through an electric sliding table or mounting a liquid lens through a liquid lens controller;
S2, the electric sliding table or the liquid lens controller is in signal connection with the automatic focusing controller, and the industrial camera is in signal connection with the industrial personal computer;
s3 the automatic focusing controller interacts with the industrial personal computer through the industrial communication protocol;
An industrial personal computer (S4) issues an instruction to enable an electric sliding table or a liquid lens controller to control the focus of the common lens or the liquid lens to move back and forth circularly;
s5 the industrial camera feeds back image information to the industrial personal computer;
and the industrial personal computer of S6 judges whether the current lens is the best focusing position according to the automatic focusing algorithm, if so, the movement is stopped and a clear image is obtained, otherwise, the steps of S4-S6 are repeated until the best focusing position is obtained.
2. the method of claim 1, wherein the method further comprises: the automatic focusing device comprises an electric sliding table, an industrial camera and a common lens, wherein the electric sliding table, the industrial camera and the common lens are twelve in number, one automatic focusing controller is arranged, and one industrial personal computer is arranged.
3. The method of claim 1, wherein the method further comprises: the automatic focusing system comprises a liquid lens controller, an industrial camera, a liquid lens, an automatic focusing controller and an industrial personal computer, wherein the liquid lens controller, the industrial camera and the liquid lens are twelve respectively, and the automatic focusing controller and the industrial personal computer are one.
4. The method of claim 1, wherein the method further comprises: the automatic focusing algorithm specifically comprises the following steps:
Acquiring an image with a fixed resolution of X Y, wherein the image is provided with X Y pixel points; x and Y are integers greater than 1; converting the RGB value of each pixel point into a brightness value M, wherein the conversion formula is M ═ ((R × 299) + (G × 587) + (B × 114))/1000; calculating the absolute value of the brightness difference between a pixel point and a transversely adjacent pixel point, calculating the absolute value of the brightness difference between the pixel point and a longitudinally adjacent pixel point, and calculating the sum of the absolute values of the brightness differences of all the pixel points on an image; the position where the sum value is maximum is the focusing position. That is, the industrial control machine calculates the sum of the absolute values of the brightness difference values in real time in the process that the electric sliding table drives the lens to move back and forth, and the focus position can be known after one cycle.
5. The method of claim 1, wherein the method further comprises: the automatic focusing algorithm specifically comprises the following steps:
S11: assigning the search boundary InitL and InitR of the movement of the focusing lens to L and R correspondingly, and obtaining the resolution f (L) and f (R) of the focusing module when the focusing lens is positioned at the search boundary; wherein, L and R are variables, and InitL and InitR are constants; f (x) is the resolution of the focusing module when the focusing lens is searched to the x position; x is a variable, and x is a value between InitL and InitR. L ═ InitL ═ 0.2A, R ═ InitR ═ 2A, f (L) ═ 0.07, and f (R) ═ 0.07.
S12: setting focusing points x1 and x2 of the focusing lens by a golden section method, wherein x1 is L + (1-tau) x (R-L), x2 is L + tau (R-L), and tau is 0.618, and acquiring f (x1) and f (x 2); wherein x1 and x2 are variables. x1 is 0.8696, x2 is 1.3124, f (x1) is 0.19, f (x2) is 0.15, and since f (x1) > f (x2), the operation proceeds to step S15.
s13: it is determined whether f (x1) is greater than f (x 2).
s14: when f (x1) < f (x2), L ═ x1, x1 ═ x2, and x2 ═ L + τ x (R-L), which respectively indicate that x1 is assigned to L, x2 is assigned to x1, and x2 is calculated using the reassigned L according to the golden section method.
S15: when f (x1) > f (x2), R is x2, x2 is x1, and x1 is L + (1- τ) x (R-L), which respectively indicate that x2 is assigned to R and x1 is assigned to x2, and x1 is calculated according to the golden section method using the re-assigned R. In this embodiment, R is 1.3124, x2 is 0.8696, and x1 is 0.6138.
S16: judging whether L is not equal to InitL and R is not equal to InitR; when L ≠ InitL and R ≠ InitR does not hold, it returns to step S13. Since the value of L does not change, L ≠ InitL and R ≠ InitR are not true, and it is necessary to return to S13 to compare the size between f (x1) and f (x2) when x1 ≠ 0.6138 and x2 ≠ 0.8696.
s17: when L ≠ InitL and R ≠ InitR are established, the corresponding focus L is acquired.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910809676.8A CN110568699A (en) | 2019-08-29 | 2019-08-29 | control method for simultaneously automatically focusing most 12 cameras |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910809676.8A CN110568699A (en) | 2019-08-29 | 2019-08-29 | control method for simultaneously automatically focusing most 12 cameras |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110568699A true CN110568699A (en) | 2019-12-13 |
Family
ID=68776879
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910809676.8A Pending CN110568699A (en) | 2019-08-29 | 2019-08-29 | control method for simultaneously automatically focusing most 12 cameras |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110568699A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111654637A (en) * | 2020-07-14 | 2020-09-11 | RealMe重庆移动通信有限公司 | Focusing method, focusing device and terminal equipment |
CN114095628A (en) * | 2021-10-13 | 2022-02-25 | 上海孟非自动化科技有限公司 | Automatic focusing algorithm, automatic focusing visual device and control method thereof |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5040228A (en) * | 1989-08-28 | 1991-08-13 | At&T Bell Laboratories | Method and apparatus for automatically focusing an image-acquisition device |
CN101359151A (en) * | 2007-05-18 | 2009-02-04 | 卡西欧计算机株式会社 | Image device and focus control method |
CN105527778A (en) * | 2016-01-16 | 2016-04-27 | 上海大学 | Automatic focusing method for electric adjustable liquid lens |
CN109716746A (en) * | 2016-09-13 | 2019-05-03 | Lg伊诺特有限公司 | Double camera module, Optical devices, camera model and the method for operating camera model |
-
2019
- 2019-08-29 CN CN201910809676.8A patent/CN110568699A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5040228A (en) * | 1989-08-28 | 1991-08-13 | At&T Bell Laboratories | Method and apparatus for automatically focusing an image-acquisition device |
CN101359151A (en) * | 2007-05-18 | 2009-02-04 | 卡西欧计算机株式会社 | Image device and focus control method |
CN105527778A (en) * | 2016-01-16 | 2016-04-27 | 上海大学 | Automatic focusing method for electric adjustable liquid lens |
CN109716746A (en) * | 2016-09-13 | 2019-05-03 | Lg伊诺特有限公司 | Double camera module, Optical devices, camera model and the method for operating camera model |
Non-Patent Citations (2)
Title |
---|
张秋梅: "数码相机自动对焦算法的研究与实现", 《西北工业大学硕士学位论文》 * |
王烨茹: "基于数字图像处理的自动对焦方法研究", 《浙江大学博士学位论文》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111654637A (en) * | 2020-07-14 | 2020-09-11 | RealMe重庆移动通信有限公司 | Focusing method, focusing device and terminal equipment |
CN111654637B (en) * | 2020-07-14 | 2021-10-22 | RealMe重庆移动通信有限公司 | Focusing method, focusing device and terminal equipment |
CN114095628A (en) * | 2021-10-13 | 2022-02-25 | 上海孟非自动化科技有限公司 | Automatic focusing algorithm, automatic focusing visual device and control method thereof |
CN114095628B (en) * | 2021-10-13 | 2023-07-07 | 上海孟非自动化科技有限公司 | Automatic focusing method, automatic focusing visual device and control method thereof |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20240118218A1 (en) | Stroboscopic stepped illumination defect detection system | |
US10112301B2 (en) | Automatic calibration method for robot systems using a vision sensor | |
EP3029930B1 (en) | Vision measuring device with auto-focusing control | |
US7499584B2 (en) | Smear-limit based system and method for controlling vision systems for consistently accurate and high-speed inspection | |
CN103257510B (en) | A kind of fast automatic focus adjustment method | |
KR20080047901A (en) | Apparatus and method for ordering images in stereo camera device | |
CN104551865A (en) | Image measuring system and method | |
JP2012032344A (en) | Picture measuring device, picture measuring method and program for picture measuring device | |
CN110568699A (en) | control method for simultaneously automatically focusing most 12 cameras | |
CN109916914B (en) | Product defect detection method and device | |
CN110433989B (en) | Workpiece surface spraying method | |
CN106125246A (en) | A kind of from the method seeking laser focal plane | |
JP2019168520A (en) | Information processing device, information processing method, program, and image measuring device | |
CN106019550A (en) | High speed micro scanning dynamic focusing device and focusing tracking method | |
CN104677912A (en) | Product appearance detection system and method | |
CN110640303B (en) | High-precision vision positioning system and positioning calibration method thereof | |
US11249225B2 (en) | Tunable acoustic gradient lens system utilizing amplitude adjustments for acquiring images focused at different z-heights | |
CN111486790A (en) | Full-size detection method and device for battery | |
CN112378797A (en) | Full-automatic indentation measuring device and method | |
KR100926272B1 (en) | Method of the auto calibration for the laser vision system using X-Y stage | |
CN110838107B (en) | Method and device for intelligently detecting defects of 3C transparent component by variable-angle optical video | |
US10055849B2 (en) | Image measurement device and controlling method of the same | |
CN208623750U (en) | Intelligent industrial camera | |
CN107796306B (en) | Quadratic element measuring instrument and measuring method | |
CN107478206B (en) | Device and method suitable for large scene measurement |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20191213 |