Watch case defect inspection method and system based on visual assistance
Through the visually assisted watch case defect inspection method, the control image and grayscale partition analysis are used to solve the problem of defect detection accuracy caused by the reflection and curved surface design of the watch case, achieving higher detection accuracy and reliability.
Patent Information
- Application Number
- CN202510322496.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2045-03-19
AI Technical Summary
Existing methods for defect detection of watch cases are unevenly reflected by high-gloss surface reflection and curved surface design, resulting in reduced accuracy of defect detection, especially when some defects are hidden in highlights or shadows and are difficult to detect.
The visually assisted watch case defect inspection method is used to obtain watch images, detect corner points, generate control images, divide grayscale partitions, calculate the probability and abnormality index of the same area, combine growth and stable abnormality trends, and evaluate the degree of abnormality of the grayscale partition to determine the defects.
It improves the accuracy of the defect detection of watch case, can effectively identify defects hidden in highlights or shadows, and enhances the reliability of the detection results.
Smart Images

Figure CN119863453A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a method and system for inspecting watch case defects based on vision assistance. Background Art
[0002] During the watch manufacturing process, improper process control or external environmental factors may cause defects in the watch case. For example, improper material selection, mold defects, uneven polishing, imperfect coating treatment and other problems may cause scratches, bubbles or spots on the watch case, causing the watch case to fail to meet the expected quality standards before leaving the factory, so the watch case needs to be inspected for defects.
[0003] In the prior art, since the defects of the watch case exist on the surface of the watch case, the visual image processing method is used to detect the defects of the watch case. However, the reflection of the watch case will affect the visual inspection of the defects, because the high-gloss surface easily forms strong light reflection, making it difficult to clearly distinguish small defects in the image obtained by visual processing. The curved surface design of the case may cause light to reflect at different angles, resulting in uneven reflective areas, making some defects hidden in highlights or shadows and difficult to detect, thereby reducing the accuracy of defect detection. Summary of the invention
[0004] The present invention provides a watch case defect inspection method and system based on visual assistance to solve the problem of reduced accuracy of existing defect detection. The technical solution adopted is as follows: The present invention proposes a method for inspecting watch case defects based on visual assistance, the method comprising the following steps: Obtain several watch images for each watch; Obtain a target watch and a target watch image, and obtain a comparison possibility between the target watch image and each watch image of each watch and several comparison images of the target watch image based on a similarity relationship between the watch images of other watches except the target watch and the positions of corner points in the target watch image; Obtain several watch grayscale partitions in each watch image of each watch; obtain the probability of each watch grayscale partition in the target watch image and each watch grayscale partition in the comparison image of the target watch image being in the same area according to the relative position relationship between the watch grayscale partitions in the watch image; obtain the abnormality index of each watch grayscale partition of the target watch image in combination with the comparison probability; Obtain a target watch grayscale partition and several corresponding watch grayscale partitions; obtain a growth abnormality trend and a stable abnormality trend of the target watch grayscale partition according to the relationship between the area and the abnormality index of the target watch grayscale partition and its corresponding watch grayscale partition; obtain the abnormality degree of the target watch grayscale partition according to the growth abnormality trend, stable abnormality trend and abnormality index of the target watch grayscale partition, combined with the area of the target watch grayscale partition and its corresponding watch grayscale partition; According to the abnormality degree of all watch grayscale partitions of all watch images of the target watch, the case defect inspection result of the target watch is obtained.
[0005] Furthermore, the target watch and the target watch image are obtained, and the possibility of comparing the target watch image with each watch image of each watch and several comparison images of the target watch image are obtained according to the similarity relationship between the watch images of other watches except the target watch and the positions of the corner points in the target watch image, including the specific method of: Perform corner point detection processing on any watch image to obtain several corner points in the watch image; In each watch image, the same rectangular coordinate system is established with the direction of movement of the watch in the watch image as the horizontal coordinate, and the origin of the coordinate system is the starting point of the direction of movement of the watch; Recording a watch with a case defect to be detected as a target watch; and recording any watch image of the target watch as a target watch image; Target watch image and The first watch The comparison probability of the watch images is calculated as: In the formula, For the target watch image and The first watch Possibility of comparing images of watches; is the number of corner points in the target watch image; For the The first watch The number of corner points in the watch image; The target watch image Corner point and The first watch Watch image The absolute value of the difference in ordinate between the corner points; The target watch image Corner point and The first watch Watch image The Euclidean distance between the coordinate positions of the corner points; is an exponential function with a natural constant as base; is a linear normalization function; For any watch other than the target watch, the watch image that has the highest probability of being compared with the target watch image among all the watch images of the watch is recorded as the comparison image of the target watch image.
[0006] Furthermore, the specific method of obtaining a plurality of watch grayscale partitions in each watch image of each watch includes: The pixels in any watch image are clustered by DBSCAN according to their grayscale values, and the connected domain formed by the pixels belonging to the same cluster is recorded as a watch grayscale partition in the watch image.
[0007] Furthermore, the method of obtaining the probability of each watch grayscale partition in the target watch image and each watch grayscale partition in the reference image of the target watch image being in the same area according to the relative position relationship between the watch grayscale partitions in the watch image includes the following specific methods: The target watch image The grayscale partition of the watch and the target watch image The first The calculation method of the same area probability of the grayscale partition of each watch is: In the formula, is the first The grayscale partition of the watch and the target watch image The first The probability of the same area of the grayscale partition of each watch; is the number of watch grayscale partitions in the target watch image; The target watch image The number of grayscale partitions of the watch in the control image; is the first The centroid of the grayscale partition of the watch to the The vector of the centroid of the grayscale partitions of each watch; The target watch image The first The centroid of the grayscale partition of the watch to the The vector of the centroid of the grayscale partitions of each watch; is the first The average grayscale of each grayscale partition of the watch; The target watch image The first The average grayscale of each grayscale partition of the watch; is an exponential function with a natural constant as base; is the weight normalization function; is the absolute value function.
[0008] Furthermore, the specific method of obtaining the abnormal index of each watch grayscale partition of the target watch image includes: In the formula, The target watch image Abnormal index of grayscale partition of each watch; is the number of comparison images of the target watch image; The target watch image and its The comparison probability of the comparison images; is the first The grayscale partition of the watch and the target watch image The maximum value of the same region probability of all the watch grayscale partitions in the comparison image; is a linear normalization function; is an exponential function with a natural constant as its base.
[0009] Furthermore, the specific method of obtaining the target watch grayscale partition and several corresponding watch grayscale partitions includes: Record any watch grayscale partition in the target watch image as the target watch grayscale partition; Perform SIFT corner point matching on the target watch image and any other watch image of the target watch except the target watch image, obtain the distance between any corner point in the target watch image and the matching corner point of the corner point in the watch image, and record it as the matching distance of the corner point; record the mode of the matching distances of all corner points in the target watch image as the displacement distance from the target watch image to the watch image; Obtain the coordinates of the centroid of the target watch grayscale partition, and record the sum of the horizontal coordinate of the centroid of the target watch grayscale partition and the displacement distance from the target watch image to the watch image as the horizontal coordinate of the corresponding centroid of the target watch grayscale partition in the watch image; record the vertical coordinate of the centroid of the target watch grayscale partition as the vertical coordinate of the corresponding centroid of the target watch grayscale partition in the watch image; record the watch grayscale partition where the pixel point at the position of the horizontal coordinate of the corresponding centroid of the target watch grayscale partition in the watch image and the corresponding centroid vertical coordinate is located as a corresponding watch grayscale partition of the target watch grayscale partition.
[0010] Furthermore, the abnormal growth trend is specifically obtained by: For any corresponding watch grayscale partition of the target watch grayscale partition, the maximum value between the difference between the abnormal index of the target watch grayscale partition and the abnormal index of the corresponding watch grayscale partition and 0 is recorded as the abnormal reduction degree of the corresponding watch grayscale partition; The weight normalization result of the maximum value between the difference obtained by subtracting the area of the target watch grayscale partition from the area of the corresponding watch grayscale partition and 0 is recorded as the area increase weight of the corresponding watch grayscale partition; The product of the abnormal reduction degree of the corresponding watch grayscale partition and the area increase weight is recorded as the growth abnormality index of the corresponding watch grayscale partition; The sum of the growth anomaly indexes of all corresponding watch grayscale partitions of the target watch grayscale partition is recorded as the growth anomaly trend of the target watch grayscale partition.
[0011] Furthermore, the specific method for obtaining the stable abnormal trend is as follows: For any corresponding watch grayscale partition of the target watch grayscale partition, the inverse proportional normalization result of the absolute value of the difference between the abnormal index of the target watch grayscale partition and the abnormal index of the corresponding watch grayscale partition is recorded as the abnormal similarity index of the corresponding watch grayscale partition; The weight normalization result of the inverse proportion normalization of the absolute value of the area difference between the corresponding watch grayscale partition and the target watch grayscale partition is recorded as the area change weight of the corresponding watch grayscale partition; The product of the abnormal similarity index of the corresponding watch grayscale partition and the area change weight is recorded as the stable abnormal index of the corresponding watch grayscale partition; The sum of the stability anomaly indexes of all corresponding watch grayscale partitions of the target watch grayscale partition is recorded as the stability anomaly trend of the target watch grayscale partition.
[0012] Furthermore, the abnormal degree of the target watch grayscale partition is obtained according to the abnormal growth trend, stable abnormal trend and abnormal index of the target watch grayscale partition, combined with the area of the target watch grayscale partition and its corresponding watch grayscale partition, including the specific method of: In the formula, The abnormality degree of the grayscale partition of the target watch; is the abnormal index of the grayscale partition of the target watch; The variance of the difference between the area of all corresponding watch grayscale partitions of the target watch grayscale partition and the area of the target watch grayscale partition; Abnormal growth trend of grayscale partition for target watch; The stable abnormal trend of the grayscale partition of the target watch; is a linear normalization function.
[0013] The present invention also proposes a watch case defect inspection system based on visual assistance, which includes a memory, a processor, and a computer program stored in the memory and running on the processor, and the processor implements the steps of the above method when executing the computer program.
[0014] The beneficial effects of the present invention are as follows: in the process of inspecting defects on watch cases, it is necessary to compare and inspect the watch cases. Since the watches have the same process specifications and the positions of the watches relative to the light facilities for quality inspection are the same, the reflective content on the watch cases is the same. The present invention obtains the possibility of comparing the target watch image with each watch image of each watch and several comparison images of the target watch image through the similarity between the watch images of other watches except the target watch and the corner point positions in the target watch image, judges the degree of comparability of each watch image to the target watch image, and selects the comparison image of the target watch image for defect comparison inspection. Since under suitable lighting conditions, the grayscale value of the defective area will be different from the grayscale value of the area at the same position in the comparison image, the present invention first obtains several watch grayscale partitions in each watch image of each watch, and then obtains the grayscale partitions of each watch in the target watch image according to the relative position relationship between the watch grayscale partitions in the watch image. The probability of the same area of each watch grayscale partition in the comparison image of the grayscale partition and the target watch image is that the defects will form a separate watch grayscale partition in the watch image, and the watch cases with defects are few, and the watch grayscale partition formed by the defects does not exist in other comparison images without defects, so the probability of the separate watch grayscale partition caused by the defects and all the watch grayscale partitions in the comparison image being in the same area will be relatively low. The present invention obtains the abnormal index of each watch grayscale partition of the target watch image by comparing the possibility and the probability of the same area; during the transmission of the watch, due to the uneven reflective area caused by the curved surface design of the watch case, some defects will be hidden in highlights or shadows at some watch transmission positions and are difficult to detect, so the present invention obtains the abnormal degree of the target watch grayscale partition according to the growth abnormal trend, stable abnormal trend and abnormal index of the target watch grayscale partition, combined with the target watch grayscale partition and its corresponding watch grayscale partition area. So far, the present invention obtains the watch case defect inspection result through the abnormal degree of all watch grayscale partitions of all watch images of the target watch, thereby improving the accuracy of the watch case defect inspection result. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the embodiments of the present invention 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 some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0016] Figure 1 A schematic flow chart of a method for inspecting watch case defects based on visual assistance provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0018] See also Figure 1 , which shows a flow chart of a method for inspecting watch case defects based on visual assistance provided by an embodiment of the present invention, the method comprising the following steps: Step S001: Acquire several watch images of each watch.
[0019] It should be noted that the defects of the watch case exist on the surface of the watch case, so it is necessary to first use an industrial camera to collect the watch image.
[0020] Specifically, a conveyor belt is arranged at the quality inspection process position of the watch production line, and an industrial camera is arranged and installed directly above the conveyor belt, so that the lens of the industrial camera is aimed at the conveyor belt, and the watches are evenly placed on the conveyor belt in any fixed direction, so that there is only one watch in the lens of the industrial camera. During the conveyor belt transmission process, the industrial camera is used to The watch images are continuously collected at a frequency of times / second to obtain several watch RGB images of each watch; all the watch RGB images of each watch are grayed to obtain several watch images of each watch; wherein, graying is a well-known technology, and the specific method is not introduced here; it should be noted that the collection of all the watch images of each watch is continuous, so all the watch images of each watch are arranged according to the time sequence of acquisition; wherein, To preset the acquisition frequency, this embodiment uses Let's take this as an example.
[0021] Step S002, obtain the target watch and the target watch image, and obtain the possibility of comparing the target watch image with each watch image of each watch and several comparison images of the target watch image based on the similarity between the watch images of other watches except the target watch and the corner point positions in the target watch image.
[0022] It should be noted that during the conveying process of the conveyor belt, since the position of the industrial camera is fixed, the position of the quality inspection light facility remains unchanged. However, as the conveying position of the watch on the conveyor belt changes, the position of the watch relative to the quality inspection light facility changes. Due to the curved surface design of the watch case, the light reflection on the watch case also changes accordingly. Therefore, the closer the positions of different watches in the watch image are, the more consistent the positions of the watches relative to the quality inspection light facility are, and the more consistent the reflection content on the watch case is. In order to reference the images of different watches at the same position, it is first necessary to determine whether the two watches are in the same position.
[0023] It should be further explained that, since the watch surface has craft texture features, when matching different watch images, the watch images are firstly subjected to corner detection processing.
[0024] Specifically, corner point detection is performed on any watch image to obtain several corner points in the watch image; wherein, corner point detection is a well-known technology, and the specific method is not introduced here.
[0025] It should be noted that, since the watches are evenly placed on the conveyor belt in a fixed direction, and the movement paths of different watches in the lens of the industrial camera during the conveying process are the same, a rectangular coordinate system is established with the movement direction of the watch as the horizontal coordinate. Since the specifications of different watches produced continuously are consistent, the vertical coordinates of the positions of the corner points of the same part of different watches are similar. When judging whether the watches in different images are in the same position, the main focus is on the distance between the corner points with similar vertical coordinates. The smaller the overall distance, the closer the positions of the two watches in the two images, the more consistent the positions of the watches relative to the light facilities for quality inspection, and the greater the possibility of comparing the two images. Therefore, the possibility of comparing any two watches between any two watch images is obtained based on this.
[0026] Specifically, in each watch image, the same rectangular coordinate system is established with the direction of movement of the watch in the watch image as the horizontal coordinate, and the origin of the coordinate system is the starting point of the direction of movement of the watch; Recording a watch with a case defect to be detected as a target watch; and recording any watch image of the target watch as a target watch image; Target watch image and The first watch The comparison probability of the watch images is calculated as: In the formula, For the target watch image and The first watch Possibility of comparing images of watches; is the number of corner points in the target watch image; For the The first watch The number of corner points in the watch image; The target watch image Corner point and The first watch Watch image The absolute value of the difference in ordinate between the corner points; The target watch image Corner point and The first watch Watch image The Euclidean distance between the coordinate positions of the corner points; is an exponential function with a natural constant as base; is a linear normalization function, and the normalized object is the first Corner point and The first watch The distance between all corner points in the watch image .
[0027] It should be noted that The smaller the Corner point and The first watch Watch image The more similar the vertical coordinates between the corner points are, the more likely they are matching points; The smaller it is, The smaller the Euclidean distance between the corner points, the more likely it is to be a matching point. The first watch The more likely the first watch image is to be in the same position, the more likely the target watch is to be in the same position as the The closer the positions of the first and second watches are in the image, the closer the target watch is to the The more consistent the position of the two watches in the two images relative to the quality inspection light facilities, and the more consistent the reflected content on the two watch cases, the more likely it is that the two can be compared for defect detection.
[0028] It should be noted that, for any watch other than the target watch, in order to select the image that best matches the target watch from all the watch images of the watch for comparison and defect detection, the watch image with the highest comparison possibility is selected for comparison, so that the comparison results of the two images are more credible.
[0029] Specifically, for any watch other than the target watch, the watch image that has the highest possibility of being compared with the target watch image among all the watch images of the watch is recorded as the comparison image of the target watch image.
[0030] Step S003, obtaining several watch grayscale partitions in each watch image of each watch; obtaining the probability of each watch grayscale partition in the target watch image and each watch grayscale partition in the control image of the target watch image being in the same area according to the relative position relationship between the watch grayscale partitions in the watch image; combining the control possibility, obtaining the abnormality index of each watch grayscale partition of the target watch image.
[0031] It should be noted that the curved design of the watch case may cause light to be reflected at different angles, resulting in uneven reflective areas and making some defects hidden in highlights or shadows and difficult to detect. In order to distinguish normal areas from highlights or shadow areas where defects are difficult to distinguish, the area is divided according to the grayscale value, and the watch image is divided into several watch grayscale partitions according to the grayscale. Different watches have the same size specifications and similar positions relative to the quality inspection light facilities, that is, different watches are in the same position in their corresponding images. The distribution of the watch grayscale partitions in the watch image should be similar, so the watch grayscale partitions in different watch images are matched.
[0032] Specifically, the pixels in any watch image are clustered by DBSCAN according to their grayscale values, and the connected domain formed by the pixels belonging to the same cluster is recorded as a watch grayscale partition in the watch image; wherein, DBSCAN clustering is a well-known technology, and the specific method is not introduced here.
[0033] It should be further explained that, for the watch grayscale partitions in the target watch image that match those in the control image of the target watch image, that is, the areas at the same position on the target watch and other watches, the grayscale of the watch grayscale partitions existing in similar directions are similar. Therefore, the more similar the grayscale and positions of any watch grayscale partition in the target watch image and the watch grayscale partitions around a certain watch grayscale partition in the control image of the target watch image are, the more likely it is that the two watch grayscale partitions are matching each other, that is, the more likely they are watch grayscale partitions at the same position on different watches.
[0034] Specifically, the first The grayscale partition of the watch and the target watch image The first The calculation method of the same area probability of the grayscale partition of each watch is: In the formula, is the first The grayscale partition of the watch and the target watch image The first The probability of the same area of the grayscale partition of each watch; is the number of watch grayscale partitions in the target watch image; The target watch image The number of grayscale partitions of the watch in the control image; is the first The centroid of the grayscale partition of the watch to the The vector of the centroid of the grayscale partitions of each watch; The target watch image The first The centroid of the grayscale partition of the watch to the The vector of the centroid of the grayscale partitions of each watch; is the first The average grayscale of each grayscale partition of the watch; The target watch image The first The average grayscale of each grayscale partition of the watch; is an exponential function with a natural constant as base; is the weight normalization function, and the normalized object is the first The centroid of the grayscale partition of the watch to the The vector of the centroid of the grayscale partition of the watch is the same as the centroid of the target watch image. The first The vector from the centroid of the grayscale partition of a watch to the centroid of all grayscale partitions of the watch ; is the absolute value function.
[0035] It should be noted that The larger the value, the higher the The grayscale partition of each watch is The vector of the centroid of the grayscale partition of the watch is the same as the centroid of the target watch image. The first The grayscale partition of each watch is The closer the vectors of the centroids of the grayscale partitions of the watch are, the The grayscale partition of each watch is relative to the The position of the grayscale partition of the watch is the same as the position of the grayscale partition of the target watch image. In the control image The grayscale partition of each watch is relative to the The more similar the positions of the grayscale partitions of the first watch are; The grayscale partition of the watch and the target watch image The first If the grayscale partitions of the watches are in the same area, then under the premise of similar positions, the grayscale of the grayscale partitions of the watches is also similar, that is, The bigger, so The greater the premise, The larger the The bigger.
[0036] It should be noted that when there are defects on the watch case, due to the reflection of the case, the defects will be observed under suitable lighting conditions, and the defects will form a separate watch grayscale partition in the watch image. However, since there are only a few defective watch cases, and the watch grayscale partition formed by the defects does not exist in other control images without defects, the probability of the separate watch grayscale partition caused by the defect being in the same area as all the watch grayscale partitions in the control image is relatively low, so the abnormal index of each watch grayscale partition is determined based on this.
[0037] It should be further explained that the more similar the environment is to the control image, the more reference the control image has. When the probability that the watch grayscale partition in the target watch image is in the same area as all the watch grayscale partitions in the control image is relatively small, it means that the watch grayscale partition in the target watch image is more abnormal.
[0038] Specifically, the target watch image The calculation method of the abnormal index of the grayscale partition of each watch is: In the formula, The target watch image Abnormal index of grayscale partition of each watch; is the number of comparison images of the target watch image; The target watch image and its The comparison probability of the comparison images; is the first The grayscale partition of the watch and the target watch image The maximum value of the same region probability of all the watch grayscale partitions in the comparison image; is a linear normalization function, and the normalization object is the comparison possibility between the target watch image and all its comparison images; is an exponential function with a natural constant as its base.
[0039] Step S004, obtain the target watch grayscale partition and several corresponding watch grayscale partitions; obtain the growth abnormality trend and stable abnormality trend of the target watch grayscale partition according to the changing relationship between the area and abnormality index of the target watch grayscale partition and its corresponding watch grayscale partition; obtain the abnormality degree of the target watch grayscale partition according to the growth abnormality trend, stable abnormality trend and abnormality index of the target watch grayscale partition, combined with the area of the target watch grayscale partition and its corresponding watch grayscale partition.
[0040] It should be noted that the reflection of the watch case will affect the visual inspection of defects. The high-gloss surface easily forms strong light reflection, making it difficult to clearly distinguish small defects in the image obtained by visual processing. The curved design of the case may cause light to reflect at different angles, resulting in uneven reflective areas, making some defects hidden in highlights or shadows and difficult to detect. Therefore, in certain positions of the watch, the defects on the watch case cannot be clearly observed. However, during the transmission process, due to the change in the position of the watch, the light environment of the watch also changes. In some positions, the defects of the watch will be more obvious, so it is necessary to combine the changes in the degree of abnormality of the watch during the transmission process for analysis.
[0041] It should be further explained that due to the change in the position of the watch during the transmission process, the light conditions of the watch will change, and the grayscale partitions of the watch on the frame of the same watch case will change, so it is necessary to match the grayscale partitions of the watch between different frames. Since the watches are moving along the conveyor belt, after the corner points of the watches are matched, the displacement distance of the matching corner points in the image after a period of time is the same, so the displacement distance of the watch is obtained based on this, and then the grayscale partition of the target watch is displaced to obtain the corresponding grayscale partition of the watch, so as to achieve the correspondence of the grayscale partitions of the watch in the images of different positions of the same watch.
[0042] Specifically, any watch grayscale partition in the target watch image is recorded as the target watch grayscale partition; Perform SIFT corner point matching on the target watch image and any other watch image of the target watch except the target watch image, obtain the distance between any corner point in the target watch image and the matching corner point of the corner point in the watch image, and record it as the matching distance of the corner point; record the mode of the matching distances of all corner points in the target watch image as the displacement distance from the target watch image to the watch image; wherein SIFT corner point matching is a well-known technology, and the specific method is not introduced here; Obtain the coordinates of the centroid of the target watch grayscale partition, and record the sum of the horizontal coordinate of the centroid of the target watch grayscale partition and the displacement distance from the target watch image to the watch image as the horizontal coordinate of the corresponding centroid of the target watch grayscale partition in the watch image; record the vertical coordinate of the centroid of the target watch grayscale partition as the vertical coordinate of the corresponding centroid of the target watch grayscale partition in the watch image; record the watch grayscale partition where the pixel point at the position of the horizontal coordinate of the corresponding centroid of the target watch grayscale partition in the watch image and the corresponding centroid vertical coordinate is located as a corresponding watch grayscale partition of the target watch grayscale partition.
[0043] It should be noted that if the target watch grayscale partition is a defective watch grayscale partition formed by defects, during the transmission process, the defective watch grayscale partition is under appropriate lighting conditions, the defective watch grayscale partition will be more obvious, and the abnormality index will be higher. If the defective watch grayscale partition is in highlight or shadow, the defective watch grayscale partition may disappear, and the corresponding watch grayscale partition obtained is a watch grayscale partition formed by highlight or shadow, and the abnormality index of the corresponding watch grayscale partition will become lower. The range of the watch grayscale partition formed by highlight and shadow is relatively large relative to the range of the watch grayscale partition formed by defects, that is, if the defective watch grayscale partition is in highlight or shadow, the area of the corresponding watch grayscale partition will change greatly. Therefore, when the area of the corresponding watch grayscale partition increases to a large extent compared with the defective watch grayscale partition, the abnormality index of the corresponding watch grayscale partition will decrease, but when the area of the corresponding watch grayscale partition is similar to that of the defective watch grayscale partition, the abnormality index of the corresponding watch grayscale partition will be as high as that of the defective watch grayscale partition.
[0044] It should be further explained that when the area of the corresponding watch grayscale partition increases significantly relative to the target watch grayscale partition, the anomaly index also decreases significantly, indicating that the target watch grayscale partition is affected by light after reaching the watch position corresponding to the corresponding watch grayscale partition, but the anomaly index decreases significantly, indicating that the anomaly index of the target watch grayscale partition is larger, indicating that the target watch grayscale partition is more abnormal.
[0045] Specifically, the calculation method of the abnormal growth trend of the grayscale partition of the target watch is: In the formula, Abnormal growth trend of grayscale partition for target watch; The number of watch grayscale partitions corresponding to the target watch grayscale partition; The grayscale partition of the target watch The difference is obtained by subtracting the area of the target watch grayscale partition from the area of the corresponding watch grayscale partition; is the abnormal index of the grayscale partition of the target watch; The grayscale partition of the target watch The abnormality index corresponding to the grayscale partition of the watch; is the maximum value function; is the weight normalization function, and the normalized object is the grayscale partition of all corresponding watches of the target watch grayscale partition. .
[0046] In the formula, The grayscale partition of the target watch The degree of abnormal reduction of the grayscale partition of the corresponding watch; The grayscale partition of the target watch The area corresponding to the grayscale partition of the watch is increased in weight; The grayscale partition of the target watch The growth anomaly index of the corresponding watch grayscale partition.
[0047] It should be noted that The larger the value, the smaller the grayscale partition of the target watch. The grayscale partition area of the corresponding watch has increased significantly compared to the grayscale partition area of the target watch. The larger the value, the smaller the grayscale partition of the target watch. The abnormal index of the grayscale partition of the corresponding watch has been greatly reduced compared with the abnormal index of the grayscale partition of the target watch, indicating that the grayscale partition of the target watch may be a defective watch grayscale partition. In the process of grayscale partitioning of the corresponding watch, defects occurred. The grayscale partition of the watch was affected by the lighting conditions, resulting in a decrease in the abnormal index.
[0048] It should be noted that when the area of the corresponding watch grayscale partition is similar to the area of the target watch grayscale partition, the abnormality index of the corresponding watch grayscale partition will be relatively high like the target watch grayscale partition. When the area of the corresponding watch grayscale partition is similar to the area of the target watch grayscale partition, it means that the target watch grayscale partition is stable under changing light conditions. The target watch grayscale partition is more likely to be defective, and the watch position corresponding to the target watch grayscale partition and the watch position corresponding to the corresponding watch grayscale partition are more obvious. If the abnormality index of the target watch grayscale partition is close to that of the corresponding watch grayscale partition at the same time, it means that the abnormality index similarity feature is met when the defective area is obvious.
[0049] Specifically, the calculation method of the stable abnormal trend of the grayscale partition of the target watch is: In the formula, The stable abnormal trend of the grayscale partition of the target watch; The number of watch grayscale partitions corresponding to the target watch grayscale partition; The grayscale partition of the target watch The difference is obtained by subtracting the area of the target watch grayscale partition from the area of the corresponding watch grayscale partition; is the abnormal index of the grayscale partition of the target watch; The grayscale partition of the target watch The abnormality index corresponding to the grayscale partition of the watch; is the weight normalization function, and the normalized object is the grayscale partition of all corresponding watches of the target watch grayscale partition. ; is the absolute value function; is an exponential function with a natural constant as its base.
[0050] In the formula, The grayscale partition of the target watch The abnormal similarity index of the corresponding watch grayscale partition; The grayscale partition of the target watch The area change weights corresponding to the grayscale partitions of the watch; The grayscale partition of the target watch The stable anomaly index of the corresponding watch grayscale partition.
[0051] It should be noted that The larger the value, the smaller the grayscale partition of the target watch. The smaller the area difference between the grayscale partition of the corresponding watch and the grayscale partition of the target watch, the smaller the area difference between the grayscale partition of the target watch and the grayscale partition of the target watch. The structure of the corresponding watch grayscale partition is stable, and the target watch grayscale partition may be a defective watch grayscale partition. The larger the value, the smaller the grayscale partition of the target watch. The closer the abnormality index of the corresponding watch grayscale partition is to the target watch grayscale partition, the more likely the target watch grayscale partition is to be a defective watch grayscale partition.
[0052] It should be noted that the abnormal growth trend of the target watch grayscale partition is used to judge the situation that the target watch grayscale partition is consistent with the defective watch grayscale partition being blocked by shadows or highlights during the transmission process, while the stable abnormal trend of the target watch grayscale partition is used to judge the situation that the target watch grayscale partition is consistent with the defective watch grayscale partition being not blocked by shadows or highlights during the transmission process. When the abnormal growth trend and the stable abnormal trend of the target watch grayscale partition are relatively large, and the abnormal index of the target watch grayscale partition itself is relatively large, it indicates that there is a defect in the target watch grayscale partition.
[0053] It needs to be further explained that, however, since the grayscale partition of the defective watch may be always obvious, that is, the grayscale partition of the defective watch may not be affected by light, the grayscale partition of the defective watch may be always obvious, and the area of the corresponding watch grayscale partition of the defective watch grayscale partition has not changed much, resulting in a relatively low abnormal growth trend of the grayscale partition of the defective watch. Therefore, the area change variance of the target watch grayscale partition corresponding to the target watch grayscale partition during the transmission process is used to adjust the abnormality degree. The larger the area change variance, the greater the area change of the target watch grayscale partition during the transmission process. The grayscale partition of the target watch is affected by light during the transmission process, and the abnormal growth trend of the target watch grayscale partition needs to be considered.
[0054] Specifically, the calculation method of the abnormality degree of the grayscale partition of the target watch is: In the formula, The abnormality degree of the grayscale partition of the target watch; is the abnormal index of the grayscale partition of the target watch; The variance of the difference between the area of all corresponding watch grayscale partitions of the target watch grayscale partition and the area of the target watch grayscale partition; Abnormal growth trend of grayscale partition for target watch; The stable abnormal trend of the grayscale partition of the target watch; is a linear normalization function, and the normalization object is the variance of the area difference between all corresponding watch grayscale partitions of each watch grayscale partition and the target watch grayscale partition.
[0055] Step S005: Obtain the case defect inspection result of the target watch according to the abnormality degree of all watch grayscale partitions of all watch images of the target watch.
[0056] It should be noted that if there are watch grayscale partitions with a high degree of abnormality in the watch image of the target watch, it means that the case of the target watch may have defects.
[0057] Specifically, if there is a watch grayscale partition in the watch image of the target watch with an abnormality level greater than a preset abnormality threshold, it means that there is a defect on the case of the target watch, and the target watch is sorted; wherein, the preset abnormality threshold is 0.7, and this embodiment is described using this as an example; all watches are inspected for watch case defects and sorted according to the above method.
[0058] This embodiment adopts Model to present inverse proportional relationship and normalization, As the input of the model, the implementer can set the inverse proportional function and normalization function according to the actual situation.
[0059] Another embodiment of the present invention provides a watch case defect inspection system based on visual assistance, which includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, the above method steps S001 to S005 are implemented.
[0060] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A watch case defect inspection method based on visual assistance, characterized in that: The method comprises the following steps: Obtain several watch images for each watch; Obtain a target watch and a target watch image, and obtain a comparison possibility between the target watch image and each watch image of each watch and several comparison images of the target watch image based on a similarity relationship between the watch images of other watches except the target watch and the positions of corner points in the target watch image; Obtain several watch grayscale partitions in each watch image of each watch; obtain the probability of each watch grayscale partition in the target watch image and each watch grayscale partition in the comparison image of the target watch image being in the same area according to the relative position relationship between the watch grayscale partitions in the watch image; obtain the abnormality index of each watch grayscale partition of the target watch image in combination with the comparison probability; Obtain a target watch grayscale partition and several corresponding watch grayscale partitions; obtain a growth abnormality trend and a stable abnormality trend of the target watch grayscale partition according to the relationship between the area and the abnormality index of the target watch grayscale partition and its corresponding watch grayscale partition; obtain the abnormality degree of the target watch grayscale partition according to the growth abnormality trend, stable abnormality trend and abnormality index of the target watch grayscale partition, combined with the area of the target watch grayscale partition and its corresponding watch grayscale partition; According to the abnormality degree of all watch grayscale partitions of all watch images of the target watch, the case defect inspection result of the target watch is obtained.
2. The visually assisted watch case defect inspection method according to claim 1, characterized in that: The method of acquiring the target watch and the target watch image, and obtaining the possibility of comparing the target watch image with each watch image of each watch and several comparison images of the target watch image according to the similarity relationship between the watch images of other watches except the target watch and the positions of the corner points in the target watch image, includes the following specific methods: Perform corner point detection processing on any watch image to obtain several corner points in the watch image; In each watch image, the same rectangular coordinate system is established with the direction of movement of the watch in the watch image as the horizontal coordinate, and the origin of the coordinate system is the starting point of the direction of movement of the watch; The watch with case defects to be inspected is recorded as the target watch; Record any watch image of the target watch as the target watch image; Target watch image and The first watch The comparison probability of the watch images is calculated as: In the formula, For the target watch image and The first watch Possibility of comparing images of watches; is the number of corner points in the target watch image; For the The first watch The number of corner points in the watch image; The target watch image Corner point and The first watch Watch image The absolute value of the difference in ordinate between the corner points; The target watch image Corner point and The first watch Watch image The Euclidean distance between the coordinate positions of the corner points; is an exponential function with a natural constant as base; is a linear normalization function; For any watch other than the target watch, the watch image that has the highest probability of being compared with the target watch image among all the watch images of the watch is recorded as the comparison image of the target watch image.
3. The visually assisted watch case defect inspection method according to claim 1, characterized in that: The specific method of obtaining a plurality of watch grayscale partitions in each watch image of each watch includes: The pixels in any watch image are clustered by DBSCAN according to their grayscale values, and the connected domain formed by the pixels belonging to the same cluster is recorded as a watch grayscale partition in the watch image.
4. The visually assisted watch case defect inspection method according to claim 1, characterized in that: The specific method of obtaining the probability of each watch grayscale partition in the target watch image and each watch grayscale partition in the reference image of the target watch image being in the same area according to the relative position relationship between the watch grayscale partitions in the watch image is as follows: The target watch image The grayscale partition of the watch and the target watch image The first The calculation method of the same area probability of the grayscale partition of each watch is: In the formula, is the first The grayscale partition of the watch and the target watch image The first The probability of the same area of the grayscale partition of each watch; is the number of watch grayscale partitions in the target watch image; The target watch image The number of grayscale partitions of the watch in the control image; is the first The centroid of the grayscale partition of the watch to the The vector of the centroid of the grayscale partitions of each watch; The target watch image The first The centroid of the grayscale partition of the watch to the The vector of the centroid of the grayscale partitions of each watch; is the first The average grayscale of each grayscale partition of the watch; The target watch image The first The average grayscale of each grayscale partition of the watch; is an exponential function with a natural constant as base; is the weight normalization function; is the absolute value function.
5. The visually assisted watch case defect inspection method according to claim 1, characterized in that: The specific method of obtaining the abnormal index of each watch grayscale partition of the target watch image includes: In the formula, The target watch image Abnormal index of grayscale partition of each watch; is the number of comparison images of the target watch image; The target watch image and its The comparison probability of the comparison images; is the first The grayscale partition of the watch and the target watch image The maximum value of the same region probability of all the watch grayscale partitions in the comparison image; is a linear normalization function; is an exponential function with a natural constant as its base.
6. The visually assisted watch case defect inspection method according to claim 1, characterized in that: The specific method of obtaining the target watch grayscale partition and several corresponding watch grayscale partitions includes: Record any watch grayscale partition in the target watch image as the target watch grayscale partition; Perform SIFT corner point matching on the target watch image and any other watch image of the target watch except the target watch image, obtain the distance between any corner point in the target watch image and the matching corner point of the corner point in the watch image, and record it as the matching distance of the corner point; record the mode of the matching distances of all corner points in the target watch image as the displacement distance from the target watch image to the watch image; Obtain the coordinates of the centroid of the target watch grayscale partition, and record the sum of the abscissa of the centroid of the target watch grayscale partition and the displacement distance from the target watch image to the watch image as the corresponding abscissa of the centroid of the target watch grayscale partition in the watch image; The ordinate of the centroid of the target watch grayscale partition is recorded as the ordinate of the corresponding centroid of the target watch grayscale partition in the watch image; The watch grayscale partition where the pixel point corresponding to the horizontal coordinate of the center of mass and the vertical coordinate of the center of mass of the target watch grayscale partition in the watch image is located is recorded as a corresponding watch grayscale partition of the target watch grayscale partition.
7. The visually assisted watch case defect inspection method according to claim 1, characterized in that: The specific method for obtaining the abnormal growth trend is as follows: For any corresponding watch grayscale partition of the target watch grayscale partition, the maximum value between the difference between the abnormal index of the target watch grayscale partition and the abnormal index of the corresponding watch grayscale partition and 0 is recorded as the abnormal reduction degree of the corresponding watch grayscale partition; The weight normalization result of the maximum value between the difference obtained by subtracting the area of the target watch grayscale partition from the area of the corresponding watch grayscale partition and 0 is recorded as the area increase weight of the corresponding watch grayscale partition; The product of the abnormal reduction degree of the corresponding watch grayscale partition and the area increase weight is recorded as the growth abnormality index of the corresponding watch grayscale partition; The sum of the growth anomaly indexes of all corresponding watch grayscale partitions of the target watch grayscale partition is recorded as the growth anomaly trend of the target watch grayscale partition.
8. The visually assisted watch case defect inspection method according to claim 1, characterized in that: The specific method for obtaining the stable abnormal trend is as follows: For any corresponding watch grayscale partition of the target watch grayscale partition, the inverse proportional normalization result of the absolute value of the difference between the abnormal index of the target watch grayscale partition and the abnormal index of the corresponding watch grayscale partition is recorded as the abnormal similarity index of the corresponding watch grayscale partition; The weight normalization result of the inverse proportion normalization of the absolute value of the area difference between the corresponding watch grayscale partition and the target watch grayscale partition is recorded as the area change weight of the corresponding watch grayscale partition; The product of the abnormal similarity index of the corresponding watch grayscale partition and the area change weight is recorded as the stable abnormal index of the corresponding watch grayscale partition; The sum of the stability anomaly indexes of all corresponding watch grayscale partitions of the target watch grayscale partition is recorded as the stability anomaly trend of the target watch grayscale partition.
9. The visually assisted watch case defect inspection method according to claim 1, characterized in that: The specific method of obtaining the abnormal degree of the target watch grayscale partition according to the abnormal growth trend, stable abnormal trend and abnormal index of the target watch grayscale partition and combining the target watch grayscale partition with the area of its corresponding watch grayscale partition is as follows: In the formula, is the abnormality degree of the grayscale partition of the target watch; is the abnormal index of the grayscale partition of the target watch; The variance of the difference between the area of all corresponding watch grayscale partitions of the target watch grayscale partition and the area of the target watch grayscale partition; Abnormal growth trend of grayscale partition for target watch; The stable abnormal trend of the grayscale partition of the target watch; is a linear normalization function.
10. A watch case defect inspection system based on visual assistance, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the steps of the visually assisted watch case defect inspection method as described in any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Industrial product anomaly detection method, system and device and storage medium
CN114066811A
Intelligent detection method for smudginess of carbon electrode under vision assistance
CN116758071A
Underground comprehensive safety monitoring system based on illumination control system
CN116844116A
Chain wear detection method based on image features
CN117788459A
Wireless communication device and wireless communication system
WO2015182752A1
Cited By
Image data acquisition method and system for lens plastic part
CN120525734A