Precise distortion calibration method, system and equipment for photographic camera
Through adaptive threshold segmentation algorithm and distortion degree analysis, the distortion areas in the camera image are accurately identified and corrected, which solves the problem of distortion recognition difficulties caused by grayscale changes in the background plate pattern and improves the accuracy of camera imaging.
Patent Information
- Application Number
- CN202510300505.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-04-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Due to the grayscale changes in the pattern on the background plate itself, the existing methods cannot accurately identify the distorted areas, which in turn affects the accuracy of camera imaging.
The adaptive threshold segmentation algorithm is used to obtain the segmented areas of the grayscale image under the edge length of the block in different preset fields. By analyzing the edge grayscale changes, internal grayscale distribution and positional relationship with the neighboring segmented areas, the degree of distortion of each segmented area is calculated, and the suspected distortion area is screened based on this, and the real distortion area is finally accurately obtained.
It improves the accurate recognition ability of distorted areas in the camera image, ensures accurate correction of tangential distortion, and thus improves the accuracy of camera imaging.
Smart Images

Figure CN119832090A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image analysis, and in particular to a method, system and device for precisely calibrating the distortion of a photographic camera. Background Art
[0002] The distortion that occurs when the camera is shooting mainly includes barrel distortion, pincushion distortion and geometric distortion, which are mainly caused by factors such as the optical characteristics of the lens, shooting angle or equipment limitations. When calibrating the camera, if the background plate itself is concave, the surface of the calibration plate is no longer flat, which may cause a typical problem of tangential distortion. Tangential distortion is usually caused by the camera optical system or the calibration plate not being on the same plane, resulting in distortion of the geometric shape of the image. In order to improve the accuracy of camera imaging, it is necessary to accurately detect the concave area in the background plate so that the tangential distortion can be accurately adjusted.
[0003] In the existing method, the different grayscale characteristics between the concave area and the normal area are used to screen the distorted area. However, in reality, the pattern on the background plate itself has grayscale changes, which makes it impossible to accurately identify the distorted area based only on the different grayscale characteristics. Summary of the invention
[0004] In order to solve the technical problem that the distorted area cannot be accurately identified only based on the characteristics of different grayscales due to the grayscale changes of the pattern on the background plate, the purpose of the present invention is to provide a method, system and device for accurately calibrating the distortion of a photographic camera. The technical solution adopted is as follows: In a first aspect, an embodiment of the present invention provides a method for precise calibration of distortion of a photographic camera, the method comprising the following steps: Get the grayscale image taken by the camera; The segmentation area corresponding to the grayscale image under different preset domain block side lengths is obtained through an adaptive threshold segmentation algorithm, and the degree of distortion of each segmentation area is obtained according to the edge grayscale change and internal grayscale distribution of each segmentation area, as well as the positional relationship between each segmentation area and its neighboring segmentation area; The suspected distorted areas are screened out based on the degree of distortion; the real distorted area of each suspected distorted area is obtained according to the degree of distortion of the segmented area corresponding to each suspected distorted area under different preset domain block side lengths, and the difference in distortion degree with the segmented area corresponding to the adjacent preset domain block side lengths.
[0005] Furthermore, the method for obtaining the degree of distortion is: According to the grayscale change of each segmented area, the grayscale gradient of each segmented area is obtained; According to the internal grayscale distribution of each segmented area, the grayscale clutter degree of each segmented area is obtained; According to the positional relationship between each segmented area and its neighboring segmented areas, the local abnormality degree of each segmented area is obtained; The grayscale gradient degree, grayscale clutter degree and local abnormality degree of each segmented area are added and normalized to obtain the distortion degree of each segmented area.
[0006] Furthermore, the grayscale gradient degree is obtained by: For any segmented area and any edge pixel point of the segmented area, a preset number of pixels closest to the edge pixel point on a straight line where a normal line corresponding to the edge pixel point is located are obtained as neighborhood pixels of the edge pixel point; Taking the neighboring pixel point that is farthest from the edge pixel point and has the smallest grayscale value as the starting point, the neighboring pixel points are sorted according to the position order of the neighboring pixel points on the straight line where the normal line is located, as a neighborhood pixel point sequence; The grayscale values corresponding to the neighboring pixel points in the neighborhood pixel point sequence are fitted into a straight line by the least square method as the target straight line; According to the root mean square error and the absolute value of the slope of the target straight line, the grayscale smoothness of the edge pixel point is obtained; wherein the root mean square error and the absolute value of the slope are both negatively correlated with the grayscale smoothness; The average value of the grayscale smoothness of all edge pixels in the segmented area is obtained as the grayscale gradient of the segmented area.
[0007] Furthermore, the grayscale clutter degree is obtained by: For any segmented area and any pixel in the segmented area, obtain the grayscale value difference between each preset neighborhood pixel of the pixel and the pixel, and use them as the first difference; The result of accumulating and normalizing all the first differences is used as the prominence of the pixel; Obtaining the prominence degree of each pixel in the segmented area, when the prominence degree is greater than a preset prominence degree threshold, the corresponding pixel is a prominence pixel; The ratio of the number of prominent pixels in the segmented area to the number of all pixels inside it is taken as the grayscale clutter degree of the segmented area.
[0008] Furthermore, the method for obtaining the local abnormality degree is: For any segmented area, other segmented areas where preset neighboring pixels of all edge pixels of the segmented area are located are used as neighboring segmented areas of the segmented area; Acquire the number of edge pixel points of the segmented area whose preset neighborhood pixel points are located in the neighborhood segmented area as the first number; The ratio of the first number to the number of all edge pixels in the segmented area is used as the local abnormality degree of the segmented area.
[0009] Furthermore, the method for obtaining the suspected distortion area is: When the distortion degree is greater than a preset distortion degree threshold, the corresponding segmented area is a suspected distortion area.
[0010] Furthermore, the method for obtaining the real distortion area is: For any suspected distorted region, the segmented region corresponding to the suspected distorted region under each preset domain block side length is obtained, and all of them are used as reference segmented regions of the suspected distorted region; For any reference segmented region, the difference in the degree of distortion of the reference segmented region under the next adjacent preset domain block side length of the reference segmented region and its corresponding preset domain block side length is obtained as the degree of distortion of the reference segmented region; wherein the arrangement order of the preset domain block side lengths is from small to large; Obtaining the average value of the distortion degree of all segmented areas of the grayscale image under the preset domain block side length corresponding to the reference segmented area as the distortion sensitivity degree; The product of the distortion degree, the distortion significance degree and the distortion sensitivity degree of the reference segmentation region is used as the accuracy degree of the reference segmentation region; The reference segmentation region corresponding to the maximum accuracy is used as the real distortion region of the suspected distortion region.
[0011] Furthermore, the method for obtaining the reference segmentation area is: For any suspected distorted region, a segmented region with the highest probability of overlapping with the suspected distorted region under each preset domain block side length is used as a reference segmented region of the suspected distorted region.
[0012] In a second aspect, another embodiment of the present invention provides a distortion precision calibration system for a photographic camera, the system comprising: An image acquisition module, used to acquire a grayscale image taken by a camera; The distortion degree acquisition module is used to obtain the segmented areas corresponding to the grayscale image under different preset domain block side lengths through an adaptive threshold segmentation algorithm, and obtain the distortion degree of each segmented area according to the edge grayscale change and internal grayscale distribution of each segmented area, as well as the positional relationship between each segmented area and its neighboring segmented area; The real distortion area acquisition module is used to screen out suspected distortion areas based on the degree of distortion; according to the degree of distortion of the segmented area corresponding to each suspected distortion area under different preset domain block side lengths, and the difference in distortion degree with the segmented area corresponding to the adjacent preset domain block side lengths, the real distortion area of each suspected distortion area is obtained.
[0013] In the third aspect, another embodiment of the present invention provides a precise distortion calibration device for a photographic camera, the device comprising: a memory, a processor, and a computer program stored in the memory and running on the processor, and when the processor executes the computer program, the steps of any one of the above methods are implemented.
[0014] The present invention has the following beneficial effects: The present invention firstly obtains the segmentation area corresponding to the grayscale image under different preset domain block side lengths through an adaptive threshold segmentation algorithm, which is conducive to the subsequent accurate acquisition of the distorted area in the grayscale image; in order to analyze the distorted area in the grayscale image, the distortion degree of each segmentation area is obtained according to the edge grayscale change and internal grayscale distribution of each segmentation area, and the position relationship between each segmentation area and its neighboring segmentation area, and accurately reflects the possibility that each segmentation area is a distorted area; then, based on the distortion degree, the suspected distorted area is accurately screened out, and the position that the distorted area in the grayscale image may correspond to is preliminarily determined; in order to accurately obtain the real distorted area corresponding to the suspected distorted area, the real distorted area of each suspected distorted area is accurately obtained according to the distortion degree of the segmentation area corresponding to each suspected distorted area under different preset domain block side lengths, and the difference in distortion degree with the segmentation area corresponding to the adjacent preset domain block side length, which is conducive to accurate correction of distortion and more effective improvement of camera imaging accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0016] Figure 1 A schematic flow chart of a method for precise distortion calibration of a photographic camera provided by one embodiment of the present invention; Figure 2 A flow chart of a method for obtaining a degree of distortion provided by an embodiment of the present invention; Figure 3 A structural diagram of a distortion precision calibration system for a photographic camera provided by one embodiment of the present invention; Figure 4 A schematic diagram of a distortion precision calibration device for a photographic camera provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0017] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the method, system and device for accurately calibrating the distortion of a photographic camera proposed by the present invention, its specific implementation, structure, features and effects in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0018] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0019] The specific scheme of the method, system and device for precise distortion calibration of a photographic camera provided by the present invention is described in detail below with reference to the accompanying drawings.
[0020] Embodiment 1: The specific scenario of this embodiment is: when the background plate itself is concave, the surface of the calibration plate will no longer be flat, which will cause the problem of tangential distortion. In order to accurately identify the distorted area, the tangential distortion can be accurately adjusted later to improve the camera shooting accuracy. In this embodiment, the segmented area corresponding to the grayscale image under different preset domain block side lengths is first obtained by an adaptive threshold segmentation algorithm, and then each segmented area is analyzed and screened out to obtain the suspected distorted area. In order to accurately obtain the distorted area in the grayscale image, the real distorted area of each suspected distorted area is accurately obtained according to the degree of distortion of the segmented area corresponding to each suspected distorted area under different preset domain block side lengths, and the difference in distortion degree with the segmented area corresponding to the adjacent preset domain block side lengths, that is, the distorted area is accurately determined, which is conducive to accurately adjusting the tangential distortion and improving the camera imaging accuracy. Among them, the adaptive threshold segmentation algorithm is a well-known technology and will not be described in detail.
[0021] The present invention proposes a method for accurately calibrating the distortion of a photographic camera. Figure 1 , which shows a schematic flow chart of a method for precise distortion calibration of a photographic camera provided by an embodiment of the present invention, the method comprising the following steps: Step S1: Obtain a grayscale image taken by a camera.
[0022] Specifically, in order to accurately and efficiently analyze the distortion area, and then accurately correct the tangential distortion, and improve the imaging accuracy of the camera, this embodiment grayscales the image captured by the camera to obtain a grayscale image captured by the camera. The grayscale processing is a well-known technology and will not be described in detail.
[0023] Step S2: Obtain the segmented areas corresponding to the grayscale image under different preset domain block side lengths through an adaptive threshold segmentation algorithm, and obtain the degree of distortion of each segmented area according to the edge grayscale change and internal grayscale distribution of each segmented area, as well as the positional relationship between each segmented area and its neighboring segmented areas.
[0024] Specifically, in order to accurately obtain the distorted area in the grayscale image, the present embodiment uses an adaptive threshold segmentation algorithm to obtain the segmented area corresponding to the grayscale image under different preset domain block side lengths. In the present embodiment, the preset domain block side lengths are set to 1, 3, 5, 7, and 9 respectively. The implementer can set the size of the preset domain block side length according to the actual situation, and no limitation is made here. It is known that compared with the segmented area edge caused by the pattern or color change of the background plate itself, the edge grayscale change of the segmented area corresponding to the concave area is more gentle, that is, the grayscale change of the edge is relatively gentle. In this embodiment, the possibility of each segmented area being a distorted area can be determined by analyzing the edge grayscale change of each segmented area; usually, the depression on the background plate is generally caused by collision and the like, and often has no regularity, which makes the grayscale change inside the depression more chaotic than that in the normal area of the background plate. In this embodiment, the internal grayscale distribution of each segmented area can be analyzed to further determine whether each segmented area is a distorted area. In addition, the concave area may be affected by tangential distortion during shooting, which may cause a complete normal segmented area to be divided into multiple segmented areas. Therefore, the position of the segmented area corresponding to the concave area and its neighboring segmented areas should be closer as a whole. Therefore, this embodiment can further determine the possibility that each segmented area is a distorted area by analyzing the positional relationship between each segmented area and its neighboring segmented areas. Furthermore, this embodiment obtains the degree of distortion of each segmented area according to the edge grayscale change and internal grayscale distribution of each segmented area, as well as the positional relationship between each segmented area and its neighboring segmented areas.
[0025] Preferably, in one possible implementation of this embodiment, the method for obtaining the degree of distortion is described in Figure 2 , which shows a flow chart of a method for obtaining the degree of distortion provided by this embodiment, the method comprising the following steps: Step S201: Obtain the grayscale gradient of each segmented area according to the grayscale change of the edge of each segmented area.
[0026] When the edge grayscale of a segmented area changes more slowly, the segmented area is more likely to be a distorted area. Thus, this embodiment obtains the grayscale gradient of each segmented area according to the edge grayscale change of each segmented area. The greater the grayscale gradient, the more likely the corresponding segmented area is to be a distorted area.
[0027] Preferably, in a method that can be implemented in this embodiment, the method for obtaining the grayscale gradient degree is: for any segmented area and any edge pixel point of the segmented area, obtain a preset number of pixels closest to the edge pixel point on the straight line where the normal corresponding to the edge pixel point is located, as the neighborhood pixel points of the edge pixel point; this embodiment sets the preset number to 12, and the implementer can set the size of the preset number according to actual conditions, and it is not limited here. Among them, the neighborhood pixel points of the edge pixel point are respectively located on both sides of the edge pixel point and the number of neighborhood pixel points on each side is the same (both are 6). Among them, the method for obtaining the normal corresponding to the edge pixel point is a well-known technology and will not be repeated. In order to analyze the grayscale change of the edge pixel point, the neighborhood pixel point that is farthest from the edge pixel point and has the smallest grayscale value is taken as the starting point, and the neighborhood pixel points are sorted according to the position order of the neighborhood pixel points on the straight line where the normal line is located, as a neighborhood pixel point sequence; then the grayscale values corresponding to the neighborhood pixel points in the neighborhood pixel point sequence are fitted into a straight line by the least squares method in turn, as the target straight line; wherein, the method of fitting a straight line by the least squares method is a well-known technology and will not be repeated. When the root mean square error of the target straight line is smaller and the slope is closer to 0, the grayscale change of the edge pixel point is smoother, and then this embodiment obtains the grayscale smoothness of the edge pixel point according to the root mean square error and the absolute value of the slope of the target straight line; wherein, the root mean square error and the absolute value of the slope are negatively correlated with the grayscale smoothness; the greater the grayscale smoothness, the smoother the grayscale change of the edge pixel point. wherein, the grayscale smoothness is calculated as: ; In the formula, is the grayscale smoothness of the j-th edge pixel in the a-th segmentation area; is the root mean square error of the target line corresponding to the j-th edge pixel point in the a-th segmentation area; is the slope of the target straight line corresponding to the jth edge pixel point of the ath segmentation area; is the absolute value function; is the first preset constant, greater than 0; is a second preset constant, which is greater than 0. and All are 1 to avoid the denominator being 0. The implementer can set it according to the actual situation. and The size of is not limited here. It should be noted that The smaller it is, the more accurate the grayscale value on the target straight line corresponding to the jth edge pixel point in the ath segmentation area is. The smaller the basis, The smaller it is, the smoother the grayscale change of the jth edge pixel in the ath segmentation area is; In order to analyze the grayscale change of the edge of the segmented area as a whole, the average grayscale smoothness of all edge pixels of the segmented area is obtained as the grayscale gradient of the segmented area.
[0028] At this point, the grayscale gradient of each segmented area is obtained.
[0029] Step S202: Obtain the grayscale clutter level of each segmented area according to the internal grayscale distribution of each segmented area.
[0030] When the internal grayscale distribution of a segmented area is more chaotic, the segmented area is more likely to be a distorted area. Therefore, this embodiment obtains the grayscale chaos degree of each segmented area according to the internal grayscale distribution of each segmented area. The greater the grayscale chaos degree, the more likely the corresponding segmented area is to be a distorted area.
[0031] Preferably, in a method that can be implemented in this embodiment, the method for obtaining the grayscale clutter degree is: for any segmented area and any pixel point in the segmented area, the absolute value of the difference between the grayscale value of each preset neighborhood pixel point of the pixel point and the pixel point is obtained, and all are taken as the first difference; the larger the first difference, the more different the grayscale of the pixel point and the corresponding preset neighborhood pixel point is, and the more likely the pixel point is to be prominent; in this embodiment, the eight neighborhood pixel points of the pixel point are taken as the preset neighborhood pixel points of the pixel point, and the implementer can set the preset neighborhood pixel points of the pixel point according to the actual situation, which is not limited here. In order to show the prominence of the pixel point as a whole, all the first differences are accumulated and normalized as the prominence of the pixel point; the greater the prominence, the more different the grayscale of the pixel point and its local pixel point is. It should be noted that in this embodiment, the accumulated results of all the first differences are normalized by the norm normalization function. In order to show the disorder of the grayscale distribution in the segmented area, this embodiment obtains the prominence of each pixel in the segmented area. The more pixels with large prominence, the more disordered the grayscale distribution in the segmented area. This embodiment sets the preset prominence threshold to 0.6. The implementer can set the value of the preset prominence threshold according to the actual situation, which is not limited here. When the prominence is greater than the preset prominence threshold, the corresponding pixel is a prominence pixel; then the ratio of the number of prominence pixels in the segmented area to the number of all pixels inside it is obtained as the grayscale disorder of the segmented area.
[0032] At this point, the grayscale clutter level of each segmented area is obtained.
[0033] Step S203: Obtain the local abnormality degree of each segmented region according to the positional relationship between each segmented region and its neighboring segmented regions.
[0034] The closer a segmented region is to its neighboring segmented region, the more likely it is that the segmented region is a distorted region. Thus, according to the positional relationship between each segmented region and its neighboring segmented region, the embodiment obtains the local abnormality degree of each segmented region. The greater the local abnormality degree, the more likely the corresponding segmented region is a distorted region.
[0035] Preferably, in a method that can be implemented in this embodiment, the method for obtaining the degree of local abnormality is: for any segmented area, other segmented areas where the preset neighborhood pixels of all edge pixels of the segmented area are located are used as the neighborhood segmented areas of the segmented area; wherein, this embodiment uses the eight neighborhood pixels of the edge pixel point as the preset neighborhood pixels of the edge pixel point, and the implementer can set the preset neighborhood pixels of the edge pixel point according to actual conditions, which is not limited here. In order to analyze the positional relationship between the segmented area and its neighboring segmented areas, this embodiment obtains the number of edge pixel points of the segmented area where the preset neighborhood pixel points are located in the neighborhood segmented area as the first number; the larger the first number is, the closer the segmented area is to its neighboring segmented area as a whole, which indirectly indicates that the segmented area is more likely to be a distorted area; in order to accurately analyze the overall proximity of the segmented area to its neighboring segmented areas, the ratio of the first number to the number of all edge pixel points of the segmented area is obtained as the local abnormality degree of the segmented area; the larger the local abnormality degree is, the closer the segmented area is to its neighboring segmented area as a whole, and the more likely the segmented area is to be a distorted area; it should be noted that when the segmented area does not have a neighboring segmented area, the local abnormality degree of the segmented area is defaulted to 0.
[0036] At this point, the local abnormality level of each segmented area is obtained.
[0037] Step S204: adding the grayscale gradient degree, grayscale clutter degree and local abnormality degree of each segmented region and performing normalization to obtain a result as the distortion degree of each segmented region.
[0038] It is known that the greater the grayscale gradient, the more likely the corresponding segmented area is a distorted area; the greater the grayscale clutter, the more likely the corresponding segmented area is a distorted area; the greater the local abnormality, the more likely the corresponding segmented area is a distorted area; in order to accurately analyze the possibility of each segmented area being a distorted area, this embodiment adds the grayscale gradient, grayscale clutter and local abnormality of each segmented area and normalizes the result as the distortion degree of each segmented area. It should be noted that this embodiment normalizes the addition result of the grayscale gradient, grayscale clutter and local abnormality of each segmented area through the norm normalization function.
[0039] At this point, the degree of distortion of each segmented area is obtained.
[0040] Step S3: Filter out suspected distorted areas based on the degree of distortion; obtain the true distorted area of each suspected distorted area according to the degree of distortion of the segmented area corresponding to each suspected distorted area under different preset domain block side lengths, and the difference in distortion degree between the segmented area corresponding to the adjacent preset domain block side lengths.
[0041] It is known that the greater the degree of distortion, the more likely the corresponding segmented area is to be a distorted area, and thus the preset distortion degree threshold is set to 0.7 in this embodiment. The implementer can set the size of the preset distortion degree threshold according to the actual situation, and it is not limited here. When the degree of distortion is greater than the preset distortion degree threshold, the corresponding segmented area is a suspected distorted area. Then, the suspected distorted area in the grayscale image is accurately screened out based on the degree of distortion. It is known that when different preset domain block side lengths are set to perform adaptive threshold segmentation on the grayscale image, the grayscale image will be divided into different segmented areas under different preset domain block side lengths. Under a certain preset domain block side length, there may be a segmented area that only contains part of the sunken area or includes other normal areas in addition to the sunken area. Therefore, the distorted area in the grayscale image cannot be accurately determined by the suspected distorted area. In order to more accurately obtain the real distortion area corresponding to the suspected distortion area, this embodiment obtains the real distortion area of each suspected distortion area according to the distortion degree of the segmented area corresponding to each suspected distortion area under different preset domain block side lengths, and the difference in distortion degree with the segmented area corresponding to the adjacent preset domain block side lengths, which is conducive to accurate adjustment of the distortion.
[0042] Preferably, in a manner that can be implemented in this embodiment, the method for obtaining the real distortion area is: for any suspected distortion area, the segmentation area corresponding to the suspected distortion area under each preset domain block side length is obtained, and all of them are used as reference segmentation areas of the suspected distortion area; wherein the method for obtaining the reference segmentation area is: first, the segmentation area corresponding to the grayscale image under each preset domain block side length is obtained, and then the segmentation area with the highest probability of overlap with the suspected distortion area under each preset domain block side length is used as the reference segmentation area of the suspected distortion area. The real distorted area corresponding to the suspected distorted area must be among these reference segmented areas. In order to accurately screen out the real distorted area corresponding to the suspected distorted area, each reference segmented area is analyzed separately. For any reference segmented area, the difference between the distortion degree of the reference segmented area and the next adjacent preset domain block side length of the preset domain block side length corresponding to the reference segmented area is obtained as the distortion degree of the reference segmented area. The preset domain block side lengths are arranged in order from small to large. Therefore, the next adjacent preset domain block side length of the preset domain block side length corresponding to the reference segmented area is greater than the preset domain block side length corresponding to the reference segmented area. The greater the distortion degree of the reference segmented area, the more likely it is that the reference segmented area is the real distorted area corresponding to the suspected distorted area. In order to more accurately analyze the possibility that the reference segmented area is the real distorted area corresponding to the suspected distorted area, the average value of the distortion degree of all segmented areas of the grayscale image under the preset domain block side length corresponding to the reference segmented area is obtained as the distortion sensitivity; the greater the distortion sensitivity, the more sensitive the distortion reflection in the grayscale image under the preset domain block side length corresponding to the reference segmented area, which indirectly indicates that the reference segmented area is more likely to be the real distorted area corresponding to the suspected distorted area; It is known that the greater the distortion is and the greater the distortion sensitivity is, the more likely the reference segmentation region is to be the real distortion region corresponding to the suspected distortion region. At the same time, the greater the distortion of the reference segmentation region is, the more likely the reference segmentation region is to be the real distortion region corresponding to the suspected distortion region. Therefore, in this embodiment, the sum of the distortion, distortion and distortion sensitivity of the reference segmentation region is used as the accuracy of the reference segmentation region. By analogy, the accuracy of each reference segmentation region is obtained. It is known that the greater the accuracy is, the more likely the corresponding reference segmentation region is to be the real distortion region corresponding to the suspected distortion region. Therefore, in this embodiment, the reference segmentation region corresponding to the maximum accuracy is used as the real distortion region of the suspected distortion region. It should be noted that the maximum preset domain block side length does not have an adjacent next preset domain block side length. Therefore, in this embodiment, the accuracy of the reference segmentation region corresponding to the maximum preset domain block side length is not obtained.
[0043] At this point, the real distortion area of each suspected distortion area is obtained, and the tangential distortion range in the grayscale image that cannot be calibrated by the calibration plate due to the depression of the background plate is accurately obtained, that is, the distortion area in the grayscale image is accurately determined. In order to accurately display the distortion area in the grayscale image, a mask is created for the detected real distortion area, and it is accurately displayed on the display, which is conducive to accurate correction of the distortion, thereby effectively improving the camera imaging accuracy.
[0044] In summary, the present embodiment obtains a grayscale image taken by a camera; obtains the segmented area corresponding to the grayscale image under different preset domain block side lengths through an adaptive threshold segmentation algorithm, obtains the degree of distortion and then screens out the suspected distorted area according to the edge grayscale change and internal grayscale distribution of the segmented area, and the positional relationship between the segmented area and its neighboring segmented area; obtains the real distorted area of the suspected distorted area according to the degree of distortion of the segmented area corresponding to the suspected distorted area under different preset domain block side lengths, and the difference in distortion degree with the segmented area corresponding to the adjacent preset domain block side lengths. The present invention improves the accuracy of obtaining the real distorted area in the grayscale image by analyzing the segmented area under different preset domain block side lengths, which is conducive to accurate adjustment of the distortion.
[0045] Embodiment 2: The present invention also proposes a precise calibration system for distortion of a photographic camera, see Figure 3 , which shows a structural diagram of a distortion precision calibration system for a photographic camera provided by an embodiment of the present invention. The system includes: an image acquisition module 10, a distortion degree acquisition module 20 and a real distortion area acquisition module 30.
[0046] The image acquisition module 10 is used to acquire the grayscale image taken by the camera.
[0047] The distortion degree acquisition module 20 is used to obtain the segmented areas corresponding to the grayscale image under different preset domain block side lengths through an adaptive threshold segmentation algorithm, and obtain the distortion degree of each segmented area according to the edge grayscale change and internal grayscale distribution of each segmented area, as well as the positional relationship between each segmented area and its neighboring segmented area.
[0048] The real distortion region acquisition module 30 is used to screen out suspected distortion regions based on the degree of distortion; and obtain the real distortion region of each suspected distortion region according to the degree of distortion of the segmented region corresponding to each suspected distortion region under different preset domain block side lengths, and the difference in distortion degree between the segmented region corresponding to the adjacent preset domain block side lengths.
[0049] It should be noted that: the system provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device is divided into different functional modules to complete all or part of the functions described above. In addition, the distortion precision calibration system of a photographic camera provided in the above embodiment and the distortion precision calibration method embodiment of a photographic camera belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0050] Embodiment 3: The present invention also proposes a precise calibration device for distortion of a photographic camera, see Figure 4 The device includes a memory 401, a processor 402, and a computer program 403 stored in the memory 401 and running on the processor 402, wherein when the processor 402 executes the computer program 403, the computer device can execute any one of the above-mentioned methods for precisely calibrating the distortion of a photographic camera.
[0051] Embodiment 4: This embodiment also provides a computer-readable storage medium, in which a computer program code is stored. When the computer program code is executed on a computer, the computer executes the above-mentioned related method steps to implement a method for precise distortion calibration of a photographic camera provided in the above embodiment.
[0052] Embodiment 5: The present invention also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement a method for precisely calibrating distortion of a photographic camera provided in the above-mentioned embodiment.
[0053] Among them, the device, computer-readable storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be repeated here.
[0054] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0055] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
Claims
1. A method for accurately calibrating distortion of a photographic camera, characterized in that: The method comprises the following steps: Get the grayscale image taken by the camera; The segmentation area corresponding to the grayscale image under different preset domain block side lengths is obtained through an adaptive threshold segmentation algorithm, and the degree of distortion of each segmentation area is obtained according to the edge grayscale change and internal grayscale distribution of each segmentation area, as well as the positional relationship between each segmentation area and its neighboring segmentation area; The suspected distorted areas are screened out based on the degree of distortion; the real distorted area of each suspected distorted area is obtained according to the degree of distortion of the segmented area corresponding to each suspected distorted area under different preset domain block side lengths, and the difference in distortion degree with the segmented area corresponding to the adjacent preset domain block side lengths.
2. The method for accurately calibrating distortion of a photographic camera as claimed in claim 1, characterized in that: The method for obtaining the degree of distortion is: According to the grayscale change of each segmented area, the grayscale gradient of each segmented area is obtained; According to the internal grayscale distribution of each segmented area, the grayscale clutter degree of each segmented area is obtained; According to the positional relationship between each segmented area and its neighboring segmented areas, the local abnormality degree of each segmented area is obtained; The grayscale gradient degree, grayscale clutter degree and local abnormality degree of each segmented area are added and normalized to obtain the distortion degree of each segmented area.
3. The method for accurately calibrating distortion of a photographic camera as claimed in claim 2, characterized in that: The method for obtaining the grayscale gradient degree is: For any segmented area and any edge pixel point of the segmented area, a preset number of pixels closest to the edge pixel point on a straight line where a normal line corresponding to the edge pixel point is located are obtained as neighborhood pixels of the edge pixel point; Taking the neighboring pixel point that is farthest from the edge pixel point and has the smallest grayscale value as the starting point, the neighboring pixel points are sorted according to the position order of the neighboring pixel points on the straight line where the normal line is located, as a neighborhood pixel point sequence; The grayscale values corresponding to the neighboring pixel points in the neighborhood pixel point sequence are fitted into a straight line by the least square method as the target straight line; According to the root mean square error and the absolute value of the slope of the target straight line, the grayscale smoothness of the edge pixel point is obtained; wherein the root mean square error and the absolute value of the slope are both negatively correlated with the grayscale smoothness; The average value of the grayscale smoothness of all edge pixels in the segmented area is obtained as the grayscale gradient of the segmented area.
4. The method for accurately calibrating distortion of a photographic camera as claimed in claim 2, characterized in that: The method for obtaining the grayscale clutter degree is: For any segmented area and any pixel in the segmented area, obtain the grayscale value difference between each preset neighborhood pixel of the pixel and the pixel, and use them as the first difference; The result of accumulating and normalizing all the first differences is used as the prominence of the pixel; Obtaining the prominence degree of each pixel in the segmented area, when the prominence degree is greater than a preset prominence degree threshold, the corresponding pixel is a prominence pixel; The ratio of the number of prominent pixels in the segmented area to the number of all pixels inside it is taken as the grayscale clutter degree of the segmented area.
5. The method for accurately calibrating distortion of a photographic camera as claimed in claim 2, characterized in that: The method for obtaining the local abnormality degree is: For any segmented area, other segmented areas where preset neighboring pixels of all edge pixels of the segmented area are located are used as neighboring segmented areas of the segmented area; Acquire the number of edge pixel points of the segmented area whose preset neighborhood pixel points are located in the neighborhood segmented area as the first number; The ratio of the first number to the number of all edge pixels in the segmented area is used as the local abnormality degree of the segmented area.
6. The method for accurately calibrating distortion of a photographic camera as claimed in claim 1, characterized in that: The method for obtaining the suspected distortion area is: When the distortion degree is greater than a preset distortion degree threshold, the corresponding segmented area is a suspected distortion area.
7. The method for accurately calibrating distortion of a photographic camera as claimed in claim 1, characterized in that: The method for obtaining the real distortion area is: For any suspected distorted region, the segmented region corresponding to the suspected distorted region under each preset domain block side length is obtained, and all of them are used as reference segmented regions of the suspected distorted region; For any reference segmented region, the difference in the degree of distortion of the reference segmented region under the next adjacent preset domain block side length of the reference segmented region and its corresponding preset domain block side length is obtained as the degree of distortion of the reference segmented region; wherein the arrangement order of the preset domain block side lengths is from small to large; Obtaining the average value of the distortion degree of all segmented areas of the grayscale image under the preset domain block side length corresponding to the reference segmented area as the distortion sensitivity degree; The product of the distortion degree, the distortion significance degree and the distortion sensitivity degree of the reference segmentation region is used as the accuracy degree of the reference segmentation region; The reference segmentation region corresponding to the maximum accuracy is used as the real distortion region of the suspected distortion region.
8. The method for accurately calibrating distortion of a photographic camera as claimed in claim 7, characterized in that: The method for obtaining the reference segmentation area is: For any suspected distorted region, a segmented region with the highest probability of overlapping with the suspected distorted region under each preset domain block side length is used as a reference segmented region of the suspected distorted region.
9. A precise distortion calibration system for a photographic camera, characterized in that: The system comprises: An image acquisition module, used to acquire a grayscale image taken by a camera; The distortion degree acquisition module is used to obtain the segmented areas corresponding to the grayscale image under different preset domain block side lengths through an adaptive threshold segmentation algorithm, and obtain the distortion degree of each segmented area according to the edge grayscale change and internal grayscale distribution of each segmented area, as well as the positional relationship between each segmented area and its neighboring segmented area; The real distortion area acquisition module is used to screen out suspected distortion areas based on the degree of distortion; according to the degree of distortion of the segmented area corresponding to each suspected distortion area under different preset domain block side lengths, and the difference in distortion degree with the segmented area corresponding to the adjacent preset domain block side lengths, the real distortion area of each suspected distortion area is obtained.
10. A precise distortion calibration device for a photographic camera, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When executing the computer program, the processor implements the steps of the method for precise distortion calibration of a photographic camera as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Method and system for detecting surface quality of automobile cover plate by using optical means
CN114638822A
Integrating instrument shell defect detection method based on artificial intelligence
CN116883408A
Motor carbon brush holder wear unbalance degree detection method
CN118608531A
Bronchoscope aided navigation method for respiratory infectious diseases
CN118787301A
Image analysis method and camera apparatus
US20240046497A1