Image correction method and device
By placing circular grid paper on the inner wall of the cylinder liner and taking images, the correction files are extracted to correct the target image, which solves the distortion problem during the acquisition of the inner wall of the cylinder liner, reduces the risk of false detection and improves the accuracy of detection.
Patent Information
- Application Number
- CN202411659389.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2024-12-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art has distortions in the acquisition of the inner wall of the cylinder liner, resulting in differences in defects of the same size in the image, resulting in mis-checking.
Place a circular black and white grid paper on the inner wall, and take and extract the image of the grid paper. By expanding it, a correction file of the rectangular image is obtained. The target image is corrected based on the file to ensure that the shooting position of the camera equipment is consistent.
By correcting the file, the distortion of the target image is greatly reduced, the hidden dangers of false detection are significantly reduced, and the accuracy of detection is improved.
Smart Images

Figure CN119151805A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image correction, and in particular to an image correction method and device. Background Art
[0002] At present, when the existing technology collects images of the inner wall of the cylinder sleeve, the collected images are distorted. Due to the different collection positions of the camera equipment, the imaging effects of defects of the same size in the inner wall are different. For example, a 10mm defect is distorted, resulting in the size of the near end and the far end of the image being 8mm and 12mm respectively. If the measurement accuracy is 10mm, that is, defects larger than 10mm need to be detected, there will be false detection. Summary of the invention
[0003] In view of this, the purpose of the present invention is to provide an image correction method and device to obtain a correction file for the image of the inner wall, which can greatly reduce the distortion of the target image and the risk of false detection.
[0004] In a first aspect, an embodiment of the present invention provides an image correction method, the method comprising: placing a circular black and white grid paper on an inner wall, capturing a first image including the grid paper; extracting a grid area of the grid paper included in the first image to obtain a circular second image; expanding the second image to obtain a rectangular third image, and determining a correction file for the third image; correcting a target image based on the correction file; wherein the target image is an image captured of the inner wall, and the position at which the camera captures the target image is the same as the position at which the first image is captured.
[0005] In an optional embodiment of the present application, the step of placing a circular black and white grid paper on the inner wall includes: controlling a robot carrying a camera device to reach a teaching point, and controlling the camera device to capture an internal image of the inner wall; determining a placement area of the grid paper on the inner wall based on the internal image of the inner wall; rolling the rectangular black and white grid paper into a circular shape based on the size of the inner wall, and placing the circular black and white grid paper in the placement area of the inner wall.
[0006] In an optional embodiment of the present application, the above method also includes: determining the size of the square based on the size of the inner wall and the field of view of the camera device; arranging alternating black squares and white squares in sequence based on the size of the square to obtain a rectangular black and white grid paper.
[0007] In an optional embodiment of the present application, the step of capturing the first image including the grid paper includes: controlling a robot carrying a camera device to reach a teaching point, and controlling the camera device to capture the first image including the grid paper; the method also includes: controlling a robot carrying a camera device to reach a teaching point, and controlling the camera device to capture the target image.
[0008] In an optional embodiment of the present application, after the above-mentioned step of determining the correction file of the third image, the method also includes: correcting and expanding the first image based on the correction file to obtain a rectangular fourth image; determining whether the detection area of the fourth image covers the grid area of the grid paper; if the detection area does not cover the grid area, adjusting the placement area of the grid paper; if the detection area covers the grid area, determining that the placement area of the grid paper is qualified; if the boundary of the detection area is aligned with the boundary of the grid area, adjusting the placement area of the grid paper.
[0009] In an optional embodiment of the present application, after the step of extracting the grid area of the grid paper included in the first image to obtain the circular second image, the method further includes: if the corner points of the grid paper are not extracted, adding the coordinates of the corner points to the array; if the corner points of the grid paper are extracted as more than two groups of coordinates, retaining one group of coordinates of the corner points at the most central position from the extracted more than two groups of coordinates, and adding the one group of coordinates of the corner points to the array; the step of determining the correction file of the third image includes: generating a correction parameter matrix of the third image based on the array, and using the correction parameter matrix as the correction file of the third image.
[0010] In an optional embodiment of the present application, the above method also includes: if the grid paper is in the shape of a semicircular ring, photographing a first patchwork image including the grid paper, extracting a grid area of the grid paper included in the first patchwork image to obtain a second patchwork image in the shape of a semicircular ring; moving the grid paper, and determining a second patchwork image including the moved grid paper after each movement; and splicing multiple second patchwork images to obtain a second image.
[0011] In an optional embodiment of the present application, the step of determining the correction file of the third image includes: performing polar coordinate transformation on the third image to determine the corner point matrix of the third image after the polar coordinate transformation; mapping based on the corner point matrix to obtain a correction parameter matrix of the third image; wherein the correction parameter matrix is used to perform distortion correction on the image; and using the correction parameter matrix as the correction file of the third image.
[0012] In an optional embodiment of the present application, the above-mentioned step of correcting the target image based on the correction file includes: reading the correction file and the target image to be corrected; inputting the correction file and the target image as parameters into the mapping operator, and outputting the corrected target image; performing defect screening processing and / or size calculation processing on the corrected target image.
[0013] In a second aspect, an embodiment of the present invention further provides an image correction device, comprising: a first image shooting module, used to place a circular black and white grid paper on the inner wall, and shoot a first image including the grid paper; a grid area extraction module, used to extract the grid area of the grid paper included in the first image to obtain a circular second image; a correction file determination module, used to expand the second image to obtain a rectangular third image, and determine the correction file of the third image; a target image correction module, used to correct the target image based on the correction file; wherein the target image is an image shot of the inner wall, and the position where the camera device shoots the target image is the same as the position where the first image is shot.
[0014] The embodiments of the present invention bring the following beneficial effects: The embodiment of the present invention provides an image correction method and device, which includes placing a circular black and white grid paper on the inner wall, capturing a first image including the grid paper; extracting the grid area of the grid paper included in the first image to obtain a circular second image; expanding the second image to obtain a rectangular third image, determining a correction file for the third image; and correcting a target image based on the correction file; wherein the target image is an image captured of the inner wall, and the position where the camera captures the target image is the same as the position where the first image is captured. In this way, a correction file for the image of the inner wall can be obtained, and the distortion of the target image can be greatly reduced through the correction file, thereby greatly reducing the risk of false detection.
[0015] Other features and advantages of the present disclosure will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present disclosure.
[0016] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 A schematic diagram of a 10 mm defect detection image provided by an embodiment of the present invention; Figure 2 A flowchart of an image correction method provided by an embodiment of the present invention; Figure 3A flowchart of another image correction method provided by an embodiment of the present invention; Figure 4 A schematic diagram of an internal image of an inner wall provided by an embodiment of the present invention; Figure 5 A schematic diagram of a first image provided by an embodiment of the present invention; Figure 6 A schematic diagram of a first image and a second image provided by an embodiment of the present invention; Figure 7 A schematic diagram of a third image provided by an embodiment of the present invention; Figure 8 A schematic diagram of another first image provided by an embodiment of the present invention; Fig. 9 A schematic diagram of another third image provided by an embodiment of the present invention; Fig.10 A schematic diagram of the structure of an image correction device provided by an embodiment of the present invention; Fig.11 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0019] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0020] At present, when the existing technology collects images of the inner wall of the cylinder liner, the collected images are distorted. Due to the different collection positions of the camera equipment, the imaging effects of defects of the same size in the inner wall are different. For example, see Figure 1 The figure shows a schematic diagram of a 10mm defect detection image. Due to distortion, the 10mm defect is 8mm and 12mm in size at the near and far ends of the image respectively. If the measurement accuracy is 10mm, that is, defects larger than 10mm need to be detected, there will be false detections.
[0021] Based on this, an image correction method and device provided in an embodiment of the present invention specifically provides a method for endoscopic image correction, which can obtain a correction file for the image of the inner wall. The correction file can greatly reduce the distortion of the target image and greatly reduce the risk of false detection.
[0022] To facilitate understanding of this embodiment, an image correction method disclosed in an embodiment of the present invention is first introduced in detail.
[0023] Embodiment 1: An embodiment of the present invention provides an image correction method. In this embodiment, different camera devices are first selected for shooting according to different aperture sizes of the inner wall. For example: if the diameter of the inner wall of the hole is greater than 100 mm, a fisheye lens is used for shooting. If the diameter of the inner wall of the hole is 25 mm-100 mm, a lighthouse lens is used for shooting. If the diameter of the inner wall of the hole is less than 25 mm, a straight rod endoscope lens is used for shooting. The distortion rates of the above-mentioned lenses are different, and the imaging distortion rates are generally around ±10%. Therefore, in the detection of the size of defects on the inner wall, the distortion has a great influence on the imaging.
[0024] Fisheye lens is an extreme wide-angle lens, also known as panoramic lens. It introduces barrel distortion and compresses a large area to obtain ultra-wide-angle imaging with a viewing angle greater than 180°, or even more than 270°. The design of this lens is inspired by the phenomenon that when fish observe things on the water surface in water, their viewing angle can reach a wide angle of nearly 180°.
[0025] Fisheye lenses are usually constructed of a multi-layer lens group, with a front lens that is short in diameter and bulges toward the front of the lens in a parabolic shape, similar in shape to a fish's eye. Light entering the fisheye lens is refracted multiple times before forming an image on the camera's imaging chip. This design enables the fisheye lens to capture a wider field of view.
[0026] Regarding non-similar imaging, the fisheye lens does not meet the traditional principle of object-image similarity imaging, but adopts non-similar imaging. It breaks through the limitations of imaging angle of view by compressing the diameter space, thereby achieving wide-angle imaging. During the imaging process, the fisheye lens will introduce barrel distortion, that is, the straight lines in the image will appear curved, but this distortion does not affect the resolution, and can ensure the one-to-one correspondence between object points and image points.
[0027] Regarding the projection model, fisheye lens imaging involves multiple projection models, such as stereoscopic projection, equidistant projection, equi-stereoscopic projection, and orthogonal projection. These models have their own characteristics, but they can all describe the object-image mapping relationship of fisheye lens imaging to a certain extent. Among them, the equidistant projection model is widely used because it is easy to calculate and can produce sufficient barrel distortion, so that scenes with a large field of view can be compressed and imaged.
[0028] Regarding the coordinate system, in the imaging process of the fisheye camera, four coordinate systems are mainly involved, namely the world coordinate system, the camera coordinate system, the image physical coordinate system and the image pixel coordinate system. All object points in the three-dimensional space are first mapped onto the spherical surface, and all points on the spherical surface are then nonlinearly projected onto the imaging surface of the fisheye image.
[0029] Regarding application and development, fisheye lenses have important applications in astronomy, meteorology, forest fire prevention, etc. due to their unique imaging characteristics. At the same time, with the continuous development of optical engineering technology, the design of fisheye lenses is also being continuously optimized to meet a wider range of imaging needs.
[0030] In summary, the imaging principle of the fisheye lens is a complex and interesting process. It achieves ultra-wide-angle imaging of a large range of space by introducing barrel distortion and non-similar imaging ideas.
[0031] A pyramid endoscope refers to an endoscope in which a component of its optical system has a pyramid shape, which utilizes the optical properties of the pyramid, such as reflection, refraction or total reflection.
[0032] In an optical prism, light is reflected on different surfaces of the prism to form a specific light path. If a part of the endoscope is designed in a pyramid shape and these reflective surfaces are cleverly used, the light can be precisely controlled and guided, thereby enhancing the clarity and contrast of the image.
[0033] The pyramid-shaped design may also help reduce the size and weight of the endoscope and improve its maneuverability in narrow cavities.
[0034] The optical properties of prisms are widely used in the design of endoscopes. Specifically, prisms can be used in the image transfer system of endoscopes to achieve precise control of light and clear imaging. For example, a right-angle prism can be used to change the propagation direction of light so that the light can be transmitted along the axis of the endoscope.
[0035] In summary, the imaging principles of different lenses are different, the applicable aperture size ranges are different, and the distortion amounts are also different. The method of using direct algorithms to extract AI detection defect detection frames to determine the size of defects will produce a certain misjudgment rate. In addition, the offset of the imaging lens's posture will also have a great impact on the results.
[0036] Based on the above description, see Figure 2 A flowchart of an image correction method is shown, the image correction method comprising the following steps: Step S202: placing a circular black and white grid paper on the inner wall, and capturing a first image including the grid paper.
[0037] In this embodiment, a circular black and white grid paper can be placed on the inner wall in advance, and the grid paper placed on the inner wall can be photographed by a camera device to obtain a first image. The circular black and white grid paper is a type of calibration plate, called a black and white checkerboard calibration plate. In addition, any other type of calibration plate can also be used in this embodiment, and this embodiment is not limited to this.
[0038] Step S204: extracting the grid area of the grid paper included in the first image to obtain a second image in a circular shape.
[0039] After acquiring the first image, a second annular image may be obtained by extracting a grid area of the grid paper included in the first image.
[0040] First, the coordinates of the corners of the first image can be determined, which can be determined by HALCON operators. HALCON is a machine vision and image processing software that provides an efficient development platform, supports 3D vision technology, and provides innovative target recognition and high-speed machine vision. The software has functions such as camera calibration technology, visual motion control design, and markerless image detection, and is widely used in many industries.
[0041] However, when using the above HALCON operator to determine the corner points, it is easy to find incomplete coordinates, or there may be two corner point coordinates for one corner, so you can also manually write an algorithm to find the corner point coordinates to find each corner point and filter the corner points.
[0042] After finding the coordinates of the corner points of the first image, in this embodiment, the correction operator of HALCON can be used to extract the grid area and generate a MAP correction file.
[0043] Step S206, expanding the second image to obtain a rectangular third image, and determining a correction file of the third image.
[0044] The circular second image is expanded to obtain a rectangular third image. In this embodiment, the correction file is determined based on the rectangular third image, and the correction file can be used to correct the target image, thereby significantly reducing distortion. The correction file can be obtained by MAP mapping the third image.
[0045] Step S208, correcting the target image based on the correction file; wherein the target image is an image taken of the inner wall, and the position where the camera device takes the target image is the same as the position where the first image is taken.
[0046] After obtaining the correction file, in this embodiment, the target image of the inner wall collected subsequently can be corrected based on the correction file to obtain a substantially distortion-free image, effectively reducing the amount of distortion of the defect imaging size. Wherein, the target image does not include the grid paper, and it is only necessary to ensure that the position where the camera device takes the target image is the same as the position where the first image is taken.
[0047] The embodiment of the present invention provides an image correction method, which includes placing a circular black and white grid paper on the inner wall, capturing a first image including the grid paper; extracting the grid area of the grid paper included in the first image by a correction operator to obtain a circular second image; expanding the second image to obtain a rectangular third image, determining a correction file for the third image; and correcting a target image based on the correction file; wherein the target image is an image captured of the inner wall, and the position where the camera captures the target image is the same as the position where the first image is captured. In this way, a correction file for the image of the inner wall can be obtained, and the distortion of the target image can be greatly reduced by the correction file, thereby greatly reducing the risk of false detection.
[0048] Embodiment 2: This embodiment provides another image correction method, which is implemented on the basis of the above embodiment. Figure 3 Another image correction method is shown in the flowchart, the image correction method comprises the following steps: Step S302, placing a circular black and white grid paper on the inner wall; controlling the robot carrying the camera device to reach the teaching point, and controlling the camera device to capture a first image including the grid paper.
[0049] In some embodiments, a robot carrying a camera device can be controlled to reach a teaching point, and the camera device can be controlled to capture an internal image of the inner wall; based on the internal image of the inner wall, a placement area for the grid paper on the inner wall is determined; based on the size of the inner wall, the rectangular black and white grid paper is rolled into a ring shape, and the ring-shaped black and white grid paper is placed in the placement area of the inner wall.
[0050] The robot in this embodiment can carry a camera device, and the robot can be controlled to reach the teaching point, and the camera device can be controlled to capture the internal image of the inner wall. Figure 4 A schematic diagram of an internal image of an inner wall is shown. Figure 4 The internal image of the inner wall and the detection area of the internal image of the inner wall are shown. The detection area can be used as the placement area of the grid paper on the inner wall.
[0051] In some embodiments, the size of the square can also be determined based on the size of the inner wall and the field of view of the camera device; and black squares and white squares are arranged alternately in sequence based on the size of the square to obtain a rectangular black and white grid paper.
[0052] In this embodiment, the size of the square can be determined based on the size of the inner wall and the field of view of the camera device, for example: 5×5, 10×10 or other sizes. The size of the square is the size of the black square and the white square in the grid. In this embodiment, a black and white grid can be generated according to the size of the square. Then print the grid according to the actual size 1:1, and roll the grid paper into a ring according to the size of the inner hole.
[0053] After the circular grid paper is placed into the inner wall, the robot carrying the camera device can be controlled to reach the teaching point, and the camera device can be controlled to capture the first image including the grid paper. Figure 5 A schematic diagram of a first image is shown, Figure 5 A first image including grid paper and a detection area of the first image are shown.
[0054] Step S304: extracting the grid area of the grid paper included in the first image to obtain a second image in a circular shape.
[0055] In this embodiment, the HALCON operator or manually written algorithm can be used to find the coordinates of the corner points, and then the HALCON correction operator is used to extract the grid area and generate a MAP correction file.
[0056] The logic of the manually written algorithm can be: find the intersection point of the black and white edges by using the canny operator, the soble operator or the measurement handle, and then fit the straight line through the point. After all the straight lines are found, the intersection point of the straight lines is the corner point to be found.
[0057] See also Figure 6 A schematic diagram of a first image and a second image is shown, Figure 6 A specific method of extracting the grid area of the grid paper included in the first image to obtain the circular second image is shown.
[0058] Step S306, expanding the second image to obtain a rectangular third image, and determining a correction file of the third image.
[0059] See also Figure 7 A schematic diagram of a third image is shown, in which the second image is expanded to obtain a rectangular third image. In this embodiment, a correction file of the third image can be determined, and the correction file can be used to correct the target image, thereby significantly reducing distortion.
[0060] In some embodiments, the first image can also be corrected and expanded based on the correction file to obtain a rectangular fourth image; determine whether the detection area of the fourth image covers the grid area of the grid paper; if the detection area does not cover the grid area, adjust the placement area of the grid paper; if the detection area covers the grid area, determine that the placement area of the grid paper is qualified; if the boundary of the detection area is aligned with the boundary of the grid area, adjust the placement area of the grid paper.
[0061] In this embodiment, the correction file can be used to correct and expand the first image to obtain a rectangular fourth image, and detect whether the detection area of the fourth image covers the grid area of the grid paper. If the detection area does not cover the grid area, the placement area of the grid paper can be adjusted so that the detection area covers the grid area. If the detection area covers the grid area, it can be considered that the placement area of the grid paper is qualified.
[0062] Also, if the border of the detection area is aligned with the border of the grid area, you can slightly move the placement area of the grid paper so that the detection area covers the grid area.
[0063] In some embodiments, if the corner points of the grid paper are not extracted, the coordinates of the corner points are added to an array; if the corner points of the grid paper are extracted as more than two sets of coordinates, one set of coordinates of the corner points at the most central position is retained from the extracted more than two sets of coordinates, and the one set of coordinates of the corner points is added to the array; a correction parameter matrix of the third image can also be generated based on the array, and the correction parameter matrix can be used as a correction file of the third image.
[0064] In this embodiment, when extracting corner points of the grid paper, all corner points of the grid paper need to be extracted. If some corner points are not extracted when extracting the grid, or more than two sets of coordinates are extracted for a corner point, an incomplete MAP correction file will be generated. Therefore, it is necessary to manually extract the coordinates of the corner points and add them to the array; or remove the redundant coordinates of a corner point in the array and only keep one set of coordinates of the corner point.
[0065] If one corner point is extracted as more than two sets of coordinates, all extracted coordinates can be displayed using the display function to mark the cross. By zooming in on the displayed image, you can find that only one set of coordinates is at the center of the corner point, and the rest are nearby. Therefore, you can determine the coordinates of one set of corner points at the center and keep them.
[0066] The correction file in this embodiment can be a parameter matrix array. The above corner points are the cross intersections of the black and white squares of the chessboard. In this embodiment, the correction parameter array (ie, the correction file) can be obtained by performing a mapping operation on the corner point array.
[0067] In some embodiments, if the grid paper is in the shape of a semicircular ring, a first patchwork image including the grid paper is photographed, and a grid area of the grid paper included in the first patchwork image is extracted to obtain a second patchwork image in the shape of a semicircular ring; the grid paper is moved, and after each movement, a second patchwork image including the moved grid paper is determined; and multiple second patchwork images are spliced together to obtain a second image.
[0068] See also Figure 8 Another schematic diagram of the first image is shown. Figure 8The grid paper shown in the figure is in a semicircular shape, and the grid paper does not cover the entire inner wall, so multiple shots are required. For example: the first shot is used to obtain a first patchwork image, and a second patchwork image corresponding to the first patchwork image is extracted; the grid paper is moved, and the first patchwork image after the grid paper is moved is taken again, and a second patchwork image corresponding to the first patchwork image after the grid paper is moved is extracted... Multiple second patchwork images are stitched together to obtain a complete second image.
[0069] See also Fig. 9 Another schematic diagram of a third image is shown, Fig. 9 The third image shown is obviously distorted. Therefore, this embodiment can significantly reduce the distortion of the third image and determine the correction file of the third image.
[0070] In some embodiments, the third image can be transformed into polar coordinates to determine the corner point matrix of the third image after the polar coordinate transformation; a correction parameter matrix of the third image is obtained by mapping based on the corner point matrix; wherein the correction parameter matrix is used to correct the distortion of the image; and the correction parameter matrix is used as a correction file of the third image.
[0071] In this embodiment, by expanding the polar coordinate transformation, the correction parameter matrix of the third image can be mapped based on the corner point matrix of the third image after the polar coordinate transformation, and the correction parameter matrix is saved. For example, the correction parameter matrix can refer to a schematic table of a correction parameter matrix shown in Table 1. Wherein, Row and Col represent row and column respectively.
[0072]
[0073] Table 1 Step S308, controlling the robot carrying the camera device to reach the teaching point, controlling the camera device to capture the target image; and correcting the target image based on the correction file.
[0074] This embodiment can map the saved correction parameter matrix to the target image of the inner wall that is subsequently photographed. It is necessary to ensure that the position where the camera captures the target image and the position where the camera captures the first image are the same, for example, both can be pre-set teaching points. The defect size distortion on the target image can be controlled within a very small range, thereby greatly reducing the distortion on the target image.
[0075] In some embodiments, a correction file and a target image to be corrected may be read; the correction file and the target image may be input as parameters into a mapping operator to output a corrected target image; and defect screening processing and / or size calculation processing may be performed on the corrected target image.
[0076] In this embodiment, the correction file and the target image to be corrected can be read. The mapping operator is applied to pass the correction file and the target image seat parameters read above, so as to obtain the corrected target image. After that, the subsequent defect size screening (i.e., defect screening processing) or other size calculations (i.e., size calculation processing) can be performed on the corrected target image.
[0077] The above method provided in this embodiment is applied to a fisheye lens, and can be used to test an actual 10mm line segment and a 10×10mm rectangle, with a distortion of approximately ±2%. The above method provided in this embodiment is applied to a lighthouse lens, and can be used to test an actual 2.5mm line segment, with a distortion of approximately ±3%.
[0078] In summary, the above method provided by this embodiment can place a circular black and white grid paper on the inner wall, and the robot carries the camera device to the preset teaching point, and the camera device captures a first image including the grid paper; extracts the grid area of the grid paper included in the first image to obtain a circular second image; expands the second image to obtain a rectangular third image, and determines the correction file of the third image. The target image subsequently captured by the camera device at the above teaching point is corrected, so that the distortion of the target image is greatly reduced through the correction file, and the hidden danger of false detection is greatly reduced.
[0079] In addition, the above method provided in this embodiment can also correct and expand the first image based on the correction file to obtain a rectangular fourth image; determine whether the detection area of the fourth image covers the grid area of the grid paper; if the detection area does not cover the grid area, adjust the placement area of the grid paper; if the detection area covers the grid area, determine that the placement area of the grid paper is qualified. If the boundary of the detection area is aligned with the boundary of the grid area, adjust the placement area of the grid paper to ensure that the detection area is completely covered by the grid paper. The correction file is thus verified to obtain a qualified correction file, which is used to correct the target image, thereby significantly reducing distortion.
[0080] In addition, in the above method provided by this embodiment, if the corner points of the grid paper are not extracted, the coordinates of the corner points are added to the array; if the corner points of the grid paper are extracted as more than two groups of coordinates, one group of coordinates of the corner points at the most central position is retained from the extracted more than two groups of coordinates, and the coordinates of the one group of corner points are added to the array; the correction parameter matrix of the third image can also be generated based on the array, and the correction parameter matrix is used as the correction file of the third image. Thus, a qualified correction file is obtained, which is used to correct the target image, thereby greatly reducing distortion.
[0081] In addition, in the above method provided by this embodiment, if the grid paper is in the shape of a semicircular ring, a first patchwork image including the grid paper is photographed, and the grid area of the grid paper included in the first patchwork image is extracted to obtain a second patchwork image in the shape of a semicircular ring; the grid paper is moved, and after each movement, a second patchwork image including the moved grid paper is determined; and a plurality of second patchwork images are spliced to obtain a second image. Even if the grid paper is in the shape of a semicircular ring, a qualified second image can be obtained by splicing, thereby obtaining a qualified correction file, which is used to correct the target image, thereby significantly reducing distortion.
[0082] Embodiment three: Corresponding to the above method embodiment, the present invention provides an image correction device, see Fig.10 A structural schematic diagram of an image correction device is shown, the image correction device comprising: The first image capturing module 1001 is used to place a circular black and white grid paper on the inner wall and capture a first image including the grid paper; A grid area extraction module 1002 is used to extract the grid area of the grid paper included in the first image to obtain a second image in a circular shape; A correction file determination module 1003 is used to expand the second image to obtain a rectangular third image, and determine a correction file of the third image; The target image correction module 1004 is used to correct the target image based on the correction file; wherein the target image is an image taken of the inner wall, and the position where the camera device takes the target image is the same as the position where the first image is taken.
[0083] The embodiment of the present invention provides an image correction device, which places a circular black and white grid paper on the inner wall, captures a first image including the grid paper; extracts the grid area of the grid paper included in the first image to obtain a circular second image; expands the second image to obtain a rectangular third image, determines the correction file of the third image; and corrects the target image based on the correction file; wherein the target image is an image captured of the inner wall, and the position where the camera captures the target image is the same as the position where the first image is captured. In this way, a correction file for the image of the inner wall can be obtained, and the distortion of the target image can be greatly reduced through the correction file, thereby greatly reducing the risk of false detection.
[0084] The above-mentioned first image capture module is used to control the robot carrying the camera device to reach the teaching point, and control the camera device to capture the internal image of the inner wall; determine the placement area of the grid paper on the inner wall based on the internal image of the inner wall; roll the rectangular black and white grid paper into a ring shape based on the size of the inner wall, and place the ring-shaped black and white grid paper in the placement area of the inner wall.
[0085] The first image capturing module is also used to determine the size of the square based on the size of the inner wall and the field of view of the camera device; and to arrange alternating black squares and white squares in sequence based on the size of the square to obtain a rectangular black and white grid paper.
[0086] The first image capturing module is used to control the robot carrying the camera device to reach the teaching point and control the camera device to capture the first image including the grid paper; the above-mentioned device also includes: a target image capturing module, which is used to control the robot carrying the camera device to reach the teaching point and control the camera device to capture the target image.
[0087] The above-mentioned device also includes: a placement area adjustment module, which is used to correct and expand the first image based on the correction file to obtain a rectangular fourth image; determine whether the detection area of the fourth image covers the grid area of the grid paper; if the detection area does not cover the grid area, adjust the placement area of the grid paper; if the detection area covers the grid area, determine that the placement area of the grid paper is qualified; if the boundary of the detection area is aligned with the boundary of the grid area, adjust the placement area of the grid paper.
[0088] The above-mentioned device also includes: a corner point coordinate processing module, which is used to add the coordinates of the corner points to the array if the corner points of the grid paper are not extracted; if the corner points of the grid paper are extracted as more than two groups of coordinates, retain one group of coordinates of the corner points at the most central position from the extracted more than two groups of coordinates, and add the one group of coordinates of the corner points to the array; the above-mentioned correction file determination module is used to determine the correction file of the third image based on the array.
[0089] The above-mentioned device also includes: a second image stitching module, which is used to, if the grid paper is in a semicircular shape, shoot a first stitching image including the grid paper, extract the grid area of the grid paper included in the first stitching image to obtain a second stitching image in a semicircular shape; move the grid paper, and determine a second stitching image including the moved grid paper after each movement; and stitch multiple second stitching images to obtain a second image.
[0090] The correction file determination module is used to perform polar coordinate transformation on the third image, determine the corner point matrix of the third image after polar coordinate transformation; obtain the correction parameter matrix of the third image by mapping based on the corner point matrix; wherein the correction parameter matrix is used to perform distortion correction on the image; and use the correction parameter matrix as the correction file of the third image.
[0091] The target image correction module is used to read the correction file and the target image to be corrected; input the correction file and the target image as parameters into the mapping operator, and output the corrected target image; and perform defect screening processing and / or size calculation processing on the corrected target image.
[0092] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the image correction device described above can refer to the corresponding process in the aforementioned embodiment of the image correction method, and will not be repeated here.
[0093] Embodiment 4: The embodiment of the present invention also provides an electronic device for executing the above-mentioned image correction method; see Fig.11 A structural schematic diagram of an electronic device is shown, which includes a memory 100 and a processor 101, wherein the memory 100 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 101 to implement the above-mentioned image correction method.
[0094] Further, Fig.11 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 101 , the communication interface 103 and the memory 100 are connected via the bus 102 .
[0095] An embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned image correction method. The specific implementation can be found in the method embodiment, which will not be repeated here.
[0096] The computer program product of the image correction method and device provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method in the previous method embodiment. The specific implementation can be found in the method embodiment, which will not be repeated here.
[0097] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and / or device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0098] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. An image correction method, characterized in that: The method comprises: Placing a circular black and white grid paper on the inner wall, and capturing a first image including the grid paper; Extracting the grid area of the grid paper included in the first image to obtain a second image in a circular shape; Expanding the second image to obtain a rectangular third image, and determining a correction file of the third image; The target image is corrected based on the correction file; wherein the target image is an image taken of the inner wall, and the position where the camera device takes the target image is the same as the position where the first image is taken.
2. The method according to claim 1, characterized in that The steps of placing a circular black and white grid paper on the inner wall include: Controlling a robot carrying a camera to reach a teaching point, and controlling the camera to capture an internal image of the inner wall; determining a placement area of the grid paper on the inner wall based on the inner image of the inner wall; The rectangular black and white grid paper is rolled into a ring shape based on the size of the inner wall, and the ring-shaped black and white grid paper is placed in the placement area of the inner wall.
3. The method according to claim 2, characterized in that The method further comprises: Determining the size of the block based on the size of the inner wall and the field of view of the camera device; Black and white squares are arranged alternately in sequence based on the size of the squares to obtain a rectangular black and white grid paper.
4. The method according to claim 2, characterized in that: The step of capturing a first image including the grid paper comprises: controlling a robot carrying a camera device to reach the teaching point, and controlling the camera device to capture a first image including the grid paper; The method further includes: controlling a robot carrying a camera to reach the teaching point, and controlling the camera to capture a target image.
5. The method according to claim 1, characterized in that After the step of determining the correction file of the third image, the method further comprises: Correcting and expanding the first image based on the correction file to obtain a rectangular fourth image; determining whether the detection area of the fourth image covers the grid area of the grid paper; If the detection area does not cover the grid area, adjusting the placement area of the grid paper; If the detection area covers the grid area, determining that the placement area of the grid paper is qualified; If the boundary of the detection area is aligned with the boundary of the grid area, the placement area of the grid paper is adjusted.
6. The method according to claim 1, characterized in that After the step of extracting the grid area of the grid paper included in the first image to obtain a second annular image, the method further includes: If the corner points of the grid paper have not been extracted, adding the coordinates of the corner points to an array; If the corner points of the grid paper are extracted as more than two sets of coordinates, the coordinates of one corner point at the most central position are retained from the extracted more than two sets of coordinates, and the coordinates of one set of the corner point are added to the array; The step of determining the correction file of the third image comprises: A correction parameter matrix of the third image is generated based on the array, and the correction parameter matrix is used as a correction file of the third image.
7. The method according to claim 1, characterized in that The method further comprises: If the grid paper is in a semicircular ring shape, photographing a first patchwork image including the grid paper, extracting a grid area of the grid paper included in the first patchwork image to obtain a second patchwork image in a semicircular ring shape; Moving the grid paper, and determining a second patchwork image including the moved grid paper after each movement; The second image is obtained by stitching together a plurality of the second stitched images.
8. The method according to any one of claims 1 to 7, characterized in that: The step of determining the correction file of the third image comprises: Performing polar coordinate transformation on the third image to determine a corner point matrix of the third image after polar coordinate transformation; Mapping is performed based on the corner point matrix to obtain a correction parameter matrix of the third image; wherein the correction parameter matrix is used to perform distortion correction on the image; The correction parameter matrix is used as a correction file of the third image.
9. The method according to any one of claims 1 to 7, characterized in that: The step of correcting the target image based on the correction file comprises: Reading the correction file and the target image to be corrected; Input the correction file and the target image as parameters into a mapping operator, and output a corrected target image; The corrected target image is subjected to defect screening processing and / or size calculation processing.
10. An image correction device, characterized in that: The device comprises: A first image capturing module, used for placing a circular black and white grid paper on the inner wall and capturing a first image including the grid paper; A grid area extraction module, used for extracting the grid area of the grid paper included in the first image to obtain a second image in a circular shape; a correction file determination module, configured to expand the second image to obtain a rectangular third image, and determine a correction file of the third image; A target image correction module is used to correct the target image based on the correction file; wherein the target image is an image taken of the inner wall, and the position where the camera device takes the target image is the same as the position where the first image is taken.
Citation Information
Patent Citations
Camera distortion image correction method based on polar coordinates
CN111383194A
Hole inner surface defect detection and measurement method based on endoscopic image
CN114648518A
Distortion correction method, device, equipment and system of surround view lens and storage medium
CN116245748A
Method and device for detecting defects on inner wall of cylinder of long barrel and storage medium
CN117214172A
Calibration plate position adjusting device in airway particle image velocity measurement test glass cylinder sleeve
CN210090502U
