Camera self-test method, system, device, and medium for testing equipment
By using adaptive brightness adjustment algorithm and clarity calculation method in the slide rail grey cloth detection equipment, the camera parameters are automatically adjusted and evaluated, and the problems of cumbersome debugging and lack of performance evaluation are solved, and higher installation accuracy and fly-shooting performance are achieved.
Patent Information
- Application Number
- CN202310362722.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-06
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2043-04-06
AI Technical Summary
Existing slide rail grey cloth detection equipment is complicated and easy to miss or make mistakes when debugging cameras. Exposure or gain adjustment relies on manual subjective judgment, the slide rail installation accuracy lacks effective monitoring, and the flying shooting performance lacks quantitative evaluation methods.
The image is adjusted by adaptive brightness adjustment algorithm. By stepping and shooting images, the stepping shooting clarity is calculated and compared to determine the installation accuracy of the motion module; when moving at a constant speed, the motion shooting clarity is calculated, the camera parameters conformity is evaluated, and the speed is increased through increments to detect the fastest flying shooting speed.
It realizes automatic adjustment and quantitative evaluation of camera parameters, improves the installation accuracy and flying shooting performance of the detection equipment, and reduces manual intervention and error occurrence.
Smart Images

Figure CN116389715B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of industrial detection technology, and more specifically, to a camera self-detection method, system, device, and medium for detecting equipment. Background Art
[0002] In recent years, with the development of industrial technology, the quality of industrial products has received more and more attention. The quality inspection process based on human eyes is subjective and lagging, and cannot adapt to many harsh production environments. Industrial defect detection equipment based on computer vision technology is becoming more and more widely used. The image acquisition module is the main device for data acquisition of the equipment, and its imaging capability directly affects the detection capability of the entire equipment. Therefore, the debugging of the image acquisition module is very important.
[0003] The quality inspection of grey fabric textiles is still at the stage of relying on the human eye to distinguish, and the demand for industrial defect detection equipment based on computer vision technology is particularly urgent. At present, grey fabric inspection equipment is divided into several types according to different shooting methods, such as matrix array cameras, slide rail array cameras and line array cameras. Existing slide rail grey fabric inspection equipment generally uses the following method to debug the camera: the first step is to fix the motion module in a certain position, place the focus plate on the inspection cloth surface, adjust the lens until the focus is successful, and then use the white balance plate to adjust the camera white balance, exposure time, gain and other parameters; the second step is to move the motion module to as many positions as possible and shoot the focus plate at the same time; the third step is to detect the consistency of these images respectively to determine whether the camera system status has met the requirements. Among them, the motion module includes: a camera and a driving mechanism for driving the camera to move on the slide rail.
[0004] There are several problems. First, multiple focus plates or multiple manual placements are required for multiple shooting in the second step. The process is cumbersome, easy to miss and error-prone. Second, exposure or gain adjustment relies on manual subjective judgment and is not quantified. Third, the installation accuracy of the slide rail that affects shooting can only be measured by a ruler, and there is no effective monitoring method. Finally, there is no effective quantitative evaluation method to determine whether the flying performance of the entire image acquisition module meets the standards. Summary of the invention
[0005] In view of the deficiencies in the prior art, an object of the present invention is to provide a camera self-test method, system, device, and medium for testing equipment to solve at least one of the problems raised in the background technology.
[0006] The above technical objectives of the present invention are achieved through the following technical solutions: A camera self-test method for testing equipment, comprising:
[0007] S1, fix the motion module, adjust and lock the lens of the motion module;
[0008] S2, using an adaptive brightness adjustment algorithm to adjust the image captured by the motion module;
[0009] S3, controlling the motion module to move step by step according to a preset step distance, and controlling the motion module to capture an image each time it stops, to obtain a plurality of step-by-step captured images;
[0010] S4, calculating a step-shooting clarity set according to all the step-shooting images, comparing the step-shooting clarity set with a preset step-shooting clarity threshold, if all the step-shooting clarity in the step-shooting clarity set are greater than the preset step-shooting clarity threshold, outputting information that the installation accuracy of the motion module meets the requirements, and executing the next step; if there is a step-shooting clarity less than the preset step-shooting clarity threshold in the step-shooting clarity set, outputting information that the installation accuracy of the motion module does not meet the requirements, and stopping;
[0011] S5, controlling the motion module to move at a preset speed at a uniform speed, and controlling the motion module to capture images at multiple preset sampling points to obtain a plurality of motion captured images;
[0012] S6. Calculate the motion shooting clarity of all motion shooting images to obtain a corresponding motion shooting clarity set; compare the motion shooting clarity set with a preset motion clarity threshold, and if all motion shooting clarity in the motion shooting clarity set is greater than the preset motion clarity threshold, output information indicating that the shooting clarity of the motion module meets the requirement.
[0013] Optionally, the adjusting and locking the lens of the motion module includes:
[0014] S11, adjusting and locking the focal length of the lens of the motion module through a focusing plate;
[0015] S12, adjusting and locking the lens aperture of the motion module according to the light source conditions at the production site;
[0016] S13, adjusting and locking the lens white balance of the motion module through a white balance board.
[0017] Optionally, the step of using an adaptive brightness adjustment algorithm to adjust the image captured by the motion module includes:
[0018] S21, obtaining a real-time captured image of the motion module;
[0019] S22, setting an anchor point value K according to the gap between the blank wiring and the blank wiring in the real-time captured image;
[0020] S23, selecting a corresponding preset binarization method and a preset binarization threshold according to the color of the grey cloth;
[0021] S24, adjusting the exposure time and shooting gain of the motion module; binarizing the real-time captured image according to the preset binarization method and the preset binarization threshold to obtain a corresponding binarized image;
[0022] S25. Calculate the ratio S of the bright part in the binary image to the whole image. If the difference between the ratio S and the anchor point value K is less than or equal to the preset difference, fix the exposure time and shooting gain of the motion module. If the difference between the ratio S and the anchor point value K is greater than the preset difference, return to step S24.
[0023] Optionally, setting the anchor point value K according to the gap between the blank wirings in the real-time captured image includes:
[0024] K = a / (a+b);
[0025] Wherein, a is the number of pixels of the blank wiring in a unit area in the real-time captured image, and b is the number of pixels of the gaps between the blank wirings in a unit area in the real-time captured image.
[0026] Optionally, the stepping-shooting definition set is calculated according to all the stepping-shooting images, including:
[0027] S41, dividing all the step-by-step captured images into a nine-square grid to obtain corresponding nine-square grid captured images;
[0028] S42, calculating the clarity of each grid image of each nine-grid image by using a Tenengrad function to obtain the shooting clarity corresponding to each grid image of each nine-grid image;
[0029] S43, removing outliers from all the shooting sharpness of each nine-grid shot image and then taking the average to obtain the step-by-step shooting sharpness of each nine-grid shot image;
[0030] S44, the step-by-step shooting definition of each nine-grid shot image is aggregated to obtain a step-by-step shooting definition set.
[0031] Optionally, the calculating the definition of each grid image of each nine-grid image by using a Tenengrad function includes:
[0032] S421. Set the convolution kernel of the Sobel operator:
[0033] S422, the horizontal gradient value of each grid image of each nine-grid captured image is: f x (x,y)=f(x,y)*K x; The vertical gradient value of each grid image of each nine-grid image: f y (x,y)=f(x,y)*K y ;
[0034] S423, calculating the clarity value of each grid image of each nine-grid captured image according to the horizontal gradient value and the vertical gradient value of each grid image of each nine-grid captured image: s=
[0035]
[0036] Optionally, after outputting the information that the shooting definition of the motion module meets the requirement, the method further includes:
[0037] S7, increasing the preset speed by a preset increment to obtain an incremental speed;
[0038] S8, controlling the motion module to move at a uniform speed at the incremental speed, and controlling the motion module to capture images at multiple preset sampling points to obtain a plurality of incremental motion captured images;
[0039] S9, calculating the motion shooting clarity of all incremental motion shooting images to obtain a corresponding incremental motion shooting clarity set; comparing the incremental motion shooting clarity set with a preset motion clarity threshold, if all incremental motion shooting clarity in the incremental motion shooting clarity set are greater than the preset motion clarity threshold, returning to step S7; if there is an incremental motion shooting clarity in the incremental motion shooting clarity set that is less than the preset motion clarity threshold, subtracting the preset increment from the incremental speed to obtain the fastest flying speed.
[0040] A camera self-test system for testing equipment includes: a camera adjustment module, which is used to fix a motion module, adjust and lock the lens of the motion module;
[0041] An image adjustment module, used to adjust the image captured by the motion module using an adaptive brightness adjustment algorithm;
[0042] A stepping shooting module is used to control the motion module to move step by step according to a preset stepping distance, and to control the motion module to shoot an image each time it stops, so as to obtain a plurality of stepping shooting images;
[0043] an accuracy judgment module, for calculating a step-shooting clarity set according to all the step-shooting images, and comparing the step-shooting clarity set with a preset step-shooting clarity threshold; if all the step-shooting clarity in the step-shooting clarity set are greater than the preset step-shooting clarity threshold, then outputting information that the installation accuracy of the motion module meets the requirements, and executing the next step; if there is a step-shooting clarity less than the preset step-shooting clarity threshold in the step-shooting clarity set, then outputting information that the installation accuracy of the motion module does not meet the requirements, and stopping;
[0044] A uniform speed shooting module, used to control the motion module to move at a preset speed and to control the motion module to shoot images at a plurality of preset sampling points to obtain a plurality of motion shooting images;
[0045] The clarity judgment module is used to calculate the motion shooting clarity of all motion shooting images to obtain a corresponding motion shooting clarity set; compare the motion shooting clarity set with a preset motion clarity threshold, and if all motion shooting clarity in the motion shooting clarity set is greater than the preset motion clarity threshold, output information that the shooting clarity of the motion module meets the requirements.
[0046] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0047] A computer-readable storage medium stores a computer program, which implements the steps of the above method when executed by a processor.
[0048] In summary, the present invention has the following beneficial effects: first, the basic parameters of the camera, such as focal length, aperture, white balance, etc., are adjusted so that the camera can clearly capture the blank wiring and the corresponding gap on the blank cloth; then, the image captured by the camera is adjusted so that the overall brightness of the image captured by the camera is distributed in a reasonable range, so that the light and dark features of the camera can be retained to a large extent; then, the motion module is controlled to perform step-by-step motion, and a step-by-step shooting image is obtained when the camera is stationary; the installation accuracy of the motion module is quantified according to the step-by-step shooting clarity of the step-by-step shooting image, and it is determined whether the installation accuracy of the motion module meets the system requirements; after the installation accuracy of the motion module meets the system requirements, the motion module is controlled to move at a uniform speed at a preset speed, and the camera is shot at the moment of passing the corresponding sampling point to obtain a motion shooting image; according to the motion shooting clarity of the motion shooting image, it can be determined whether the parameters set by the camera meet the system requirements; and on the premise that the parameters set by the camera meet the system requirements, the preset speed can be increased by a preset increment to detect the fastest flying shooting speed that the camera can adapt to under the parameters, thereby quantifying the performance of the camera. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 It is a schematic diagram of the process of the present invention;
[0050] Figure 2 It is a structural block diagram of the present invention when assembled;
[0051] Figure 3 1 is a diagram showing the internal structure of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION
[0052] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings. Several embodiments of the present invention are shown in the accompanying drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein.
[0053] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal connection of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances. The terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.
[0054] In the present invention, unless otherwise clearly specified and limited, the first feature being "above" or "below" the second feature may include the first and second features being in direct contact, or may include the first and second features being in contact not directly but through another feature between them. Moreover, the first feature being "above", "above" and "above" the second feature includes the first feature being directly above and obliquely above the second feature, or simply indicates that the first feature is higher in level than the second feature. The first feature being "below", "below" and "below" the second feature includes the first feature being directly below and obliquely below the second feature, or simply indicates that the first feature is lower in level than the second feature. The terms "vertical", "horizontal", "left", "right", "above", "below" and similar expressions are for illustrative purposes only, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as limiting the present invention.
[0055] The present invention is described in detail below in conjunction with the accompanying drawings and embodiments.
[0056] The present invention provides a camera self-test method for testing equipment, such as Figure 1 As shown, including:
[0057] S1, fix the motion module, adjust and lock the lens of the motion module;
[0058] S2, using an adaptive brightness adjustment algorithm to adjust the image captured by the motion module;
[0059] S3, controlling the motion module to move step by step according to a preset step distance, and controlling the motion module to capture an image each time it stops, to obtain a plurality of step-by-step captured images;
[0060] S4, calculating a step-shooting clarity set according to all the step-shooting images, comparing the step-shooting clarity set with a preset step-shooting clarity threshold, if all the step-shooting clarity in the step-shooting clarity set are greater than the preset step-shooting clarity threshold, outputting information that the installation accuracy of the motion module meets the requirements, and executing the next step; if there is a step-shooting clarity less than the preset step-shooting clarity threshold in the step-shooting clarity set, outputting information that the installation accuracy of the motion module does not meet the requirements, and stopping;
[0061] S5, controlling the motion module to move at a preset speed at a uniform speed, and controlling the motion module to capture images at multiple preset sampling points to obtain a plurality of motion captured images;
[0062] S6. Calculate the motion shooting clarity of all motion shooting images to obtain a corresponding motion shooting clarity set; compare the motion shooting clarity set with a preset motion clarity threshold, and if all motion shooting clarity in the motion shooting clarity set is greater than the preset motion clarity threshold, output information indicating that the shooting clarity of the motion module meets the requirement.
[0063] In practical applications, since the on-site lighting conditions at the installation locations of various motion modules are different, it is first necessary to adjust the camera lens so that the camera can clearly capture the grey wiring on the grey cloth and the gaps between the grey wiring, and lock the camera lens after the adjustment; then, an adaptive brightness adjustment algorithm is used to adjust the image captured by the camera so that the overall brightness of the image is distributed within a reasonable range, ensuring that the light and dark features in the image can be retained to a large extent; then the motion module is controlled to move in steps, and an image is captured each time it is stationary and the step-by-step shooting clarity of the image is calculated. Through step-by-step moving shooting, the step-by-step shooting clarity of each image can be compared. If the installation accuracy of the motion module meets the standard, the step-by-step shooting clarity of each image will not differ much, and can all be greater than the preset step-by-step shooting clarity. Clarity threshold, if the installation accuracy of the motion module does not meet the standard, there will inevitably be differences in the step-by-step shooting clarity of each image, and there must be at least one step-by-step shooting clarity that is less than the preset step-by-step clarity threshold; the installation accuracy is related to whether the slide rail and the cloth surface are relatively parallel; in this way, the installation accuracy of the motion module is quantified; subsequently, since in the actual production process, the motion module is generally controlled to perform uniform flying shooting, it is necessary to control the motion module to perform uniform movement at a preset speed and shoot at each preset sampling point. The preset sampling points are generally selected at equidistant intervals of 10 cm; by calculating the motion shooting clarity and comparing the motion shooting clarity with the preset motion clarity threshold, it is possible to determine whether the image quality of the motion module during flying shooting meets the recognition requirements, thereby quantifying the shooting performance of the motion module.
[0064] Furthermore, the adjusting and locking of the lens of the motion module includes:
[0065] S11, adjusting and locking the focal length of the lens of the motion module through a focusing plate;
[0066] S12, adjusting and locking the lens aperture of the motion module according to the light source conditions at the production site;
[0067] S13, adjusting and locking the lens white balance of the motion module through a white balance board.
[0068] In practical applications, the focal length of the camera lens is first adjusted with the help of a focusing board to make the focal length of the camera consistent with the distance between the camera and the cloth, and the focal length of the lens is locked. Then, the lens aperture is adjusted according to the light source conditions on site so that the light received by the lens can fully capture the various features of the grey cloth. Then, for a color camera, the white balance parameters of the camera are adjusted with the help of a white balance board so that the colors captured by the camera meet the standards.
[0069] Optionally, the step of using an adaptive brightness adjustment algorithm to adjust the image captured by the motion module includes:
[0070] S21, obtaining a real-time captured image of the motion module;
[0071] S22, setting an anchor point value K according to the gap between the blank wiring and the blank wiring in the real-time captured image;
[0072] S23, selecting a corresponding preset binarization method and a preset binarization threshold according to the color of the grey cloth;
[0073] S24, adjusting the exposure time and shooting gain of the motion module; binarizing the real-time captured image according to the preset binarization method and the preset binarization threshold to obtain a corresponding binarized image;
[0074] S25. Calculate the ratio S of the bright part in the binary image to the whole image. If the difference between the ratio S and the anchor point value K is less than or equal to the preset difference, fix the exposure time and shooting gain of the motion module. If the difference between the ratio S and the anchor point value K is greater than the preset difference, return to step S24.
[0075] In practical applications, based on the motion module adjusted in step S1, the real-time image captured by the motion module at this time needs to clearly reflect the gap between the blank wiring used for textile grey cloth and the adjacent blank wiring in the grey cloth. Subsequently, the corresponding anchor point value K is set according to the blank wiring and the gap between the adjacent blank wiring, and then the corresponding binarization method and binarization threshold are selected according to the extension of the grey cloth. If the imaging color of the blank wiring is white and the gap is black, global binarization is performed, and the binarization threshold is set to 0.8; if the forming color of the blank wiring is black and the gap is white, global binarization is performed and then inverted, and the binarization threshold is set to 0.2; then the exposure time and gain of the camera are adjusted so that the proportion of the bright part in the binarized image to the whole image S-anchor value K is less than or equal to the preset difference, wherein the preset difference is usually 0.05, so that the overall brightness distribution is within a reasonable range, and both light and dark features can be retained to a large extent.
[0076] Optionally, setting the anchor point value K according to the gap between the blank wirings in the real-time captured image includes:
[0077] K = a / (a+b);
[0078] Wherein, a is the number of pixels of the blank wiring in a unit area in the real-time captured image, and b is the number of pixels of the gaps between the blank wirings in a unit area in the real-time captured image.
[0079] In practical applications, the unit area can be a rectangular area or a 1*n area in the latitudinal direction.
[0080] Further, the stepping-shooting definition set is calculated according to all the stepping-shooting images, including:
[0081] S41, dividing all the step-by-step captured images into a nine-square grid to obtain corresponding nine-square grid captured images;
[0082] S42, calculating the clarity of each grid image of each nine-grid image by using a Tenengrad function to obtain the shooting clarity corresponding to each grid image of each nine-grid image;
[0083] S43, removing outliers from all the shooting sharpness of each nine-grid shot image and then taking the average to obtain the step-by-step shooting sharpness of each nine-grid shot image;
[0084] S44, the step-by-step shooting definition of each nine-grid shot image is aggregated to obtain a step-by-step shooting definition set.
[0085] In practical applications, in order to avoid background influence, the whole image is divided into 3*3 nine-square grids for step-by-step shooting clarity calculation. The set of step-by-step shooting clarity of all step-by-step shooting images is taken as the step-by-step shooting clarity set. This set needs to meet two conditions to prove that the installation accuracy of the whole machine meets the standard: ① The minimum value in the step-by-step shooting clarity set is greater than a certain threshold to ensure that the image at the worst shooting position meets the quality requirements; ② The variance of the step-by-step shooting clarity set is less than a certain threshold to avoid excessive differences in the clarity of the captured images. This threshold is related to the depth of field of the lens and the parallelism between the track and the cloth surface. The greater the depth of field, the lower the parallelism requirement between the track and the cloth surface, and the greater the threshold. This step aims to measure whether the installation accuracy of the overall system meets the depth of field requirements of the camera. The installation accuracy may include whether the slide rail and the cloth surface are relatively parallel.
[0086] Furthermore, the definition calculation of each grid image of each nine-grid image is performed by using the Tenengrad function, including:
[0087] S421. Set the convolution kernel of the Sobel operator:
[0088] S422, the horizontal gradient value of each grid image of each nine-grid captured image is: f x (x,y)=f(x,y)*K x ; The vertical gradient value of each grid image of each nine-grid image: f y (x,y)=f(x,y)*K y ;
[0089] S423, calculating the clarity value of each grid image of each nine-grid image according to the horizontal gradient value and the vertical gradient value of each grid image of each nine-grid image:
[0090] Furthermore, after outputting the information that the shooting definition of the motion module meets the requirement, the method further includes:
[0091] S7, increasing the preset speed by a preset increment to obtain an incremental speed;
[0092] S8, controlling the motion module to move at a uniform speed at the incremental speed, and controlling the motion module to capture images at multiple preset sampling points to obtain a plurality of incremental motion captured images;
[0093] S9, calculating the motion shooting clarity of all incremental motion shooting images to obtain a corresponding incremental motion shooting clarity set; comparing the incremental motion shooting clarity set with a preset motion clarity threshold, if all incremental motion shooting clarity in the incremental motion shooting clarity set are greater than the preset motion clarity threshold, returning to step S7; if there is an incremental motion shooting clarity in the incremental motion shooting clarity set that is less than the preset motion clarity threshold, subtracting the preset increment from the incremental speed to obtain the fastest flying speed.
[0094] In practical applications, in order to verify that the camera parameters meet the system recognition requirements, the fastest flying speed that the camera can adapt to under the parameters is detected, and the preset speed is increased by a preset increment to obtain an incremental motion shooting image shot at a higher speed, and the motion shooting clarity of the incremental motion shooting image is compared with the preset motion clarity threshold. If all the incremental motion shooting clarity in the incremental motion shooting clarity set is greater than the preset motion clarity threshold, it means that the clarity of the incremental motion shooting image shot at the current incremental speed can meet the system requirements. Therefore, the preset speed can be increased again and repeated until there is an incremental motion shooting clarity in the incremental motion shooting clarity set that is less than the preset motion clarity threshold, indicating that shooting at this incremental speed cannot meet the system requirements. Therefore, the incremental speed minus the preset increment is the fastest flying speed that the camera can adapt to under the parameters, thereby quantifying the camera's shooting performance. Among them, the camera parameters include lens aperture size, camera exposure time, etc.
[0095] Through the above technical scheme, the basic parameters of the camera, such as focal length, aperture, white balance, etc., are first adjusted so that the camera can clearly capture the grey wiring and the corresponding gaps on the grey cloth. Subsequently, the image captured by the camera is adjusted so that the overall brightness of the image captured by the camera is distributed in a reasonable range, so that the light and dark features of the camera can be retained to a large extent. Then, the motion module is controlled to perform step-by-step motion, and a step-by-step shooting image is obtained when the camera is stationary. The installation accuracy of the motion module is quantified according to the step-by-step shooting clarity of the step-by-step shooting image, and it is determined whether the installation accuracy of the motion module meets the system requirements. After the installation accuracy of the motion module meets the system requirements, the motion module is controlled to move at a uniform speed at a preset speed, and the camera is shot at the moment of passing the corresponding sampling point to obtain a motion shooting image. According to the motion shooting clarity of the motion shooting image, it can be determined whether the parameters set by the camera meet the system requirements. On the premise that the parameters set by the camera meet the system requirements, the preset speed can be increased by a preset increment to detect the fastest flying shooting speed that the camera can adapt to under the parameters, thereby quantifying the performance of the camera.
[0096] like Figure 2 As shown, the present invention also provides a camera self-test system for testing equipment, comprising: a camera adjustment module 10, used to fix the motion module, adjust and lock the lens of the motion module;
[0097] An image adjustment module 20, used to adjust the image captured by the motion module using an adaptive brightness adjustment algorithm;
[0098] The stepping shooting module 30 is used to control the motion module to move step by step according to a preset stepping distance, and to control the motion module to shoot an image each time it stops, so as to obtain a plurality of stepping shooting images;
[0099] The accuracy judgment module 40 is used to calculate a step-shooting clarity set according to all the step-shooting images, and compare the step-shooting clarity set with a preset step-shooting clarity threshold. If all the step-shooting clarity in the step-shooting clarity set are greater than the preset step-shooting clarity threshold, the information that the installation accuracy of the motion module meets the requirements is output, and the next step is executed; if there is a step-shooting clarity less than the preset step-shooting clarity threshold in the step-shooting clarity set, the information that the installation accuracy of the motion module does not meet the requirements is output, and the process stops.
[0100] A uniform speed shooting module 50 is used to control the motion module to move at a preset speed and to control the motion module to shoot images at a plurality of preset sampling points to obtain a plurality of motion shooting images;
[0101] The clarity judgment module 60 is used to calculate the motion shooting clarity of all motion shooting images to obtain a corresponding motion shooting clarity set; compare the motion shooting clarity set with a preset motion clarity threshold, and if all motion shooting clarity in the motion shooting clarity set is greater than the preset motion clarity threshold, output information that the shooting clarity of the motion module meets the requirements.
[0102] The specific definition of a camera self-test system for detecting equipment can be found in the above definition of a camera self-test method for detecting equipment, which will not be repeated here. Each module in the above-mentioned camera self-test system for detecting equipment can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0103] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. When the computer program is executed by the processor, a camera self-test method for detecting a device is implemented.
[0104] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0105] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: S1, fixing a motion module, adjusting and locking a lens of the motion module;
[0106] S2, using an adaptive brightness adjustment algorithm to adjust the image captured by the motion module;
[0107] S3, controlling the motion module to move step by step according to a preset step distance, and controlling the motion module to capture an image each time it stops, to obtain a plurality of step-by-step captured images;
[0108] S4, calculating a step-shooting clarity set according to all the step-shooting images, comparing the step-shooting clarity set with a preset step-shooting clarity threshold, if all the step-shooting clarity in the step-shooting clarity set are greater than the preset step-shooting clarity threshold, outputting information that the installation accuracy of the motion module meets the requirements, and executing the next step; if there is a step-shooting clarity less than the preset step-shooting clarity threshold in the step-shooting clarity set, outputting information that the installation accuracy of the motion module does not meet the requirements, and stopping;
[0109] S5, controlling the motion module to move at a preset speed at a uniform speed, and controlling the motion module to capture images at multiple preset sampling points to obtain a plurality of motion captured images;
[0110] S6. Calculate the motion shooting clarity of all motion shooting images to obtain a corresponding motion shooting clarity set; compare the motion shooting clarity set with a preset motion clarity threshold, and if all motion shooting clarity in the motion shooting clarity set is greater than the preset motion clarity threshold, output information indicating that the shooting clarity of the motion module meets the requirement.
[0111] In one embodiment, the adjusting and locking the lens of the motion module includes:
[0112] S11, adjusting and locking the focal length of the lens of the motion module through a focusing plate;
[0113] S12, adjusting and locking the lens aperture of the motion module according to the light source conditions at the production site;
[0114] S13, adjusting and locking the lens white balance of the motion module through a white balance board.
[0115] In one embodiment, the step of using an adaptive brightness adjustment algorithm to adjust the image captured by the motion module includes:
[0116] S21, obtaining a real-time captured image of the motion module;
[0117] S22, setting an anchor point value K according to the gap between the blank wiring and the blank wiring in the real-time captured image;
[0118] S23, selecting a corresponding preset binarization method and a preset binarization threshold according to the color of the grey cloth;
[0119] S24, adjusting the exposure time and shooting gain of the motion module; binarizing the real-time captured image according to the preset binarization method and the preset binarization threshold to obtain a corresponding binarized image;
[0120] S25. Calculate the ratio S of the bright part in the binary image to the whole image. If the difference between the ratio S and the anchor point value K is less than or equal to the preset difference, fix the exposure time and shooting gain of the motion module. If the difference between the ratio S and the anchor point value K is greater than the preset difference, return to step S24.
[0121] In one embodiment, the step of setting the anchor point value K according to the gap between the blank wirings in the real-time captured image includes:
[0122] K = a / (a+b);
[0123] Wherein, a is the number of pixels of the blank wiring in a unit area in the real-time captured image, and b is the number of pixels of the gaps between the blank wirings in a unit area in the real-time captured image.
[0124] In one embodiment, the stepping-shooting definition set is calculated based on all the stepping-shooting images, including:
[0125] S41, dividing all the step-by-step captured images into a nine-square grid to obtain corresponding nine-square grid captured images;
[0126] S42, calculating the clarity of each grid image of each nine-grid image by using a Tenengrad function to obtain the shooting clarity corresponding to each grid image of each nine-grid image;
[0127] S43, removing outliers from all the shooting sharpness of each nine-grid shot image and then taking the average to obtain the step-by-step shooting sharpness of each nine-grid shot image;
[0128] S44, the step-by-step shooting definition of each nine-grid shot image is aggregated to obtain a step-by-step shooting definition set.
[0129] In one embodiment, the step of calculating the definition of each grid image of each nine-grid image by using a Tenengrad function includes:
[0130] S421. Set the convolution kernel of the Sobel operator:
[0131] S422, the horizontal gradient value of each grid image of each nine-grid captured image is: f x (x,y)=f(x,y)*K x ; The vertical gradient value of each grid image of each nine-grid image: f y (x,y)=f(x,y)*K y ;
[0132] S423, calculating the clarity value of each grid image of each nine-grid captured image according to the horizontal gradient value and the vertical gradient value of each grid image of each nine-grid captured image: s=
[0133]
[0134] In one embodiment, after outputting the information that the shooting definition of the motion module meets the requirement, the method further includes:
[0135] S7, increasing the preset speed by a preset increment to obtain an incremental speed;
[0136] S8, controlling the motion module to move at a uniform speed at the incremental speed, and controlling the motion module to capture images at multiple preset sampling points to obtain a plurality of incremental motion captured images;
[0137] S9, calculating the motion shooting clarity of all incremental motion shooting images to obtain a corresponding incremental motion shooting clarity set; comparing the incremental motion shooting clarity set with a preset motion clarity threshold, if all incremental motion shooting clarity in the incremental motion shooting clarity set are greater than the preset motion clarity threshold, returning to step S7; if there is an incremental motion shooting clarity in the incremental motion shooting clarity set that is less than the preset motion clarity threshold, subtracting the preset increment from the incremental speed to obtain the fastest flying speed.
[0138] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct RAMbus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0139] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0140] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
Claims
1. A camera self-test method for testing equipment, characterized in that: include: S1, fix the motion module, adjust and lock the lens of the motion module; S2, using an adaptive brightness adjustment algorithm to adjust the image captured by the motion module; S3, controlling the motion module to move step by step according to a preset step distance, and controlling the motion module to capture an image each time it stops, to obtain a plurality of step-by-step captured images; S4, calculating a step-shooting clarity set according to all the step-shooting images, comparing the step-shooting clarity set with a preset step-shooting clarity threshold, if all the step-shooting clarity in the step-shooting clarity set are greater than the preset step-shooting clarity threshold, outputting information that the installation accuracy of the motion module meets the requirements, and executing the next step; if there is a step-shooting clarity less than the preset step-shooting clarity threshold in the step-shooting clarity set, outputting information that the installation accuracy of the motion module does not meet the requirements, and stopping; wherein the installation accuracy is related to whether the slide rail and the cloth surface are relatively parallel; S5, controlling the motion module to move at a preset speed at a uniform speed, and controlling the motion module to capture images at multiple preset sampling points to obtain a plurality of motion captured images; S6, calculating the motion shooting clarity of all motion shooting images to obtain a corresponding motion shooting clarity set; comparing the motion shooting clarity set with a preset motion clarity threshold, and if all motion shooting clarity in the motion shooting clarity set is greater than the preset motion clarity threshold, outputting information that the shooting clarity of the motion module meets the requirement; The adjusting and locking of the lens of the motion module includes: S11, adjusting and locking the focal length of the lens of the motion module through a focusing plate; S12, adjusting and locking the lens aperture of the motion module according to the light source conditions at the production site; S13, adjusting and locking the lens white balance of the motion module through a white balance board.
2. The method according to claim 1, characterized in that The step of using an adaptive brightness adjustment algorithm to adjust the image captured by the motion module includes: S21, obtaining a real-time captured image of the motion module; S22, setting an anchor point value K according to the gap between the blank wiring and the blank wiring in the real-time captured image; S23, selecting a corresponding preset binarization method and a preset binarization threshold according to the color of the grey cloth; S24, adjusting the exposure time and shooting gain of the motion module; binarizing the real-time captured image according to the preset binarization method and the preset binarization threshold to obtain a corresponding binarized image; S25. Calculate the ratio S of the bright part in the binary image to the whole image. If the difference between the ratio S and the anchor point value K is less than or equal to the preset difference, fix the exposure time and shooting gain of the motion module. If the difference between the ratio S and the anchor point value K is greater than the preset difference, return to step S24.
3. The method according to claim 2, characterized in that The step of setting the anchor point value K according to the gap between the blank wirings in the real-time captured image comprises: K = a / (a+b); Wherein, a is the number of pixels of the blank wiring in a unit area in the real-time captured image, and b is the number of pixels of the gaps between the blank wirings in a unit area in the real-time captured image.
4. The method according to claim 1, characterized in that: The stepping-shooting definition set is calculated according to all the stepping-shooting images, including: S41, dividing all the step-by-step captured images into a nine-square grid to obtain corresponding nine-square grid captured images; S42, calculating the clarity of each grid image of each nine-grid image by using a Tenengrad function to obtain the shooting clarity corresponding to each grid image of each nine-grid image; S43, removing outliers from all the shooting sharpness of each nine-grid shot image and then taking the average to obtain the step-by-step shooting sharpness of each nine-grid shot image; S44, the step-by-step shooting definition of each nine-grid shot image is aggregated to obtain a step-by-step shooting definition set.
5. The method according to claim 4, characterized in that The method of calculating the definition of each image of each nine-grid image by using the Tenengrad function includes: S421. Set the convolution kernel of the Sobel operator: S422, the horizontal gradient value of each grid image of each nine-grid captured image is: f x (x,y)=f(x,y)*K x ; The vertical gradient value of each grid image of each nine-grid image: f y (x,y)=f(x,y)*K y ; S423, calculating the clarity value of each grid image of each nine-grid image according to the horizontal gradient value and the vertical gradient value of each grid image of each nine-grid image:
6. The method according to claim 1, characterized in that After outputting the information that the shooting definition of the motion module meets the requirement, the method further includes: S7, increasing the preset speed by a preset increment to obtain an incremental speed; S8, controlling the motion module to move at a uniform speed at the incremental speed, and controlling the motion module to capture images at multiple preset sampling points to obtain a plurality of incremental motion captured images; S9, calculating the motion shooting clarity of all incremental motion shooting images to obtain a corresponding incremental motion shooting clarity set; comparing the incremental motion shooting clarity set with a preset motion clarity threshold, if all incremental motion shooting clarity in the incremental motion shooting clarity set are greater than the preset motion clarity threshold, returning to step S7; if there is an incremental motion shooting clarity in the incremental motion shooting clarity set that is less than the preset motion clarity threshold, subtracting the preset increment from the incremental speed to obtain the fastest flying speed.
7. A camera self-test system for testing equipment, characterized in that: include: A camera adjustment module, configured to execute S1 in claim 1; An image adjustment module, configured to execute S2 in claim 1; A stepping shooting module, used to execute S3 in claim 1; An accuracy judgment module, used to execute S4 in claim 1; A uniform speed shooting module, used to execute S5 in claim 1; A clarity judgment module, used to execute S6 in claim 1.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Microscopic imaging detector and automatic focusing method thereof
CN103776831A
Image acquisition method and device of movable platform and storage medium
CN112335224A