Camera detection method and system and medium
By creating an evaluation area that matches the positioning model and automatically identifyes and locates the resolution board, the problem of cumbersome detection steps and easy introduction of errors in the prior art is solved, and the camera detection is automated and efficient and accurate detection results are realized.
Patent Information
- Application Number
- CN202510089863.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-05-27
AI Technical Summary
The prior art shows that when detecting whether the installation of industrial camera sensors meets the needs, the steps are cumbersome, time-consuming and easy to introduce human error.
By creating matching positioning models for different positions corresponding to the standard resolution board, automatically identify and position the exposure evaluation area and the clarity evaluation area, realize automatic exposure and focal length adjustment, and determine whether the camera is installed normally.
It realizes automation of camera detection process, reduces human error, and improves detection efficiency and accuracy.
Smart Images

Figure CN120050412A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of machine vision, and particularly relates to a camera detection method, system and medium. Background Art
[0002] After the industrial camera sensor is installed, it is necessary to detect whether the installation of the sensor meets the requirements through a clarity test. The existing detection method is to photograph a resolution target, calculate the clarity of the camera to be detected from the photographed image, and then compare the obtained clarity with the set standard. If the clarity meets the set standard, it is determined that the installation of the industrial camera sensor meets the requirements; otherwise, the industrial camera sensor is reinstalled.
[0003] Patent document CN110823134B discloses a target line calculation and industrial sensor installation detection method. This patent proposes a similar detection method, which uses a camera to photograph a self-developed target image, obtains multiple regions of interest according to the set parameters of the target image, and uses these regions of interest as the images to be detected. The clarity of the target line is obtained through a calculation method based on the weighting of the target line length and width of the histogram, and the adjustment instruction of the industrial camera sensor is sent according to the clarity of the target line to realize the automatic detection of the industrial camera sensor.
[0004] The disadvantages of the existing technology are that in the detection process, whether it is adjusting the camera exposure time, camera focus, or calculating the imaging clarity, it is necessary to manually save multiple images, select the regions of interest on the resolution target images taken by the camera in turn, calculate and record the results. The steps are cumbersome, time-consuming, and the measurement process may introduce human errors.
[0005] Therefore, the present invention provides a camera detection method, system and medium to solve the above problems. Summary of the Invention
[0006] The purpose of the present invention is to overcome the above problems existing in the prior art, and provide a camera detection method, system and medium.
[0007] To achieve the above technical purposes and reach the above technical effects, the present invention is realized through the following technical solutions: A camera detection method, which uses the clarity of the image information of the resolution target to detect whether the installation of the camera is normal. The detection method includes: Saving the position information of the exposure evaluation area and the clarity evaluation area of the standard resolution target into the corresponding matching positioning models under different poses to obtain the surface information of the standard resolution target corresponding to each matching positioning model; Extracting the position information of the exposure evaluation area and the clarity evaluation area in the matching positioning model corresponding to the current resolution target, wherein the matching positioning model corresponding to the current resolution target is identified by template matching; Set the exposure time so that the average gray value of the exposure evaluation area of the current resolution target within the corresponding exposure time conforms to the target threshold range to complete automatic exposure. Judge whether the maximum sharpness value of the sharpness evaluation area of the current resolution target at different focal lengths exceeds the sharpness threshold to detect whether the camera is installed properly.
[0008] Furthermore, by calculating the offsets of the centers of the exposure evaluation area and the sharpness evaluation area relative to the preset reference point, the position information of the exposure evaluation area and the sharpness evaluation area is obtained.
[0009] Furthermore, after identifying the matching positioning model corresponding to the current resolution target through template matching, obtain the position of the preset reference point in the image information of the current resolution target, and calculate the position information of the centers of the exposure evaluation area and the sharpness evaluation area based on the matching result and the offset.
[0010] Furthermore, the sharpness evaluation area consists of a horizontal stripe area and a vertical stripe area, where the horizontal stripe area is composed of several horizontally distributed horizontal stripes, and the vertical stripe area is composed of several vertically distributed vertical stripes.
[0011] Furthermore, the sharpness of the sharpness evaluation area includes the sharpness of the horizontal stripe area and the sharpness of the vertical stripe area. Calculate the MTF value based on the pixel average values in several row directions corresponding to the horizontal stripe area to obtain the sharpness of the horizontal stripe area, and calculate the MTF value based on the pixel average values in several column directions corresponding to the vertical stripe area to obtain the sharpness of the vertical stripe area.
[0012] Furthermore, the positioning method of the sharpness evaluation area includes: Extract the binary image after binarization of the neighborhood of the center of the sharpness evaluation area. Respectively perform dilation processing on the binary image using a vertical structuring element and a horizontal structuring element to analyze and obtain the center coordinates of the horizontal stripe area and the vertical stripe area.
[0013] Furthermore, the dilation processing includes: Perform dilation processing on the binary image using a vertical structuring element or a horizontal structuring element to obtain the first connected region and confirm its center coordinates. Mask the area corresponding to the first connected region in the binary image, and perform dilation processing on the masked binary image using another structuring element to obtain the second connected region and confirm its center coordinates.
[0014] Furthermore, collect at least two resolution targets, and judge whether the maximum sharpness values of the sharpness evaluation areas of all resolution targets at different focal lengths all exceed the sharpness threshold to detect whether the camera is installed properly.
[0015] The present invention also provides a camera detection system, including: A model creation module, configured to save the position information of the exposure evaluation area and the clarity evaluation area of a standard resolution board into corresponding matching and positioning models in different poses, so as to obtain the surface information of the standard resolution board corresponding to each matching and positioning model; A template matching module, configured to extract the position information of the exposure evaluation area and the clarity evaluation area in the matching and positioning model corresponding to the current resolution board, wherein the matching and positioning model corresponding to the current resolution board is identified by template matching; An exposure adjustment module, configured to set the exposure time so that the average gray value of the exposure evaluation area of the current resolution board within the corresponding exposure time conforms to the target threshold range, so as to complete automatic exposure; A focal length adjustment module, configured to determine whether the maximum clarity value of the clarity evaluation area of the current resolution board at different focal lengths exceeds the clarity threshold, so as to detect whether the camera is normally installed.
[0016] The present invention also provides a computer-readable storage medium, including a computer program, and when the computer program is executed by a processor, the above detection method is implemented.
[0017] The beneficial effects of the present invention are: (1) By creating matching and positioning models of a standard resolution board in several different poses and saving the analyzed position information of the exposure evaluation area and the clarity evaluation area into the matching and positioning models, the present invention can effectively combine the template matching technology, quickly locate the exposure evaluation area and the clarity evaluation area in the resolution board image without manual selection, realize the automation of the detection process, and reduce the human error in the detection process.
[0018] (2) By calculating the offsets of the centers of the exposure evaluation area and the clarity evaluation area relative to a preset reference point, the present invention can quickly and accurately obtain the position information of the exposure evaluation area and the clarity evaluation area after template matching.
[0019] (3) By calculating the clarity of the horizontal stripe area and the clarity of the vertical stripe area respectively, the present invention effectively avoids the deviation caused by factors such as dark current noise and approximate specular reflection in individual areas.
[0020] (4) Through binarization and dilation processing, the present invention can realize the precise positioning of the clarity evaluation area, and avoid the errors caused by lens distortion, deformation or dirt of different resolution boards compared with the standard resolution board image. Description of the Drawings
[0021] The accompanying drawings described herein are used to provide a further understanding of the present invention and form a part of this application. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings: Figure 1 is a flowchart of the detection method in the present invention; Figure 2 is a schematic diagram of the USAF1951 resolution target in the present invention; Figure 3 is a schematic diagram of the camera placement position and orientation in the present invention; Figure 4 is a schematic diagram of the exposure evaluation area in the present invention; Figure 5 is a schematic diagram of the sharpness evaluation area in the present invention; Figure 6 is a schematic diagram of the MTF calculation in the present invention; Figure 7 is a schematic diagram of the error that occurs when matching the sharpness evaluation area in the present invention; Figure 8 is a schematic flowchart of the process for accurately positioning the sharpness evaluation area in the present invention; Figure 9 is a block diagram of the system structure in the present invention. Detailed implementation manners
[0022] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0023] As Figures 1-8 shown, this embodiment first provides a camera detection method, which uses the sharpness of the image information of the resolution target to detect whether the installation of the camera is normal. The detection method specifically includes the following steps: Step 1: Save the position information of the exposure evaluation area and the sharpness evaluation area of the standard resolution target into the corresponding matching and positioning models under different poses to obtain the surface information of the standard resolution target corresponding to each matching and positioning model.
[0024] Before saving the position information of the exposure evaluation area and the clarity evaluation area of the standard resolution board, it is necessary to create matching and positioning models for different postures corresponding to the standard resolution board, and the matching and positioning models are created for subsequent template matching. Template matching refers to the process of comparing the template image with the image to be matched, finding the part of the image to be matched that is similar to the template image by calculating the similarity between the template image and the target in the image to be matched, and realizing target recognition and positioning. In actual application scenarios, since the template image is often small and predefined, while the image to be matched is often large and the information is unknown, in order to improve the versatility of the template matching algorithm, the information of all possible postures of the template image is pre-extracted during matching to obtain the matching model, and the matching model is used to calculate the similarity of different images to be matched to realize positioning, that is, only one template image is needed to obtain the matching model, which can be applied to target recognition and positioning in most images to be matched.
[0025] When creating a matching model, it is necessary to extract the feature information of the template image. The feature information can be the distribution information of the grayscale value of the template image or the shape information of the template image. In the matching calculation stage, it is necessary to calculate the similarity between the feature information of the image to be matched and the information in the model based on the information extracted when creating the matching model. When the extracted information is shape information, it is necessary to ensure that the target shape in the image to be matched is clear in order to accurately extract the shape information and achieve matching. Otherwise, mismatching or missed matching may occur.
[0026] It can be seen from the template matching principle that it is necessary to ensure that the shape of the target in the to-be-matched image is clear during matching. According to the traditional detection principle, the surface of the resolution board includes an exposure evaluation area and a clarity evaluation area. Exposure adjustment is performed through the exposure evaluation area, and clarity calculation is performed through the clarity evaluation area to adjust the focal length. In principle, it is impossible to ensure that the shape is clear. If the clarity evaluation area is matched directly, there is a high probability of mismatch or missed match. Therefore, a matching positioning model is created for the entire resolution board. Since the surface information of the standard resolution board is known, the position information of the exposure evaluation area and the clarity evaluation area can be analyzed to obtain the positioning of any area in the detection process.
[0027] In order to create matching positioning models of several different postures corresponding to the standard resolution plate, as a specific implementation of the present invention, the position information of the exposure evaluation area and the clarity evaluation area can be obtained by calculating the offset of the center of the exposure evaluation area and the center of the clarity evaluation area relative to the preset reference point, which specifically includes the following steps: The standard resolution plate image is used as the template image, and the edge point gradient information is extracted to obtain the matching positioning model. Assume that the gray value of the standard resolution plate image at point (x, y) is I(x, y), and the gradient value in the x direction at point (x, y) is G x(x, y), the gradient value in the y direction at the point (x, y) is G y (x, y), the gradient values in the x and y directions of each point of the standard resolution plate image can be calculated by the Sobel operator and satisfy formula (1):
[0028] In the formula: ⊗ represents convolution; Sobel x and Sobel y represent the Sobel operators in the x and y directions respectively.
[0029] Since the standard resolution plate image is a black-and-white binary image, the gradient values in the x and y directions of non-edge points must both be 0. Therefore, assuming that the set of edge point coordinates on the standard resolution plate image is (U, V), the i-th edge point (u i , v i ) satisfies formula (2):
[0030] From formulas (1) and (2), the set of edge points of the standard resolution plate image and the gradient information of each edge point can be extracted to establish a matching model.
[0031] After obtaining the matching model, it is also necessary to calculate the offsets of the centers of the exposure evaluation area and the sharpness evaluation area from the preset reference point, such as the center of the resolution plate image. Taking the horizontal right direction as the positive x-axis direction and the vertical downward direction as the positive y-axis direction, record the offset OffsetX in the x direction and the offset OffsetY in the y direction of the exposure evaluation area and the sharpness evaluation area compared with the center of the resolution plate image. The following is the process of calculating the offsets. Assume that the width of the standard resolution plate image is w board , and the height is h board , and the pixel coordinates of the center of the line pair or white square area on the standard resolution plate image are (x t , y t ), then it satisfies formula (3):
[0032] Save the offsets of the centers of each exposure evaluation area and sharpness evaluation area and the corresponding area sizes into the matching model to obtain a matching positioning model. For the matching positioning models with all different poses after transformation, it will include a rotation angle θ and a scaling factor Scale.
[0033] Step 2: Extract the position information of the exposure evaluation area and the sharpness evaluation area in the matching positioning model corresponding to the current resolution plate. Among them, the matching positioning model corresponding to the current resolution plate is identified by template matching.
[0034] Since the position information of the exposure evaluation area and the clarity evaluation area of the standard resolution board has been saved in the matching and positioning models in different poses in Step 1, the matching and positioning model corresponding to the current resolution board can be identified according to the result of template matching, so that the position information of the exposure evaluation area and the clarity evaluation area in the matching and positioning model corresponding to the current resolution board can be quickly extracted.
[0035] As a specific implementation manner of the present invention, after identifying the matching and positioning model corresponding to the current resolution board through template matching, obtain the position of the preset reference point in the image information of the current resolution board, and calculate the position information of the center of the exposure evaluation area and the center of the clarity evaluation area according to the matching result and the offset, which specifically includes the following steps: After the test platform is installed, since there may be an angle deviation when placing the resolution board during the installation of the test platform, and there is a scaling of the resolution board in the images collected under different models of cameras, lenses, and working distances compared with the standard resolution board image, the result of template matching includes not only the coordinates (x c , y c ) of the center of the resolution board in the center of the camera-captured image, but also a rotation angle θ and a scaling factor Scale. At this time, the corresponding center coordinates can be calculated according to the offset between the center of the exposure evaluation area and the center of the clarity evaluation area stored in the matching and positioning model. Taking the exposure evaluation area as an example, the center coordinates (x t ', y t ') of the exposure evaluation area on the camera-captured image can be obtained by affine transformation, and the affine transformation matrix M satisfies formula (4):
[0036] In the formula: α = cos θ, β = sin θ.
[0037] Then the center coordinates (x t ', y t ') of the exposure evaluation area on the camera-captured image are formula (5):
[0038] Similarly, the center coordinates of the clarity evaluation area can be calculated.
[0039] In order to obtain the position information of the exposure evaluation area and the clarity evaluation area in the image information of the current resolution board, as another implementation manner, the coordinate positions of the center of the exposure evaluation area and the center of the clarity evaluation area in the matching and positioning models in each pose can also be calculated in advance through affine transformation, so that the center coordinates of the exposure evaluation area and the center coordinates of the clarity evaluation area in the image information of the current resolution board can be quickly obtained according to the matching result after template matching.
[0040] Step 3: Set the exposure time so that the average gray value of the exposure evaluation area of the current resolution target at the corresponding exposure time meets the target threshold range to complete automatic exposure.
[0041] After obtaining the central coordinates of the exposure evaluation area, set different exposure times in sequence and calculate the corresponding average gray value within this area until the average gray value meets the target threshold range. Specifically, after installing the test platform, change the exposure time of the camera in sequence and continuously acquire images. Usually, the exposure evaluation area is a white square. The target gray value can be set to 210, and the target threshold range is set between 210±5. If the average gray value of the exposure evaluation area of the image acquired by the current camera is greater than 210, then reduce the exposure time; otherwise, increase the exposure time. If the average gray value does not meet the target threshold range, continue to continuously acquire images until the target threshold range is reached.
[0042] Step 4: Determine whether the maximum sharpness value of the sharpness evaluation area of the current resolution target at different focal lengths exceeds the sharpness threshold to detect whether the camera is installed normally.
[0043] The maximum sharpness value of the sharpness evaluation area of the current resolution target at different focal lengths corresponds to the sharpness in the focused state. At this time, if it exceeds the sharpness threshold, it means that the camera is installed normally; otherwise, it means that the camera is not installed normally.
[0044] As a preferred embodiment of the present invention, the sharpness evaluation area is composed of a horizontal stripe area and a vertical stripe area. Among them, the horizontal stripe area is composed of several horizontally distributed horizontal stripes, and the vertical stripe area is composed of several vertically distributed vertical stripes. For the resolution target, take USAF1951 as an example for illustration. As Figure 2 shown, it is a schematic diagram of the USAF1951 resolution target, Figure 3 is a schematic diagram of the camera placement position and orientation, Figure 4 is a schematic diagram of the exposure evaluation area, Figure 4 The framed area in it is the exposure evaluation area, Figure 5 is a schematic diagram of the sharpness evaluation area, Figure 5 The framed area in it is the sharpness evaluation area. Each sharpness evaluation area has a different size and is an area composed of a group of three horizontal stripes and three vertical stripes of the same size, thus forming line pairs.
[0045] As a specific implementation of the sharpness calculation for the sharpness evaluation area, the sharpness of the sharpness evaluation area includes the sharpness of the horizontal stripe area and the sharpness of the vertical stripe area. The MTF value is calculated based on the pixel average values in several row directions corresponding to the horizontal stripe area to obtain the sharpness of the horizontal stripe area, and the MTF value is calculated based on the pixel average values in several column directions corresponding to the vertical stripe area to obtain the sharpness of the vertical stripe area.
[0046] The sharpness is calculated by the modulation transfer function (MTF), and the image sharpness is evaluated by the contrast between the maximum bright point and the minimum bright point in the sharpness evaluation area. The calculation formula is:
[0047] The MTF value range is [0, 1]. The larger the MTF value, the greater the contrast and the better the resolution.
[0048] During the actual test process, due to factors such as dark current noise in the camera image and approximate specular reflection in individual areas, a bright point appears in the test line pair, resulting in the maximum brightness being significantly higher than other positions of the line pair, causing a certain deviation in the test results. Usually, the averaging method is used. For the horizontal stripe area and the vertical stripe area of the line pair area, their row means and column means are calculated respectively. After eliminating the random error, the MTF values are calculated respectively, as Figure 6 shown, which is a schematic diagram of MTF calculation. The calculation formula at this time is:
[0049] Adjust the camera focus until the sharpness of the horizontal stripe area and the vertical stripe area in the specified first sharpness evaluation area is the highest, that is, the MTF value is the highest, to complete the focusing.
[0050] As a specific implementation of the present invention, at least two resolution targets are collected, and it is judged whether the maximum sharpness values of the sharpness evaluation areas of all resolution targets at different focal lengths exceed the sharpness threshold to detect whether the camera is installed normally. As Figure 3 shown, taking 5 resolution targets as an example, according to the camera model, lens, and working distance to be detected, the sharpness of the second sharpness evaluation area specified for the 5 resolution targets in the resolution target image is calculated. The size of the second sharpness evaluation area is smaller than the size of the first sharpness evaluation area. The sharpness is calculated by MTF. If the sharpness of the second sharpness evaluation area specified for the 5 resolution targets is greater than the set sharpness threshold, it is considered that the camera is installed normally; otherwise, it is considered that the camera is not installed in place and the front-end component of the camera needs to be reassembled.
[0051] However, due to lens distortion, deformation or dirt on the images of different resolution plates compared to the standard resolution plate image, there may be an error of 1 to 2 pixels in the center coordinates of the first sharpness evaluation area obtained by matching. Since the size of the first sharpness evaluation area is small, a positioning error of 1 to 2 pixels will lead to inaccurate calculation of the MTF value or even a large error. Next Figure 7 is the line pair area selected by the center coordinates of the first sharpness evaluation area. It can be found that the selection box shifts to the upper left compared to the actual line pair area. At this time, an error will occur in the calculated MTF value.
[0052] In view of the above situation, the center coordinates of the sharpness evaluation area obtained by the above template matching and offset affine transformation are regarded as the rough positioning result. A morphological-based positioning algorithm is performed in the neighborhood of the center coordinates to obtain the fine positioning result, and then the MTF is calculated. For this, the positioning method of the sharpness evaluation area includes: Extract the binary image after binarizing the neighborhood of the center of the sharpness evaluation area, that is, binarize the neighborhood of the rough positioning result and extract all non-black background areas.
[0053] Dilate the binary image with a vertical structuring element and a horizontal structuring element respectively to analyze and obtain the center coordinates of the horizontal stripe area and the vertical stripe area.
[0054] As the first implementation method of the dilation process, it specifically includes the following steps: First, dilate the binary image with a vertical structuring element or a horizontal structuring element to obtain the first connected area and confirm its center coordinates. For example, dilate the binary image with a vertical structuring element (n×1). After dilation, the horizontal stripe area in the image will be connected into a whole, and the vertical stripe area remains basically unchanged; calculate the sizes of the connected areas in the dilated image and sort them. The largest connected area corresponds to the connected horizontal stripe area. At this time, the center coordinates of this connected area can be obtained, which is the center coordinates of the horizontal stripes in the sharpness evaluation area.
[0055] Second, mask the area corresponding to the first connected area in the binary image, and dilate the masked binary image with another structuring element to obtain the second connected area and confirm its center coordinates. Use the horizontal stripe area obtained by dilation in the previous step as a mask to mask the corresponding area in the original binary image. Dilate the remaining area in the binary image with a horizontal structuring element (1×n). After dilation, the vertical stripes in the image will be connected into a whole. Similarly, the center coordinates of the vertical stripe area are obtained by connected area analysis, and the fine positioning of the line pair area is completed. The whole process is as Figure 8 shown. The first picture in the figure is a schematic diagram of the rough positioning area image, the first picture is a schematic diagram of the binarized image, the first picture is a schematic diagram of the result of dilation with a vertical structuring element, the first picture is a schematic diagram of covering the horizontal stripes, and the first picture is a schematic diagram of the result of dilation with a horizontal structuring element.
[0056] As a second embodiment of the dilation process, different from the first embodiment, in the second step, the vertical stripe region in the original binary image can be directly dilated with a horizontal structuring element (1×n). After dilation, the vertical stripe regions in the image will be connected into a whole, and the horizontal stripe regions will remain basically unchanged. Calculate the sizes of the connected components in the dilated image and sort them. The largest connected component corresponds to the connected region of the vertical stripes. At this time, the central coordinates of this connected component can be obtained, which are the central coordinates of the vertical stripes in the sharpness evaluation region.
[0057] At this time, similarly as Figure 3 shown, taking 5 resolution plates as an example, according to the camera model, lens, and working distance to be detected, calculate the sharpness of the second sharpness evaluation regions specified for a total of 5 resolution plates at the center and four corners of the image. After obtaining the coordinates of each second sharpness evaluation region through the same rough positioning and fine positioning during the process of adjusting the camera focal length, calculate the MTF value. Determine whether the MTF values of the 5 second sharpness evaluation regions are greater than the set sharpness threshold. If they are all greater than the sharpness threshold, it is considered that the camera is installed normally; otherwise, it is considered that the camera is not installed in place and the front-end component of the camera needs to be reassembled.
[0058] As Figure 9 shown, the present invention also provides a camera detection system, including: A model creation module, configured to save the position information of the exposure evaluation region and the sharpness evaluation region of the standard resolution plate into the corresponding matching and positioning models in different poses, so as to obtain the surface information of the standard resolution plate corresponding to each matching and positioning model; A template matching module, configured to extract the position information of the exposure evaluation region and the sharpness evaluation region in the matching and positioning model corresponding to the current resolution plate, wherein the matching and positioning model corresponding to the current resolution plate is identified through template matching; An exposure adjustment module, configured to set the exposure time so that the average gray value of the exposure evaluation region of the current resolution plate within the corresponding exposure time conforms to the target threshold range to complete automatic exposure; A focal length adjustment module, configured to determine whether the maximum sharpness value of the sharpness evaluation region of the current resolution plate at different focal lengths exceeds the sharpness threshold to detect whether the camera is installed normally.
[0059] In a third aspect of the present invention, there is also provided a computer-readable storage medium, including a computer program, and when the computer program is executed by a processor, the above detection method is implemented.
[0060] In practical applications, the computer-readable storage medium may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium may include: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium that contains or stores a program, and the program may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0061] The computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries the computer-readable program code. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium, and the computer-readable medium may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0062] The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wire, optical fiber, RF, etc., or any suitable combination of the above.
[0063] The computer program code for performing the operations of this application may be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., by using an Internet service provider to connect through the Internet).
[0064] In the description of this specification, the descriptions referring to terms such as "one embodiment", "example", "specific example", etc. mean that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0065] The above has shown and described the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments, and what is described in the above embodiments and the specification is only to illustrate the principle of the present invention. Without departing from the spirit and scope of the present invention, the present invention will have various changes and improvements, and these changes and improvements all fall within the scope of the present invention claimed.
Claims
1. A camera detection method for detecting whether the camera is installed normally, characterized in that: Detection methods include: The position information of the exposure evaluation area and the clarity evaluation area of the standard resolution plate is saved to the corresponding matching positioning models under different postures, so as to obtain the surface information of the standard resolution plate corresponding to each matching positioning model; Extracting the position information of the exposure evaluation area and the clarity evaluation area in the matching positioning model corresponding to the current resolution plate, wherein the matching positioning model corresponding to the current resolution plate is identified by template matching; Set the exposure time so that the average grayscale value of the exposure evaluation area of the current resolution board at the corresponding exposure time meets the target threshold range to complete automatic exposure; Determine the clarity evaluation area of the current resolution board and whether the maximum clarity value at different focal lengths exceeds the clarity threshold to detect whether the camera is installed normally.
2. A camera detection method according to claim 1, characterized in that: The position information of the exposure evaluation area and the clarity evaluation area is obtained by calculating the offsets of the center of the exposure evaluation area and the center of the clarity evaluation area relative to the preset reference point.
3. A camera detection method according to claim 2, characterized in that: After identifying the matching positioning model corresponding to the current resolution board through template matching, the position of the preset reference point in the image information of the current resolution board is obtained, and the position information of the center of the exposure evaluation area and the center of the clarity evaluation area are calculated based on the matching result and the offset.
4. A camera detection method according to claim 1, characterized in that: The clarity evaluation area is composed of a horizontal stripe area and a vertical stripe area, wherein the horizontal stripe area is composed of a plurality of parallel horizontal stripes, and the vertical stripe area is composed of a plurality of parallel vertical stripes.
5. A camera detection method according to claim 4, characterized in that: The clarity of the clarity evaluation area includes the clarity of the horizontal stripe area and the clarity of the vertical stripe area. The MTF value is calculated based on the average value of pixels in several rows corresponding to the horizontal stripe area to obtain the clarity of the horizontal stripe area. The MTF value is calculated based on the average value of pixels in several columns corresponding to the vertical stripe area to obtain the clarity of the vertical stripe area.
6. A camera detection method according to claim 4, characterized in that: Methods for locating clarity assessment areas include: Extract the binary image after binarization of the central neighborhood of the clarity assessment area; The binary image is expanded using vertical structural elements and horizontal structural elements respectively to analyze and obtain the center coordinates of the horizontal stripe area and the vertical stripe area.
7. A camera detection method according to claim 6, characterized in that: Expansion treatment includes: The binary image is expanded using a vertical structural element or a horizontal structural element to obtain a first connected region and determine its center coordinates; The area corresponding to the first connected area in the binary image is shielded, and another structural element is used to dilate the shielded binary image to obtain the second connected area and confirm its central coordinates.
8. A camera detection method according to any one of claims 1 to 7, characterized in that: Collect at least two resolution boards and determine whether the maximum clarity values of the clarity evaluation areas of all resolution boards at different focal lengths exceed the clarity threshold to detect whether the camera is installed normally.
9. A camera detection system, characterized in that: include: A model creation module is used to save the position information of the exposure evaluation area and the clarity evaluation area of the standard resolution plate to the corresponding matching positioning models under different postures, so as to obtain the surface information of the standard resolution plate corresponding to each matching positioning model; A template matching module is used to extract the position information of the exposure evaluation area and the clarity evaluation area in the matching positioning model corresponding to the current resolution plate, wherein the matching positioning model corresponding to the current resolution plate is identified by template matching; The exposure adjustment module is used to set the exposure time so that the average grayscale value of the exposure evaluation area of the current resolution board at the corresponding exposure time meets the target threshold range to complete automatic exposure; The focus adjustment module is used to determine the clarity evaluation area of the current resolution board and whether the maximum clarity value at different focal lengths exceeds the clarity threshold, so as to detect whether the camera is installed normally.
10. A computer-readable storage medium comprising a computer program, characterized in that: When the computer program is executed by a processor, the detection method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
A method for target line calculation and industrial sensor installation and testing
CN110823134B