Image processing method, positioning method, device, equipment and storage medium
By using preset distribution rules to determine image position information in image processing, unnecessary matching processes are reduced, the problem of large computing resources and time consumption in the existing technology is solved, and the efficiency of image processing is improved.
Patent Information
- Application Number
- CN201910611521.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-07-08
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2040-04-21
AI Technical Summary
In the existing technology, in image processing, the method based on template image matching consumes huge computing resources and time, and the calculation of the intervals or blank parts between the objects to be measured in the image is meaningless, resulting in low matching efficiency.
By obtaining the original image and the template image, the preset distribution rules are used to first determine the actual position information of one of the images, and then calculate the initial position information of the other images based on this information, reducing unnecessary matching processes and improving matching efficiency.
It effectively reduces the consumption of computing resources and matching time, and improves the efficiency of image processing, especially when there are large gaps or blank parts between the objects to be measured.
Smart Images

Figure CN112200864B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, device, equipment and computer-readable storage medium, and a positioning method, device, equipment and computer-readable storage medium. Background Art
[0002] In actual scenarios, for multiple identical or different objects to be tested that exist on the same plane at the same time, there is often a need to obtain the actual position of each object to be tested, so as to perform operations such as extraction and cutting based on the actual position obtained. Taking multiple chips manufactured on the same wafer as an example, in order to accurately separate each chip from the wafer, the actual position of each chip on the wafer is essential.
[0003] Due to the many problems caused by directly calculating and measuring the actual position of the real object, the actual position is often calculated based on the image obtained by taking a picture of the real object. Since there is no difference in the positional characteristics between the captured image and the real object, the calculation result based on the image can be directly used as the calculation result of the real object.
[0004] In order to obtain the actual position of each object to be tested based on the image, the industry widely uses a matching method based on a template image to achieve this (the template image is an image taken of a standard object that is consistent with the object to be tested, and all parameters of the template image are known parameters, including the specific position of the image of the standard object in the template image). This method continuously translates the template image in the captured image, and during the translation process continuously searches for the pixel points in the original image that have the highest matching degree with each pixel point of the image of the standard object, that is, the overlapping position between the image of the standard object in the template image and the image of each object to be tested in the original image is obtained through the matching degree between the pixels, and the specific position of the object to be tested at the time of overlap is calculated based on the translation distance of the template image and the known parameters at the time of overlap.
[0005] According to the solution provided by the above-mentioned prior art, in order to obtain the actual position of each object to be tested contained in the captured image, it is necessary to translate the template image through all the pixels of the captured image, because it is impossible to determine whether the untranslated part contains the image of the object to be tested. It can be seen that the matching process requires huge computing resources and takes a long time. And since most of the objects to be tested contained in the captured image have intervals or blank parts in the middle, this method undoubtedly wastes some computing resources for meaningless calculations. And the matching efficiency is of great concern to the parties using this method.
[0006] Therefore, how to provide a solution that consumes less computing resources, takes less time to match, and has higher matching efficiency while ensuring accuracy is an urgent problem to be solved by those skilled in the art. Summary of the invention
[0007] The purpose of this application is to provide an image processing method, apparatus, device and computer-readable storage medium, as well as a positioning method, apparatus, equipment and computer-readable storage medium, aiming to reduce the computing resources and matching time consumed in the matching process and improve the matching efficiency.
[0008] To achieve the above object, the present application provides an image processing method, which includes:
[0009] Acquire an original image including a plurality of images to be matched and a template image of the images to be matched, wherein the images to be matched are distributed according to a preset distribution rule, and the plurality of images to be matched include a first image and a second image;
[0010] Performing a first matching process on the template image in the original image to obtain first actual position information of the first image;
[0011] Acquire initial position information of the second image according to the first actual position information and the preset distribution rule;
[0012] The template image is caused to perform a second matching process on the second image according to the initial position to obtain second actual position information of the second image.
[0013] Optionally, the preset distribution rule is a periodic distribution.
[0014] Optionally, before the first matching process, the method further includes: dividing the original image into multiple regions, each region including one of the images to be matched, the multiple regions including a first region and a second region, the first region including the first image, and the second region including the second image.
[0015] Optionally, the first image includes a combination of one or more of the images to be matched located at the center of the original image and the images to be matched located at both ends of a diagonal line of the original image.
[0016] Optionally, the first matching process step includes:
[0017] matching the template image within the first area;
[0018] Using the position information of the area in the first area with the greatest matching degree with the template image as the reference position information of the first image;
[0019] The first actual position information is acquired according to the reference position information.
[0020] Optionally, the number of the first images is 1, and acquiring the first actual position information according to the reference position information includes: using the reference position information of the first image as the first actual position information;
[0021] or,
[0022] The number of the first images is multiple, and the first matching process step includes:
[0023] Acquire the weight and reference position information of each of the first images;
[0024] Using the weight of each of the first images, weighted processing is performed on the reference position information of the corresponding first image to obtain the first actual position information;
[0025] The steps of obtaining the weights include:
[0026] The weight is obtained according to the relative position relationship between the first area and the boundary of the original image.
[0027] Optionally, the preset distribution rule is a periodic distribution; the shapes and sizes of the regions are the same and are distributed according to the preset distribution rule; the first actual position information includes a relative position relationship between the first image and the first region, and the second actual position information includes a relative position relationship between the second image and the second region;
[0028] The acquiring the initial position information of the second image according to the first actual position information and the preset distribution rule includes: using the first actual position information as the initial position information.
[0029] Optionally, the second matching processing step includes: determining a detection area according to the initial position information and a preset matching range, and obtaining, according to the initial position information, a position of a matching area in the detection area with the greatest matching degree with the template image as the second actual position information;
[0030] Alternatively, the second matching process includes: taking the initial position information as a starting point, sequentially acquiring a second matching area in the original image along a preset trajectory, and performing a comparison process on the second matching area and the template image to acquire a matching degree of the second matching area; when the matching degree is greater than a preset threshold, acquiring the position information of the second matching area as the second actual position information of the second image.
[0031] Optionally, the original image further includes one or more third images, and the method further includes: acquiring the actual position information of the third images in sequence according to the actual position information of the image to be matched acquired last time.
[0032] Optionally, the step of sequentially acquiring the actual position information of the third image includes: acquiring the difference between the actual position information of the image to be matched acquired last time and the initial position information; using the difference to compensate the initial position information of the image to be matched acquired last time, and acquiring the compensated initial position information; acquiring the initial position information of the next image to be matched according to the compensated initial position information, and performing a third matching process to acquire the actual position information of the third image.
[0033] To achieve the above object, the present application also provides an image processing device, the image processing device comprising:
[0034] An original image and template image acquisition module, used to acquire an original image including a plurality of images to be matched and a template image of the images to be matched, wherein the images to be matched are distributed according to a preset distribution rule, and the plurality of images to be matched include a first image and a second image;
[0035] A first matching processing module, used for performing a first matching process on the template image in the original image to obtain first actual position information of the first image;
[0036] An initial position information acquisition module, used to acquire the initial position information of the second image according to the first actual position information and the preset distribution rule;
[0037] The second actual position information acquisition module is used to enable the template image to perform a second matching process on the second image according to the initial position information to acquire the second actual position information of the second image.
[0038] To achieve the above object, the present application also provides a positioning method, which includes:
[0039] Providing an object to be tested, wherein the object to be tested includes a plurality of units to be tested;
[0040] Acquire the image of the object to be tested to obtain an original image;
[0041] According to the image processing method provided in the above content, the actual position information of the image to be matched is obtained;
[0042] The relative position relationship of the unit under test in the object under test is acquired according to the actual position.
[0043] To achieve the above object, the present application also provides a positioning device, the positioning device comprising:
[0044] The test object providing module is used to provide the test object, wherein the test object includes a plurality of test units;
[0045] An original image acquisition module is used to acquire the image of the object to be tested to obtain an original image;
[0046] An actual position information acquisition module, used to acquire the actual position of the image to be matched according to the image processing method provided in the above content;
[0047] The relative position relationship acquisition module is used to acquire the relative position of the unit under test in the object under test according to the actual position.
[0048] To achieve the above object, the present application also provides an image processing device, the image processing device comprising:
[0049] Memory for storing computer programs;
[0050] A processor is used to implement the image processing method provided in the above content when executing the computer program.
[0051] To achieve the above object, the present application also provides a positioning device, the positioning device comprising:
[0052] Memory for storing computer programs;
[0053] A processor is used to implement the positioning method provided in the above content when executing the computer program.
[0054] To achieve the above objectives, the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the image processing method provided in the above part and / or the positioning method provided in another part of the above content.
[0055] The present application provides an image processing method: obtaining an original image containing multiple images to be matched and a template image of the images to be matched, wherein each of the images to be matched is distributed according to a preset distribution rule, and the multiple images to be matched include a first image and a second image; performing a first matching process on the template image in the original image to obtain first actual position information of the first image; obtaining initial position information of the second image based on the first actual position information and the preset distribution rule; and causing the template image to perform a second matching process on the second image based on the initial position information to obtain second actual position information of the second image.
[0056] According to the above technical solution, it can be seen that for multiple images to be matched that are distributed in the original image according to a preset distribution rule, the present application first obtains the first actual position information of the first image (the actual position of the first image in the original image), and then uses the preset distribution rule followed by the first image and the second image in distribution to calculate the initial position information of the second image according to the first actual position information, so that the actual position information of the second image can be determined directly according to the initial position information. In the above manner, the interval or blank invalid part between the first image and the second image can be directly skipped, reducing the amount of data to be calculated and the matching time, thereby increasing the efficiency of image processing. The present application also provides an image processing device, equipment and computer-readable storage medium, as well as a positioning method, device, equipment and computer-readable storage medium obtained on this basis, which have the above-mentioned beneficial effects and are not repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0058] Figure 1 A flowchart of an image processing method provided in an embodiment of the present application;
[0059] Figure 2 A schematic diagram of dividing an original image into multiple regions provided in an embodiment of the present application;
[0060] Figure 3 A schematic diagram of dividing another original image into multiple regions provided in an embodiment of the present application;
[0061] Figure 4 A flowchart of a positioning method provided in an embodiment of the present application;
[0062] Figure 5 A structural block diagram of an image processing device provided in an embodiment of the present application;
[0063] Figure 6 A structural block diagram of a positioning device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0064] The purpose of this application is to provide an image processing method, apparatus, device and computer-readable storage medium, as well as a positioning method, apparatus, equipment and computer-readable storage medium, aiming to reduce the computing resources and matching time consumed in the matching process and improve the matching efficiency.
[0065] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0066] See also Figure 1 , Figure 1 A flowchart of an image processing method provided in an embodiment of the present application includes the following steps:
[0067] S101: Acquire an original image including a plurality of images to be matched and a template image of the images to be matched, wherein the images to be matched are distributed according to a preset distribution rule, and the plurality of images to be matched include a first image and a second image;
[0068] The original image is an image obtained by photographing the object to be tested containing multiple units to be tested, and each image to be matched contained in the original image is an image corresponding to the corresponding unit to be tested. The template image is an image obtained based on a standard object with the same shape as the unit to be tested, and the actual position of the image of the standard object in the template image is a known quantity.
[0069] The solution provided in this application is based on the premise that multiple matching images in the original image are distributed according to a preset distribution rule, that is, the relative position relationship between each matching image can be calculated according to the preset distribution rule, and only the actual position of one of the images to be matched needs to be known to be deduced according to the preset distribution rule. Specifically, in one embodiment, the preset distribution rule can be a periodic distribution, and in other embodiments, the preset distribution can be an arithmetic progression or geometric progression of the spacing between adjacent images to be matched, etc.
[0070] The template image has the same size as the image to be matched.
[0071] To facilitate subsequent steps, the present application divides the multiple images to be matched contained in the original image into multiple groups of images including the first image and the second image in advance.
[0072] S102: performing a first matching process on the template image in the original image to obtain first actual position information of the first image;
[0073] On the basis of S101, this step aims to perform a first matching process on the template image in the original image to obtain the first actual position information of the first image. In this embodiment, the first actual position information is the relative position relationship of the first image in the original image. Specifically, the original image has an original coordinate system, and the first actual position information can be the coordinates of each point of the first image in the original coordinate system; or, the first actual position information can be the coordinates of the center point of the first image in the original coordinate system.
[0074] The first matching process comprises:
[0075] matching the template image within the first area;
[0076] Using the position information of the area in the first area with the greatest matching degree with the template image as reference position information;
[0077] The first actual position information is acquired according to the reference position information.
[0078] Specifically, matching the template image in the first region includes: selecting an area of the same size as the template image in the original image as the first matching region, performing a first comparison process on the original image in the first matching region and the template image to obtain a matching degree of the first matching region; and repeating the steps of obtaining the first matching region and performing the first comparison process to obtain multiple matching degrees. Using the position information of the area in the first region that has the greatest matching degree with the template image as the reference position information includes: obtaining the reference position information of the first image from the first matching region with the greatest matching degree.
[0079] The first comparison process includes: comparing the corresponding pixels of the first matching area and the template image respectively to obtain the grayscale difference of each pixel; and obtaining the matching degree according to the grayscale difference of each pixel. The matching degree can be determined according to the sum, average value or mean square error of the grayscale difference of each pixel. The larger the sum, average value or mean square error of the grayscale difference of each pixel, the smaller the matching degree; otherwise, the greater the matching degree.
[0080] In this embodiment, in the step of repeatedly obtaining the first matching area, the selected first matching area takes the first selected first matching area as the starting point, and is selected sequentially along a preset trajectory within a preset range. The size of the preset range can be adjusted according to actual conditions and is not specifically limited here.
[0081] When the number of the first images is 1, acquiring the first actual position information according to the reference position information includes: using the reference position information of the first image as the first actual position information;
[0082] When there are multiple first images, the first matching process includes:
[0083] Acquire the weight and reference position information of each of the first images;
[0084] Using the weight of each of the first images, weighted processing is performed on the reference position information of the corresponding first image to obtain the first actual position information;
[0085] The steps of obtaining the weights include:
[0086] The weight is obtained according to the relative position relationship between the reference position information and the original image boundary.
[0087] S103: Acquire initial position information of the second image according to the first actual position information and a preset distribution rule;
[0088] Since the images to be matched in the original image are distributed according to a preset rule, after the first actual position information of the first image is known, the initial position information of the second image can be obtained based on the first actual position information according to the preset distribution rule.
[0089] The result is called initial position information because the position calculated based on the first actual position information according to the spacing corresponding to the preset distribution rule is often affected by various factors in the physical manufacturing process, which makes it different from the actual position information of the second image. However, even if there is an error, the initial position information is also of reference value. Therefore, this application uses the calculated result as initial position information to help obtain the actual position information of the second image in the original image.
[0090] Specifically, in this embodiment, the preset distribution rule is a periodic distribution; and there is a preset distance vector between the first image and the second image.
[0091] The first actual position information is the relative position relationship of the first image in the original image. Specifically, the original image has an original coordinate system, and the first actual position information is the coordinates of the center point of the first image in the original coordinate system. The second actual position information is the coordinates of the center point of the second image in the original coordinate system.
[0092] The step of acquiring the initial position information of the second image includes: translating the first actual position information by the preset distance vector to acquire the initial position information.
[0093] S104: Using the template image to perform a second matching process on the second image according to the initial position information, to obtain second actual position information of the second image.
[0094] On the basis of S103, this step aims to make the template image directly start from the matching area at the initial position information, and perform a second matching process on the second image to obtain the actual position information of the second image in the original image.
[0095] The second matching process includes: starting from the initial position information, sequentially acquiring the second matching area in the original image along a preset trajectory, and performing a second comparison process on the second matching area and the template image to obtain the matching degree of the second matching area, and when the matching degree is greater than a preset threshold, acquiring the position information of the second matching area as the second actual position information of the second image. Specifically, starting from the initial position information, sequentially acquiring the second matching area in the original image along a preset trajectory, and performing a second comparison process on the second matching area and the template image to obtain the matching degree of the second matching area, and when the matching degree is greater than a preset threshold, acquiring the position information of the second matching area as the second actual position information of the second image includes the following steps:
[0096] Acquire a starting area in the original image, wherein the method for acquiring the starting area includes: acquiring an area having the same size and shape as the template image at the initial position information as the starting area;
[0097] Performing a second comparison process on the image to be matched in the starting area and the template image to obtain a matching degree of the starting area;
[0098] After the second comparison process, taking the starting position information as a starting point, sequentially acquiring second matching areas in the original image along a preset trajectory, wherein the second matching areas have the same size and shape as the template area;
[0099] Performing a third comparison process on the second matching area and the template image to obtain a matching degree of the second matching area;
[0100] Repeat the acquisition of the second matching area along the preset trajectory, and repeat the third comparison processing step until the matching degree of the second matching area is greater than or equal to the matching degree threshold, and obtain the position information of the second matching area as the second actual position information of the second image.
[0101] The third comparison process includes: comparing the corresponding pixels of the second matching area and the template image respectively to obtain the grayscale difference of each pixel; and obtaining the matching degree according to the grayscale difference of each pixel. The matching degree can be determined according to the sum, average value or mean square error of the grayscale difference of each pixel. The larger the sum, average value or mean square error of the grayscale difference of each pixel, the smaller the matching degree; otherwise, the greater the matching degree.
[0102] Alternatively, the second matching processing step includes: determining a detection area according to the initial position information and a preset matching range, and obtaining, according to the initial position information, position information of a matching area in the detection area with the greatest matching degree with the template image as the second actual position information;
[0103] Specifically, obtaining the position information of the matching area with the greatest matching degree with the template image within the detection area as the second actual position information includes: obtaining a starting area in the original image, obtaining the starting area includes: obtaining a detection area in the original image according to the initial position information, the detection area containing the initial position information; matching the template image within the detection area, and obtaining the area with the greatest matching degree with the template image within the detection area as the second image.
[0104] The detection area may be a rectangle, a circle or other shapes, and the initial position information may be the center of the detection area.
[0105] The preset trajectory is S-shaped, Z-shaped, circular or multiple straight lines. It can be seen from this step that the present application does not directly use the template image to match the similarity of each pixel in the original image, so as to finally obtain the actual position information of each image to be matched contained in the original image. Instead, after obtaining the actual position information of the first image, the actual position information of the first image is used as a basis, combined with the premise that each image to be matched is distributed on the original image according to a preset distribution rule, to quickly and directly obtain the initial position information that is not much different from the actual position information of the second image, so as to perform subsequent matching operations according to the initial position information, so as to achieve the purpose of obtaining the actual position information of the second image with only a small amount of computing resources. In other words, the solution provided by this embodiment is to make full use of the feature that each image to be matched is distributed in the original image according to a preset distribution rule. After obtaining the actual position information of part of the images to be matched, the initial position information of another part of the images to be matched can be quickly calculated by the preset distribution rule. In this way, there is no need to perform matching operations on each pixel in the original image indiscriminately as in the prior art, especially when there is a large interval between each matching image. Since the above solution can directly skip the interval or blank invalid part between the first image and the second image, the amount of data to be calculated and the matching time consumption are reduced, thereby increasing the matching efficiency.
[0106] According to the above content, it can be seen that in the present application, the first image is used to obtain its actual position information in the original image, and it is used as the basis for calculating the initial position information of the second image. Therefore, the fewer the number of images to be matched selected as the first image and the more the number of images to be matched selected as the second image, the more computing resources are saved, the shorter the overall matching time is, and the higher the matching efficiency is.
[0107] However, since the unit to be tested is often affected by various factors in the manufacturing process, some images to be matched have large differences in distribution from other images to be matched. Therefore, the initial position information of the second image calculated based on the actual position information of the first image will have a large error with its actual position information. Therefore, in order to make the actual position information of the first image as the basis better and minimize the influence of various factors, it is often necessary to select multiple images to be matched as the first image, and make the actual position information of the first image as the basis better by taking the average or other methods that may reduce the degree of influence. Therefore, according to different specific needs in the actual application scenario, it is also necessary to make trade-offs and considerations in terms of how many images to be matched are selected as the first image, which is not specifically limited here.
[0108] Furthermore, when selecting which images to be matched as the first image, the specific distribution of each image to be matched in the original image may also be considered. For example, when each image to be matched is distributed periodically, any one or more images to be matched may be arbitrarily selected as the first image. Specifically, an image to be matched at the edge or center of the original image may be selected.
[0109] In one embodiment of the present application, the first image may include a combination of one or more of an image to be matched located at the center of the original image and images to be matched located at both ends of a diagonal line of the original image.
[0110] Furthermore, compared to selecting the image to be matched at the edge as the first image, it is better to select the image to be matched at the center as the first image, because as the center, the image to be matched has other images to be matched distributed on both sides or around, so that the actual position information thereof can be used as a basis to reduce the error between the initial position information of the second image and the actual position information as much as possible. Based on the above characteristics, when selecting the image to be matched from the center of the original image as the first image, the number of images to be matched selected as the first image can often be set to 1.
[0111] Of course, in order to make the error in selecting the image to be matched as the first image from the edge part as small as possible, it is also possible to simultaneously select images to be matched from different edges as the first image. For example, the images to be matched located at both ends of the diagonal of the original image can be used as the first image, or the images to be matched at the four corners can be used as the first image at the same time, so as to utilize the distribution of images to be matched at different edges, so that the actual position information of the first image that is finally obtained as the basis is better.
[0112] It should be noted that the original image may further include one or more third images, and the method further includes: sequentially acquiring the actual position information of the third images according to the actual position information of the image to be matched acquired last time.
[0113] When the original image includes one or more third images, the method further includes: sequentially acquiring actual position information of the third images according to actual position information of the image to be matched acquired last time.
[0114] The steps of sequentially acquiring the actual position information of the third image include: acquiring the initial position information of the next image to be matched according to the actual position information of the image to be matched acquired last time; performing a third matching process on the next image to be matched according to the initial position information to acquire the actual position information of the third image.
[0115] Specifically, the step of obtaining the initial position information of the next image to be matched based on the actual position information of the image to be matched obtained last time includes: obtaining the difference between the actual position information of the image to be matched obtained last time and the initial position information; using the difference to compensate the initial position information of the image to be matched obtained last time to obtain the compensated initial position information; and obtaining the initial position information of the next image to be matched based on the compensated initial position information.
[0116] In other embodiments, the actual position information of the image to be matched acquired last time is used as the compensated initial position information.
[0117] Specifically, in this embodiment, the preset distribution rule is a periodic distribution; there is a preset distance vector between the image to be matched that was previously subjected to the third matching process and the image to be matched that is next subjected to the third matching process.
[0118] The step of obtaining the initial position information of the next image to be matched according to the compensated initial position information includes: translating the first actual position information by the preset distance vector to obtain the initial position information. Based on the above embodiment, in order to further reduce the amount of calculation consumed by matching, before the first matching process, this embodiment divides the original image into multiple regions, each region includes one image to be matched, and the multiple regions include a first region and a second region, the first region includes the first image, and the second region includes the second image.
[0119] Wherein, the area is preferably as small as possible on the basis of being able to contain a complete image to be matched, so as to further avoid matching operations on the interval part and the blank invalid part through the smaller size. Figure 2 In the division diagram shown, the original image contains 6 images to be matched. It can be seen that there are still large blank areas between each image to be matched and at the edge of the original image. By dividing it into multiple areas, each image to be matched is placed in a smaller range, thereby further reducing the consumed computing resources. The division into multiple areas is also based on the preset distribution rule.
[0120] For ease of understanding, this application also specifically provides a method for dividing the original image into multiple regions, see Figure 3 :
[0121] Figure 3 The original image on the left has 8 images to be matched arranged in a 4×2 (4 rows and 2 columns) format;
[0122] According to the preset distribution position and size of the unit to be tested corresponding to each image to be matched, Figure 3 The original image on the left is segmented, starting from the upper left corner and segmented from left to right, to obtain 8 regions. Each image to be matched is contained in a different region. After segmentation, Figure 3 For easy identification, the eight regions are numbered C0, C1, ..., C6, and C7 in a Z-shaped order from top to bottom and from left to right.
[0123] Based on the scheme of dividing the original image into multiple regions, the first matching process of the template image in the original image also needs to be changed accordingly, which can be: matching the template image in the first region; using the position information of the region in the first region with the greatest matching degree with the template image as the reference position information of the first image; and obtaining the first actual position information according to the reference position information. The first region includes the first image.
[0124] Furthermore, when there are multiple first images, the first matching process step further includes:
[0125] Obtaining weight and reference position information of each first image;
[0126] The reference position information of the corresponding first image is weighted by using the weight of each first image to obtain the first actual position information.
[0127] The step of obtaining the weight includes:
[0128] The weight is obtained according to the relative position relationship between the first area and the boundary of the original image, that is, the first actual position information is obtained by weighted calculation.
[0129] When the number of the first images is one, obtaining the first actual position information according to the reference position information includes: using the reference position information of the first image as the first actual position information. The first actual position information includes the relative position relationship between the first image and the first area, and specifically, the first actual position information includes the distance between each edge of the first image and the corresponding edge of the first area.
[0130] The second actual position information includes the relative position relationship between the second image and the second area. Specifically, the second actual position information includes the distance between each edge of the second image and the corresponding edge of the second area.
[0131] The acquiring the initial position information of the second image according to the first actual position information and the preset distribution rule includes: using the first actual position information as the initial position information.
[0132] Corresponding to the step of the first matching process given above, the step of obtaining the second actual location information through the second matching process may include:
[0133] The detection area is determined according to the initial position information and the preset matching range, and the position of the matching area with the greatest matching degree with the template image in the detection area is obtained as the second actual position information according to the initial position information. The preset matching range may be a range determined by a circle of a preset diameter, or a range determined by a rectangle of preset length and width, which is not specifically limited here. Specifically, the initial position information may be the center of the detection area. If the detection area has a coordinate system, the initial position information may be specifically the coordinates of the center point of the detection area.
[0134] In order to facilitate understanding of how to achieve the purpose of this application under the scheme of dividing the original image into multiple regions, Figure 3As an example, a specific process of obtaining the first actual position information and the second actual position information is given in combination with specific parameters:
[0135] Specifically, due to Figure 3 In the original image on the left, the images to be matched are arranged in 4 rows and 2 columns, and the whole is presented as a rectangle. It is not possible to conveniently select an image to be matched in the most central position as the first image. Therefore, two areas numbered C0 and C7 are used as the first images here (C0 and C7 are the two areas at both ends of a diagonal line in the rectangle) to obtain the first actual position information as the basis.
[0136] First, the weight and reference position information of the image to be matched contained in C0 are obtained, wherein the weight of the image to be matched contained in C0 can be obtained according to the relative position relationship between C0 and the boundary of the original image; the reference position information of the image to be matched contained in C0 can be obtained by the following steps: matching the template image in C0; taking the position information of the matching area in C0 with the greatest matching degree with the template image as the reference position information of the image to be matched contained in C0. Through the above steps, the template image can be translated from the initial translation position to the offset (17,4) corresponding to the reference position information. The offset is combined with the known quantity of the actual position information of the image of the standard object in the template image to convert the specific reference position information. Since the known quantity does not change, the offset (17,4) is directly used here as the reference position information of the image to be matched contained in C0.
[0137] Similarly, the weight and reference position information (14, 1) of the image to be matched contained in C1 can be obtained. It should be noted that, for the convenience of calculation, this embodiment assumes that the relative position relationship between C0 and the boundary of the original image is consistent with the relative position relationship between C1 and the boundary of the original image, so the two weights are consistent and are both 0.5.
[0138] Next, the reference position information of the corresponding images to be matched is weighted using the weights of the images to be matched contained in C0 and C1, and the specific formula is as follows:
[0139] Init_Off.x=a*Result_Off[0].x+b*Result_Off[N-1].x
[0140] =0.5*17+0.5*14
[0141] =15;
[0142] Init_Off.y=a*Result_Off[0].y+b*Result_Off[N-1].y
[0143] =0.5*4+0.5*1
[0144] =2.
[0145] Wherein, Result_Off[0].x is the x value in the reference position information of the image to be matched contained in C0, and Result_Off[0].y is the y value in the reference position information of the image to be matched contained in C0; Result_Off[N-1].x is the x value in the reference position information of the image to be matched contained in C7, and Result_Off[N-1].y is the y value in the reference position information of the image to be matched contained in C7; a and b are weights respectively.
[0146] The first actual position information can be obtained by the above formula: (15, 2). The six regions except C0 and C7 can directly use the parameter (15, 2) as the initial position information of the images to be matched contained in C1 to C6, and finally obtain the actual position information corresponding to the images to be matched contained in C1 to C6 respectively through matching, which are:
[0147] C1: (15,4), C2: (16,3), C3: (15,3), C4: (16,2), C5: (15,1), C6: (16,1).
[0148] For ease of understanding, here we take C1 as an example to show how to get (15,4) from (15,2):
[0149] At (15, 2) in the C1 coordinate system, an area having the same size and shape as the template image is obtained as a starting area;
[0150] Performing a second comparison process on the image to be matched in the starting area and the template image to obtain a matching degree of the starting area;
[0151] After the second comparison process is completed, the second matching area is sequentially acquired in C1 along the preset track with the starting position information (15, 2) as the starting point, and the second matching area has the same size and shape as the template area;
[0152] Performing a third comparison process on the second matching area and the template image to obtain a matching degree of the second matching area;
[0153] The second matching area is obtained repeatedly along the preset trajectory, and the third comparison processing step is repeated. After the preset trajectory is longitudinally translated by two units at a time, it is found that the matching degree corresponding to the second matching area at this time is greater than the preset matching degree threshold. Therefore, the position information (15, 4) of the second matching area at this time will be used as the actual position information of the image to be matched contained in C1.
[0154] It can be seen that C0~C7 each has a coordinate system, and the second actual positions obtained above are also coordinates in the respective coordinate systems of C0~C7. In this case, when determining the actual position information of the image to be matched contained in the next area, it is only necessary to directly apply the specific coordinates of the first actual position information to the coordinate system of the target area. There is no need to translate the first actual position information in combination with the distance between the first image and the second image as before the area is divided.
[0155] It can be seen that the actual position information of the images to be matched contained in each of the six regions numbered C1 to C6 is not far from (15,2), which proves that the first actual position information can indeed save computing resources, reduce matching time, and improve matching efficiency.
[0156] It should also be noted that this example is based on the fact that the shapes and sizes of the divided regions are the same and the regions are distributed periodically. In other words, it is based on the fact that the positional relationship of the second image relative to the edge of the second region is the same as the positional relationship of the first image relative to the edge of the first region. Corresponding to the above example, the positional relationship of the images to be matched contained in C1 to C6 relative to the edges of C1 to C6 is the same as the positional relationship of the images to be matched contained in C0 and C7 relative to the edges of C0 and C7. In this case, the first actual position information (15, 2) calculated based on C0 and C7 can be used directly and without adjustment as the initial position information of the images to be matched contained in C1 to C6.
[0157] It can be seen that the actual position information of the images to be matched contained in C1 to C6 in the above scheme is obtained on the basis of (15,2). Some of them are slightly different from (15,2), such as (15,3) of C3, (16,2) of C4, and (15,1) of C5, but others are quite different. In order to further reduce the consumed computing resources and improve the accuracy of the basis, the (15,2) used as the basis can be adjusted continuously according to the actual position information of the images to be matched contained in the previous area during the calculation process, so that it is more accurate in the continuous adjustment process. Still taking C1 to C6 as an example, the calculation process under this method is as follows:
[0158] (1)C1
[0159] Initial position information: Init_Off[1] = Init_Off: (15, 2)
[0160] Second actual position information: Result_Off[1](15,4)
[0161] (2)C2
[0162] Initial position information: Init_Off[2] = 0.5*Init_Off+0.5*Result_Off[1] = (15, 3)
[0163] Second actual position information: Result_Off[2] = (16, 3)
[0164] It can be seen that the initial position information used to determine the actual position information of the image to be matched contained in C2 is not (15,2), but (15,2) and the actual position information of the image to be matched contained in C1 are calculated together to form (15,3). The actual position information of the image to be matched contained in C2 is (16,3). By comparison, it can be seen that compared with the unadjusted (15,2), using (15,3) as the initial position information can obviously consume less computing resources and matching time.
[0165] (3)C3
[0166] Initial position information: Init_Off[3] = 0.5*Init_Off+0.5*Result_Off[2] = (15, 2)
[0167] Second actual position information: Result_Off[3] = (15, 3)
[0168] (4)C4
[0169] Initial position information: Init_Off[4] = 0.5*Init_Off+0.5*Result_Off[3] = (15, 2)
[0170] Second actual position information: Result_Off[4] = (16, 2)
[0171] (5)C5
[0172] Initial position information: Init_Off[5] = 0.5*Init_Off+0.5*Result_Off[4] = (15, 2)
[0173] Second actual position information: Result_Off[5]=(15,2)
[0174] (6)C6
[0175] Initial position information: Init_Off[6] = 0.5*Init_Off+0.5*Result_Off[5] = (15, 2)
[0176] Second actual position information: Result_Off[6]=(16,1)
[0177] The above processes of C3, C4, C5 and C6 are similar to those of C2, and will not be described in detail here. It can be clearly seen that, compared with each actual position information, the adjusted initial position information is closer than the unadjusted initial position information.
[0178] On the basis of the above-mentioned embodiment scheme, in order to improve the matching efficiency as much as possible, this application also provides a method of invoking the computing resources of the GPU to perform the matching operation (including the first matching process and / or the second matching process) through the CUDA algorithm, starting from the subject performing the matching process. Compared with the method of using the computing resources of the CPU to perform this process, the GPU has more computing units that are more suitable for graphics-related operations, which can bring higher matching efficiency.
[0179] Based on the image processing method provided in the above content, this application also provides a positioning method based on this, see Figure 4 The flowchart shown:
[0180] S201: providing a test object, wherein the test object includes a plurality of test units;
[0181] S202: Acquire an image of the object to be tested to obtain an original image;
[0182] The original image is an image obtained by photographing the object to be tested including a plurality of units to be tested, and each image to be matched included in the original image is an image corresponding to a corresponding unit to be tested.
[0183] S203: According to the above image processing method, the actual position information of the image to be matched is obtained;
[0184] S204: Obtaining the relative position relationship of the unit under test in the object under test according to the actual position information.
[0185] Through the above positioning method, the position information determined on the image is restored to the real object.
[0186] In one embodiment of the present application, the object to be tested is a wafer with a pattern, and the wafer includes a plurality of dies; or, the object to be tested is an OLED substrate, and the OLED substrate includes a plurality of OLED panel units.
[0187] The original image is an image of the object to be tested, and the image to be matched in the original image is an image of the unit to be tested.
[0188] Because the situation is complicated, it is impossible to list them one by one for explanation. Those skilled in the art should be aware that there may be many examples based on the basic method principles provided by this application combined with actual conditions, and all of them should be within the scope of protection of this application without sufficient creative work.
[0189] See below Figure 5 and Figure 6 , Figure 5 A structural block diagram of an image processing device provided in an embodiment of the present application is shown in FIG. Figure 6 A structural block diagram of a positioning device provided in an embodiment of the present application.
[0190] Wherein, the image processing device may include:
[0191] The original image and template image acquisition module 100 is used to acquire an original image including a plurality of images to be matched and a template image of the images to be matched, wherein the images to be matched are distributed according to a preset distribution rule, and the plurality of images to be matched include a first image and a second image;
[0192] A first matching processing module 200 is used to perform a first matching process on the template image in the original image to obtain first actual position information of the first image;
[0193] An initial position information acquisition module 300 is used to acquire initial position information of the second image according to the first actual position and a preset distribution rule;
[0194] The second actual position information acquisition module 400 is used to make the template image perform a second matching process on the second image according to the initial position information to acquire the second actual position information of the second image.
[0195] Wherein, the positioning device may include:
[0196] The test object providing module 500 is used to provide a test object, wherein the test object includes a plurality of test units;
[0197] The original image acquisition module 600 is used to acquire the image of the object to be tested and obtain the original image;
[0198] The actual position information acquisition module 700 is used to acquire the actual position information of the image to be matched according to the image processing method provided in the above content;
[0199] The relative position relationship acquisition module 800 is used to acquire the relative position relationship of the unit under test in the object under test according to the actual position.
[0200] Based on the above embodiments, the present application also provides an image processing device and a positioning device respectively, wherein the image processing device may include a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, all the steps of the image processing method described in the above embodiments can be implemented. The positioning device may include a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, all the steps of the positioning method described in the above embodiments can be implemented. Of course, both the image processing device and the positioning device may also include various necessary network interfaces, power supplies, and other components.
[0201] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by an execution terminal or a processor, all steps of the image processing method and / or all steps of the positioning method described in the above embodiment can be implemented. The storage medium may include: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0202] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0203] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0204] Specific examples are used herein to illustrate the principles and implementation methods of the present application, and the description of the above embodiments is only used to help understand the method and core ideas of the present application. For ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
[0205] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or equipment including the elements.
Claims
1. An image processing method, characterized in that: include: Acquire an original image including a plurality of images to be matched and a template image of the images to be matched, wherein the images to be matched are distributed according to a preset distribution rule, and the plurality of images to be matched include a first image and a second image; Performing a first matching process on the template image in the original image to obtain first actual position information of the first image; Acquire initial position information of the second image according to the first actual position information and the preset distribution rule; causing the template image to perform a second matching process on the second image according to the initial position information to obtain second actual position information of the second image; Before the first matching process, the method further includes: dividing the original image into a plurality of regions, each region including one of the to-be-matched images, the plurality of regions including a first region and a second region, the first region including the first image, and the second region including the second image; The preset distribution rule is a periodic distribution; the shapes and sizes of the regions are the same and are distributed according to the preset distribution rule; the first actual position information includes the relative position relationship between the first image and the first region, and the second actual position information includes the relative position relationship between the second image and the second region; obtaining the initial position information of the second image according to the first actual position information and the preset distribution rule includes: using the first actual position information as the initial position information.
2. The image processing method according to claim 1, characterized in that: The first image includes a combination of one or more of an image to be matched located at the center of the original image and images to be matched located at both ends of a diagonal line of the original image.
3. The image processing method according to claim 1, characterized in that: The first matching process comprises: matching the template image within the first area; Using the position information of the area in the first area with the greatest matching degree with the template image as the reference position information of the first image; The first actual position information is acquired according to the reference position information.
4. The image processing method according to claim 3, characterized in that: The number of the first images is 1, and acquiring the first actual position information according to the reference position information includes: using the reference position information of the first image as the first actual position information; or, The number of the first images is multiple, and the first matching process step includes: Acquire the weight and reference position information of each of the first images; Using the weight of each of the first images, weighted processing is performed on the reference position information of the corresponding first image to obtain the first actual position information; The steps of obtaining the weights include: The weight is obtained according to the relative position relationship between the first area and the boundary of the original image.
5. The image processing method according to claim 1, characterized in that: The second matching processing step includes: determining a detection area according to the initial position information and a preset matching range, and obtaining, according to the initial position information, a position of a matching area in the detection area with the greatest matching degree with the template image as the second actual position information; Alternatively, the second matching process includes: taking the initial position information as a starting point, sequentially acquiring a second matching area in the original image along a preset trajectory, and performing a comparison process on the second matching area and the template image to acquire a matching degree of the second matching area; when the matching degree is greater than a preset threshold, acquiring the position information of the second matching area as the second actual position information of the second image.
6. The image processing method according to any one of claims 1 to 5, characterized in that: The original image also includes one or more third images, and the method further includes: sequentially acquiring actual position information of the third images according to actual position information of the image to be matched acquired last time.
7. The image processing method according to claim 6, characterized in that: The steps of sequentially acquiring the actual position information of the third image include: acquiring the difference between the actual position information of the image to be matched acquired last time and the initial position information; using the difference to compensate the initial position information of the image to be matched acquired last time, and acquiring the compensated initial position information; acquiring the initial position information of the next image to be matched according to the compensated initial position information, and performing a third matching process to acquire the actual position information of the third image.
8. An image processing device, characterized in that: include: An original image and template image acquisition module, used to acquire an original image including a plurality of images to be matched and a template image of the images to be matched, wherein the images to be matched are distributed according to a preset distribution rule, and the plurality of images to be matched include a first image and a second image; A first matching processing module, used for performing a first matching process on the template image in the original image to obtain first actual position information of the first image; An initial position information acquisition module, used to acquire the initial position information of the second image according to the first actual position information and the preset distribution rule; A second actual position information acquisition module, configured to cause the template image to perform a second matching process on the second image according to the initial position information, so as to acquire second actual position information of the second image; The image processing device is further specifically used to: divide the original image into a plurality of regions, each region including one of the to-be-matched images, the plurality of regions including a first region and a second region, the first region including the first image, and the second region including the second image; The preset distribution rule is a periodic distribution; the shapes and sizes of the regions are the same and are distributed according to the preset distribution rule; the first actual position information includes the relative position relationship between the first image and the first region, and the second actual position information includes the relative position relationship between the second image and the second region; The initial position information acquisition module is specifically used to: use the first actual position information as the initial position information.
9. A positioning method, characterized in that: include: Providing an object to be tested, wherein the object to be tested includes a plurality of units to be tested; Acquire the image of the object to be tested to obtain an original image; According to the image processing method according to any one of claims 1 to 7, obtaining actual position information of the image to be matched; The relative position relationship of the unit under test in the object under test is acquired according to the actual position information.
10. An image processing device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the image processing method according to any one of claims 1 to 7 when executing the computer program.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the image processing method according to any one of claims 1 to 7 and / or the positioning method according to claim 9 is implemented.
