A method for initial positioning of periodic images

Through a new periodic image initial positioning method, through steps such as splicing and template matching, the problem of time-consuming and resource waste in the positioning method in the prior art is solved, and a faster and more reliable positioning effect is achieved.

CN114757991BActive Publication Date: 2025-05-13HANGZHOU ZHANTUO INTELLIGENT TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210488566.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-06
Publication Date
2025-05-13
Estimated Expiration
2042-05-06

AI Technical Summary

Technical Problem

In the prior art, the initial positioning method of periodic images has problems of high modification costs and waste of resources, and the running time is long, which is not conducive to the rapid processing of the image.

Method used

An initial positioning method for periodic images is proposed, including collecting production line images and stitching into a minimum complete cycle image, circle the positioning core and performing template matching, obtaining the best matching point, combining the positioning core positioning core area and expanding the actual height of the plate-circumference, and performing template matching to verify the coordinate information of the best matching point.

Benefits of technology

The initial positioning of images in continuous cycles of the production line is realized with a smaller computing overhead, and the position information is faster and more reliable, solving the problem of excessive time-consuming, and improving the computing speed of the detection method and the operation efficiency of the software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114757991B_ABST
    Figure CN114757991B_ABST
Patent Text Reader

Abstract

The present invention proposes an initial positioning method for a periodic image, including: collecting images of a production line, obtaining a template map as a reference, circling a positioning kernel and obtaining a new periodic image; performing template matching operations on the new periodic image and the template map as a reference, and obtaining the best matching point after processing; obtaining the image information and position information of the positioning kernel in the template map as a reference; obtaining the regional coordinates of the positioning kernel and expanding it; performing template matching based on the expanded positioning kernel region and the image information of the positioning kernel in the template map as a reference to obtain the coordinate information of the best matching point; judging whether the coordinate information of the best matching point obtained in S5 meets the preset standard, if so, entering S7, otherwise re-performing a new template matching process; verifying whether the periodic positioning kernel image is within the estimated positioning kernel region; and obtaining the position information of the positioning information in the actual image. The present invention can quickly and reliably realize the initial positioning of periodic images on a production line.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of machine vision processing, and in particular to an initial positioning method for a periodic image. Background Art

[0002] Currently, many industrial production lines use machine vision inspection systems to process images. On these production lines, the images scanned by the machine vision inspection system are periodic images, that is, continuous images that repeat at a certain period along the running direction of the production line. For visual inspection systems that implement product surface inspection for such periodic images, the existing technology generally uses image comparison methods. The premise for the successful application of this method is to provide accurate initial positioning for the visual inspection system in advance, so that it is possible to compare the real-time scanned image with the reference image.

[0003] The so-called initial positioning is to provide the position of the first cycle on the production line for the template image used as the reference, so that the points on the template image correspond one-to-one with the points on the cycle image of the actual product. The necessity of initial positioning lies in that initial positioning is a prerequisite for the entire machine vision inspection system to start inspection, and it is also a key link in determining whether the image comparison results are valid.

[0004] For periodic images, there is only one minimum period for each specific coordinate area in the image. The template image used as a benchmark is a continuous image of the minimum period or an integer multiple of the minimum period. The operating principle of the machine vision inspection system in this type of visual industrial site is essentially image comparison under the premise of accurate initial positioning.

[0005] During the initial positioning process, the specific information of the positioning kernel involved in the image comparison needs to be confirmed and matched with the actual production map. The positioning kernel can be understood as a certain feature point or a collection of several feature points, which are used to locate the continuous cycle of the template map and the actual production map as the reference, so as to calculate the position information of other feature points in the actual production map that are not used as the positioning kernel. In image processing, feature points refer to points where the gray value of the image changes dramatically or points with large curvature on the edge of the image, that is, the intersection of two edges. Image feature points play a very important role in the image matching algorithm based on feature points. Image feature points can reflect the essential characteristics of the image and identify the target object in the image. Image matching can be completed by matching feature points.

[0006] Since many products in actual production are made of soft materials, such as paper or plastic film, rather than rigid bodies, the reference image and the image of the multiple size of the circumference of the mobile fixed plate on the production line in the above periodic image are not completely accurate and consistent with each other, and there are always image differences caused by jitter. In this case, the more accurate the positioning information, the more accurate the image comparison result, and conversely, the more blurred the positioning information, the less accurate the image comparison result.

[0007] Template matching is the most primitive and basic pattern recognition method. It studies where the pattern of a specific object is located in the image, and then identifies the object. This is a matching problem. It is the most basic and most commonly used matching method in image processing. A template is a known small image, and template matching is to search for a target in a large image. It is known that there is a target to be found in the image, and the target has the same size, direction and image elements as the template. Through a certain algorithm, the target can be found in the image and its coordinate position can be determined. The positioning method used in the prior art usually adopts a positioning method based on template matching in the opencv library. The problems it has include: the existing positioning method based on template matching has a relatively cumbersome positioning result verification step, which increases resource consumption to a certain extent, and the running time of the existing method is relatively long, which is not conducive to the rapid processing of images. Summary of the invention

[0008] The purpose of the embodiments of the present application is to provide an initial positioning method for a periodic image, so as to solve the problems of high modification cost and waste of resources in the prior art.

[0009] The present invention provides an initial positioning method for a periodic image, comprising the following steps:

[0010] S1, collect images of the production line and stitch them into a minimum complete periodic image corresponding to the pattern that appears repeatedly on the production line, use the stitched image as a reference template image, circle the positioning kernel in the reference template image and obtain a new periodic image;

[0011] S2, performing a template matching operation on the new periodic image and the template image used as a reference, obtaining a result image obtained after the template matching, and obtaining the best matching point after processing the result image;

[0012] S3, obtaining image information and position information of the positioning core in the template image used as a reference;

[0013] S4, combining the position information of the positioning kernel and the actual height of the plate circumference to obtain the regional coordinates of the positioning kernel, and expanding it to obtain the expanded positioning kernel region;

[0014] S5, performing template matching based on the expanded positioning core area and the image information of the positioning core in the template image as a reference, and obtaining the coordinate information of the best matching point;

[0015] S6, judging whether the coordinate information of the best matching point obtained in S5 meets the preset standard, if so, proceeding to S7, otherwise, re-performing a new template matching process to re-acquire the coordinate information of the best matching point;

[0016] S7, obtaining the periodic positioning kernel and the periodic positioning kernel image in the new periodic image according to the position information of the positioning kernel, and verifying whether the periodic positioning kernel image is within the estimated positioning kernel area in combination with the coordinate information of the best matching point. If the best matching point is within the estimated positioning kernel area, then continue to execute the subsequent steps. Otherwise, it is determined that the periodic image cannot complete the initial positioning and the process is exited to report an error.

[0017] S8, obtaining the position information of the positioning information in the actual image based on the coordinates of the best matching point and the reference positioning kernel.

[0018] Furthermore, in S1, the length of the template image used as a reference should be the same as the pre-manually input plate circumference length, which is the image height of one or an integer number of periods of the periodic image. The plate circumference length is pre-input by the technician based on the image conditions of the actual production line, and the direction of the image height is consistent with the running direction of the production line.

[0019] Furthermore, obtaining the best matching point in S2 further includes the following steps:

[0020] S2-1, box filtering is performed on the result image obtained after template matching;

[0021] S2-2, taking 0.8 times the maximum value in the result image obtained after template matching as a reference, performing a binarization operation on the result image to obtain a black and white image;

[0022] S2-3, performing box filtering on the black and white image to obtain a filter image of the black and white image;

[0023] S2-4, performing binarization processing on the filter image of the black and white image to obtain a binarized image;

[0024] S2-5, performing blob analysis on the binary image to obtain the image information of each connected region in the binary image, and obtaining the coordinates of the contour of the connected region with the largest area from the information set as the best matching point.

[0025] Furthermore, the image information of the positioning kernel is the image portion intercepted from the range of the positioning kernel in S1 in the template image used as a reference. The positioning kernel circled in S1 is called the reference positioning kernel, and the image corresponding to it in the template image used as a reference is called the reference positioning kernel image.

[0026] The position information of the positioning kernel refers to the coordinate information and image size corresponding to the range delineated by the positioning kernel in S1 in the template image serving as a reference.

[0027] Furthermore, in S4, obtaining the regional coordinates of the positioning core also includes: adding the position information of the positioning core and the actual height of the plate circumference obtained in S2-5.

[0028] Furthermore, the S5 further comprises the following steps:

[0029] S5-1, performing template matching on the image circled in the actual production acquisition image of the expanded positioning core area and the positioning core image marked by the template image as a reference, to obtain a template matching result image;

[0030] S5-2, box filtering is performed on the template matching result image to obtain the maximum value boxMax in the box filtering result image;

[0031] S5-3, performing a binarization operation on the box filter result image with 0.9 times of boxMax as a threshold, and performing blob analysis on the binarization result to obtain a blob result set;

[0032] S5-4, according to the number of results in the blob result set, obtaining the actual position of the positioning core marked by the reference template map in the positioning core of the actual production map;

[0033] S5-5, template matching is performed again on the expanded area of ​​the positioning core in the actual production image and the positioning core image marked by the template image as a reference, and the coordinate information of the point with the maximum grayscale value in the result image is the coordinate information of the best matching point.

[0034] Furthermore, the S6 further comprises the following steps:

[0035] S6-1, the preset standard is whether the coordinates of the best matching point are within the positioning kernel mentioned in S5 and within the range of the image of the outer expansion area in the actual production acquisition, that is, whether the horizontal and vertical coordinates of the best matching point obtained in S5 are both greater than or equal to 0 and less than the upper limit of the horizontal and vertical coordinates of the outer expansion area image. If so, it is considered that the coordinate information of the best matching point obtained in S5 meets the standard, and S7 is directly entered at this time; if the horizontal and vertical coordinate values ​​of the best matching point are less than 0 or greater than the upper limit of the horizontal and vertical coordinates of the image, it means that it does not meet the standard, and S6-2 is entered at this time;

[0036] S6-2, obtaining a template matching result image obtained after the template matching in S2;

[0037] S6-3, performing box filtering on the template matching result image to obtain a box filtering result image;

[0038] S6-4, obtaining the maximum value gauBoxMax in the box filter result image, performing binarization processing on the box filter result image with a threshold of 0.9 times gauBoxMax, and performing blob analysis on the binarized result image to obtain a blob analysis result;

[0039] S6-5, compare the blob analysis result obtained in S6-4 with the blob analysis result set of the binarized image in S5 whose binarization threshold is 0.95 times of the maximum value boxMax and calculate the distance between the two sets. If the distance is less than 32 pixels, the result is considered valid. At this time, the coordinate information in the blob result set obtained in S6-3 is used as the matching information required for initial positioning, that is, the coordinate information of the best matching point;

[0040] S6-6, judging whether the coordinate information of the best matching point obtained in S6-5 meets the preset standard. If it still does not meet the standard at this time, it is judged that the image cannot be initially positioned and the whole process is terminated. If it meets the standard, it enters S7.

[0041] Furthermore, in S7, obtaining the periodic positioning kernel and the periodic positioning kernel image also includes: intercepting an image from the new periodic image mentioned in S1 which is formed by splicing the two minimum complete periodic images up and down according to the positioning kernel position information mentioned in S3, and calling the positioning kernel a periodic positioning kernel, and calling the image a periodic positioning kernel image.

[0042] The beneficial effects of the present invention are as follows: the initial positioning method proposed in the present invention can detect the initial positioning of the continuous periodic image of the production line with a relatively small computational overhead, and the position information of the initial positioning is faster and more reliable, which solves the problem of the previous methods being too time-consuming, and realizes that the detection method given in the present invention has a faster computing speed, thereby improving the software operation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1 The figure is a schematic diagram of the overall process of the periodic image initial positioning method proposed in the present invention. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0046] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. 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.

[0047] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0048] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0049] like Figure 1 As shown, Figure 1 The figure is a schematic diagram of the overall process of an initial positioning method of a periodic image proposed by the present invention. The initial positioning method proposed by the present invention is applicable to the case where the pattern appearing on the production line is a regular periodic pattern. The method comprises the following steps:

[0050] S1, collect images of the production line and stitch them into a minimum complete cycle image corresponding to the pattern that appears repeatedly on the production line, use the stitched image as a reference template image, and circle the positioning core in the reference template image;

[0051] Specifically, the length of the template image used as a reference should be the same as the pre-manually input plate circumference length. The plate circumference length is the image height of one or an integer number of periods of the periodic image. The plate circumference length is pre-input by the technician based on the image conditions of the actual production line. The direction of the image height is consistent with the running direction of the production line.

[0052] After obtaining the template image as the reference, it is necessary to manually or automatically circle an area of ​​20×20 pixels in the template image as the reference for subsequent positioning. The circled area is called the positioning kernel. The circled positioning kernel needs to satisfy the requirement that the circled area is the only image in the template image as the reference, that is, the part with repeated images cannot be classified as the positioning kernel.

[0053] In order to ensure the accuracy of subsequent template matching while taking into account the calculation speed, the present invention selects two images with the same length as the circumference of the plate and splices them into a new periodic image, that is, under an ideal environment that remains consistent before and after production, the new periodic image is formed by splicing two or an integer multiple of two periodic images up and down.

[0054] Further preferably, in order to improve the operation efficiency, the present invention can also use the cv::resize() function to reduce the collected periodic images by a certain ratio before splicing them.

[0055] S2, performing a template matching operation on the new periodic image mentioned in S1 and the template image used as a reference, obtaining a result image obtained after template matching, and obtaining the best matching point after processing the result image;

[0056] Specifically, the template matching operation can obtain a grayscale image. Ideally, the grayscale image with the highest grayscale value is the best matching point. The obtained grayscale image is called the result image after template matching in the subsequent steps.

[0057] Among them, it is difficult to achieve the ideal situation due to various influences. Therefore, it is necessary to eliminate the image noise and other conditions that may affect the printing effect and the image acquisition effect in actual production. Obtaining the best matching point also requires the following steps:

[0058] S2-1, box filtering is performed on the result image obtained after template matching;

[0059] In order to prevent the occurrence of individual erroneous gray value mutation points affected by noise, the result image obtained after template matching needs to be subjected to {1,61} box filtering.

[0060] S2-2, taking 0.8 times the maximum grayscale value in the result image obtained after template matching as a reference to perform a binarization operation on the image to obtain a black and white image;

[0061] Specifically, the points with high grayscale in the result image obtained after template matching are generally distributed more concentratedly. Taking 0.8 times of the maximum value as the benchmark can effectively distinguish the position of the high grayscale area. Since the image noise generated in actual production is generally not greater than 0.8 times of the maximum value, the present invention takes 0.8 times of the maximum value as the benchmark, thereby effectively shielding the image noise, performing a binarization operation on the result image, and obtaining a black and white image;

[0062] S2-3, performing box filtering on the black and white image to obtain a filter image of the black and white image;

[0063] In the present invention, a {1,61} box filter is performed on the black and white image obtained after the binarization operation.

[0064] S2-4, performing binarization processing on the filter image of the black and white image to obtain a binarized image;

[0065] The present invention performs a binarization operation on the filter image of the black-and-white image with a threshold of 64.

[0066] S2-5, performing blob analysis on the binary image to obtain the image information of each connected region in the binary image, and obtaining the coordinates of the contour of the connected region with the largest area from the information set as the best matching point.

[0067] Furthermore, since the new periodic image spliced ​​in S1 is composed of two images of the minimum template length, two upper and lower matching points can be obtained. By subtracting the vertical coordinates of the two upper and lower matching points, the actual height of the minimum period of continuous images on the production line can be obtained. This actual height is the actual height of the plate circumference, which is convenient for the subsequent processing of positioning core information.

[0068] S3, obtaining image information and position information of the positioning core in the template image used as a reference;

[0069] The image information of the positioning kernel is the image portion intercepted from the range of the positioning kernel in S1 in the template image used as a reference. In the present invention, the positioning kernel circled in S1 is called the reference positioning kernel, and the image corresponding to it in the template image used as a reference is called the reference positioning kernel image.

[0070] The position information of the positioning kernel refers to the coordinate information and image size corresponding to the range delineated by the positioning kernel in S1 in the template image serving as a reference.

[0071] S4, combining the position information of the positioning kernel and the actual height of the plate circumference to obtain the regional coordinates of the positioning kernel, and expanding it to obtain the expanded positioning kernel region;

[0072] Specifically, the position information of the positioning core is added to the actual height of the plate circumference obtained in S2-5 to obtain the coordinates of the positioning core area.

[0073] Due to the material quality or some specific reasons of the production machine in the actual acquisition or production environment, the acquired image may have a certain range of deviation from the template image used as the reference, which is the so-called jitter phenomenon in actual production. Therefore, the area where the actual positioning core is located in the general production line acquisition image and the positioning core area marked by the template image used as the reference cannot completely correspond one to one. In order to solve the above problem, this embodiment expands the width and height of the area corresponding to the positioning core area marked by the template image used as the reference in the actual production acquisition image.

[0074] Specifically, expanding the positioning kernel area includes expanding the width and height of the positioning kernel area. In this embodiment, the left and right widths and the upper and lower heights of the positioning kernel area are preferably expanded by 16 pixel lengths, that is, the coordinates of the upper left corner of the original positioning kernel (X_LT, Y_LT) are expanded to (X_LT-16, Y_LT-16), the coordinates of the lower left corner of the original positioning kernel (X_LT, Y_RD) are transformed into (X_LT-16, Y_RD+16), the coordinates of the upper right corner of the original positioning kernel (X_RD, Y_LT) are transformed into (X_RD+16, Y_LT-16), and the coordinates of the lower right corner of the original positioning kernel (X_RD, Y_RD) are transformed into (X_RD+16, Y_RD+16); a new rectangular area is obtained as a new positioning kernel area.

[0075] Further preferably, according to the severity of the jitter phenomenon in actual problem processing, those skilled in the art may increase or decrease the length of the outwardly expanded pixel points, such as increasing the length of the outwardly expanded pixel points.

[0076] S5, performing template matching based on the expanded positioning core area and the image information of the positioning core in the template image as a reference, and obtaining the coordinate information of the best matching point;

[0077] Specifically, S5 further includes the following steps:

[0078] S5-1, performing template matching on the image circled in the actual production acquisition image of the expanded positioning core area and the positioning core image marked by the template image as a reference, to obtain a template matching result image;

[0079] S5-2, box filtering is performed on the template matching result image to obtain the maximum value boxMax in the box filtering result image;

[0080] Specifically, the present invention performs box filtering with a convolution kernel of {9,9}.

[0081] When boxMax is less than 0.2, it is considered that the matching score is too low. At this time, it is considered that the image passed in does not meet the requirements for the algorithm to continue running. It is considered that the image passed in to the algorithm cannot be initially positioned, and the algorithm ends the process;

[0082] When boxMax is greater than 0.2, continue to perform subsequent operations.

[0083] S5-3, performing a binarization operation on the box filter result image with 0.9 times of boxMax as a threshold, and performing blob analysis on the binarization result to obtain a blob result set;

[0084] S5-4, according to the number of results in the blob result set, obtaining the actual position of the positioning core marked by the reference template map in the positioning core of the actual production map;

[0085] If there is only one result in the blob result set, the coordinates corresponding to the result are the actual position of the positioning core marked by the template map as the reference in the actual production map;

[0086] If the number of results in the blob result set is greater than one, the binarization threshold in the binarization operation of S5-3 is reselected, the binarization threshold is changed to 0.95 times the maximum value boxMax, and the binarized image is re-analyzed (step S5-4). If the number of results in the result set of the re-blob analysis is still greater than one, it is considered that the image or the positioning kernel pre-calibrated in the template image used as the reference cannot be effectively used for initial positioning, and the algorithm should exit the process and report an error.

[0087] When the blob result set is empty, it is considered that the image cannot find the best matching point, the image passed into the algorithm cannot be initially positioned, and the algorithm should jump out of the error;

[0088] When the blob result set is not empty, it is considered that the image passed into the algorithm can be initially positioned, but the outer expansion area of ​​the positioning kernel obtained in the above S4 in the actual production image needs to be adjusted. At this time, the outer expansion area of ​​the positioning kernel in the actual production image is increased in width by half the original positioning kernel width plus 16 pixels.

[0089] S5-5, template matching is performed again on the expanded area of ​​the positioning core in the actual production image and the positioning core image marked by the template image as a reference, and the coordinate information of the point with the maximum grayscale value in the result image is the coordinate information of the best matching point.

[0090] S6: Determine whether the coordinate information of the best matching point obtained in S5 meets the preset standard. If so, proceed to S7; otherwise, perform a new template matching process again to obtain the coordinate information of the best matching point again.

[0091] Specifically, S6 also includes the following steps:

[0092] S6-1, the preset standard is whether the coordinates of the best matching point are within the positioning kernel mentioned in S5 and within the range of the image of the outer expansion area in the actual production acquisition, that is, whether the horizontal and vertical coordinates of the best matching point obtained in S5 are both greater than or equal to 0 and less than the upper limit of the horizontal and vertical coordinates of the outer expansion area image. If so, it is considered that the coordinate information of the best matching point obtained in S5 meets the standard, and S7 is directly entered at this time; if the horizontal and vertical coordinate values ​​of the best matching point are less than 0 or greater than the upper limit of the horizontal and vertical coordinates of the image, it means that it does not meet the standard, and S6-2 is entered at this time;

[0093] S6-2, obtaining a template matching result image obtained after the template matching in S2;

[0094] S6-3, performing box filtering on the template matching result image to obtain a box filtering result image;

[0095] Among them, S6-3 performs box filtering with a convolution kernel of {5,5}.

[0096] S6-4, obtaining the maximum value gauBoxMax in the box filter result image, performing binarization processing on the box filter result image with a threshold of 0.9 times gauBoxMax, and performing blob analysis on the binarized result image to obtain a blob analysis result;

[0097] S6-5, compare the blob analysis result obtained in S6-4 with the blob analysis result set of the binarized image in S5 whose binarization threshold is 0.95 times the maximum value boxMax and calculate the distance between the two sets. If the distance is less than 32 pixels, the result is considered valid. At this time, the coordinate information in the blob result set obtained in S6-3 is used as the matching information required for initial positioning, that is, the coordinate information of the best matching point.

[0098] S6-6, judging whether the coordinate information of the best matching point obtained in S6-5 meets the preset standard. If it still does not meet the standard at this time, it is judged that the image cannot be initially positioned and the whole process is terminated. If it meets the standard, it enters S7.

[0099] S7, obtaining the periodic positioning kernel and the periodic positioning kernel image in the new periodic image according to the position information of the positioning kernel, and verifying whether the periodic positioning kernel image is within the estimated positioning kernel area in combination with the coordinate information of the best matching point. If the best matching point is within the estimated positioning kernel area, it is considered that the periodic image can be initially positioned and the subsequent steps are continued. Otherwise, it is considered that the periodic image cannot complete the initial positioning and the process is exited, and an error is reported.

[0100] Specifically, according to the positioning kernel position information mentioned in S3, an image is intercepted from the new periodic image formed by stitching two minimum complete periodic images mentioned in S1, and the positioning kernel is called a periodic positioning kernel, and the image is called a periodic positioning kernel image;

[0101] Among them, the estimated positioning kernel area means that the algorithm believes that the image of each period of the periodic image within a certain coordinate range should always remain consistent. The estimated positioning kernel area can be estimated by the positioning kernel position information mentioned in S3. The reference positioning kernel image in S3 appears in the relative position of the same image on the periodic image on the subsequent production line.

[0102] S8, obtaining the position information of the positioning information in the actual image based on the coordinates of the best matching point and the reference positioning kernel.

[0103] Specifically, according to the coordinate information of the best matching point, the coordinates of the best matching point are the corresponding position of the reference positioning kernel in the periodic image on the production line, and then according to the position of the reference positioning kernel in the template image used as the reference and the calculated coordinate difference of the corresponding position of the reference positioning kernel in the periodic image on the production line, the reference positioning kernel at the longitudinal starting point of the reference image (i.e., the minimum point of the longitudinal coordinate) plus the coordinate difference is the corresponding longitudinal position coordinate of the longitudinal starting point of the reference image in the periodic image on the production line, thereby completing the initial positioning.

[0104] 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. A method for initial positioning of a periodic image, characterized in that: The following steps are involved: S1, collect images of the production line and stitch them into a minimum complete periodic image corresponding to the pattern that appears repeatedly on the production line, use the stitched image as a reference template image, circle the positioning kernel in the reference template image and obtain a new periodic image; S2, performing a template matching operation on the new periodic image and the template image used as a reference, obtaining a result image obtained after the template matching, and obtaining the best matching point after processing the result image; S3, obtaining image information and position information of the positioning core in the template image used as a reference; S4, combining the position information of the positioning kernel and the actual height of the plate circumference to obtain the regional coordinates of the positioning kernel, and expanding it to obtain the expanded positioning kernel region; S5, performing template matching based on the expanded positioning core area and the image information of the positioning core in the template image as a reference, and obtaining the coordinate information of the best matching point; S6, judging whether the coordinate information of the best matching point obtained in S5 meets the preset standard, if so, proceeding to S7, otherwise, re-performing a new template matching process to re-acquire the coordinate information of the best matching point; S7, obtaining the periodic positioning kernel and the periodic positioning kernel image in the new periodic image according to the position information of the positioning kernel, and verifying whether the periodic positioning kernel image is within the estimated positioning kernel area in combination with the coordinate information of the best matching point. If the best matching point is within the estimated positioning kernel area, then continue to execute the subsequent steps. Otherwise, it is determined that the periodic image cannot complete the initial positioning and the process is exited to report an error. S8, obtaining the position information of the positioning information in the actual image based on the coordinates of the best matching point and the reference positioning kernel.

2. The initial positioning method of a periodic image according to claim 1, characterized in that: In S1, the length of the template image used as a reference should be the same as the pre-manually input plate circumference length, which is the image height of one or an integer number of periods of the periodic image. The plate circumference length is pre-input by the technician based on the image conditions of the actual production line, and the direction of the image height is consistent with the running direction of the production line.

3. The initial positioning method of a periodic image according to claim 1 or 2, characterized in that: The step of obtaining the best matching point in S2 further includes the following steps: S2-1, box filtering is performed on the result image obtained after template matching; S2-2, taking 0.8 times the maximum value in the result image obtained after template matching as a reference, performing a binarization operation on the result image to obtain a black and white image; S2-3, performing box filtering on the black and white image to obtain a filter image of the black and white image; S2-4, performing binarization processing on the filter image of the black and white image to obtain a binarized image; S2-5, performing blob analysis on the binary image to obtain the image information of each connected region in the binary image, and obtaining the coordinates of the contour of the connected region with the largest area from the information set as the best matching point.

4. The initial positioning method of a periodic image according to claim 3, characterized in that: In S3, the image information of the positioning kernel is the image portion intercepted from the range circled by the positioning kernel in S1 in the template image used as a reference. The positioning kernel circled in S1 is called the reference positioning kernel, and the image corresponding to it in the template image used as a reference is called the reference positioning kernel image. The position information of the positioning kernel refers to the coordinate information and image size corresponding to the range delineated by the positioning kernel in S1 in the template image serving as a reference.

5. The initial positioning method of a periodic image according to claim 4, characterized in that: In S4, obtaining the regional coordinates of the positioning core further includes: adding the position information of the positioning core and the actual height of the plate periphery obtained in S2-5.

6. The initial positioning method of a periodic image according to claim 4 or 5, characterized in that: The S5 further comprises the following steps: S5-1, performing template matching on the image circled in the actual production acquisition image of the expanded positioning core area and the positioning core image marked by the template image as a reference, to obtain a template matching result image; S5-2, box filtering is performed on the template matching result image to obtain the maximum value boxMax in the box filtering result image; S5-3, performing a binarization operation on the box filter result image with 0.9 times of boxMax as a threshold, and performing blob analysis on the binarization result to obtain a blob result set; S5-4, according to the number of results in the blob result set, obtaining the actual position of the positioning core marked by the reference template map in the positioning core of the actual production map; S5-5, template matching is performed again on the expanded area of ​​the positioning core in the actual production image and the positioning core image marked by the template image as a reference, and the coordinate information of the point with the maximum grayscale value in the result image is the coordinate information of the best matching point.

7. The initial positioning method of a periodic image according to claim 6, characterized in that: The S6 further comprises the following steps: S6-1, the preset standard is whether the coordinates of the best matching point are within the positioning kernel mentioned in S5 and within the range of the image of the outer expansion area in the actual production acquisition, that is, whether the horizontal and vertical coordinates of the best matching point obtained in S5 are both greater than or equal to 0 and less than the upper limit of the horizontal and vertical coordinates of the outer expansion area image. If so, it is considered that the coordinate information of the best matching point obtained in S5 meets the standard, and S7 is directly entered at this time; if the horizontal and vertical coordinate values ​​of the best matching point are less than 0 or greater than the upper limit of the horizontal and vertical coordinates of the image, it means that it does not meet the standard, and S6-2 is entered at this time; S6-2, obtaining a template matching result image obtained after the template matching in S2; S6-3, performing box filtering on the template matching result image to obtain a box filtering result image; S6-4, obtaining the maximum value gauBoxMax in the box filter result image, performing binarization processing on the box filter result image with a threshold of 0.9 times gauBoxMax, and performing blob analysis on the binarized result image to obtain a blob analysis result; S6-5, compare the blob analysis result obtained in S6-4 with the blob analysis result set of the binarized image in S5 whose binarization threshold is 0.95 times of the maximum value boxMax and calculate the distance between the two sets. If the distance is less than 32 pixels, the result is considered valid. At this time, the coordinate information in the blob result set obtained in S6-3 is used as the matching information required for initial positioning, that is, the coordinate information of the best matching point; S6-6, judging whether the coordinate information of the best matching point obtained in S6-5 meets the preset standard. If it still does not meet the standard at this time, it is judged that the image cannot be initially positioned and the whole process is terminated. If it meets the standard, it enters S7.

8. The initial positioning method of a periodic image according to claim 7, characterized in that: In S7, obtaining the periodic positioning kernel and the periodic positioning kernel image also includes: intercepting an image from the new periodic image mentioned in S1 which is formed by splicing the two minimum complete periodic images up and down according to the positioning kernel position information mentioned in S3, and calling the positioning kernel a periodic positioning kernel, and calling the image a periodic positioning kernel image.

Citation Information

Patent Citations

  • High-precision image positioning method

    CN107369179A

  • Method of acquiring parameters of periodic sequence image model quickly and automatically

    CN107403429A