Image detection device and image detection method for object to be detected

By calculating and correcting the inclination angle and rotation offset of the image, image block comparison is solved, and the detection efficiency and accuracy are improved.

CN119223970APending Publication Date: 2024-12-31KINPO ELECTRONICS LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310794707.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-30
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

Existing image detection technology consumes a lot of computing resources when detecting large amounts of physical objects, and cannot provide satisfactory performance, resulting in inefficiency.

Method used

Through the image acquisition module and processor configuration, the image of the object to be detected is obtained, its tilt angle and rotation offset is calculated, the image block is corrected, and the image is stored in the sampled image file array, and the inference value is calculated with the standard image file array to evaluate The mass of the object to be tested.

Benefits of technology

This reduces the problem of misjudgment of image block feature comparison, improves the efficiency of image detection, and reduces the consumption of computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119223970A_ABST
    Figure CN119223970A_ABST
Patent Text Reader

Abstract

The invention provides an image detection device and an image detection method for an object to be detected. The detection device is configured to obtain a plurality of sampling object images from the image of the object to be detected; storing the plurality of sampling object images to a sampling image file array; respectively comparing the plurality of sampling object images with the plurality of standard object images according to the array index so as to calculate an inference value of each sampling object image; and evaluating the quality of the object to be detected according to the inference values of the plurality of sampling object images. Therefore, the efficiency of image detection can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a detection device and a detection method, and more particularly to a detection device and a detection method which can effectively compare images of an object to be detected and quickly determine the quality status of a physical object. Background Art

[0002] In the technical field of quality monitoring, image processing technology is often used to analyze the image features of the object to be tested in the image. Since the image features of the object to be tested are related to the physical object, analyzing the image features of the object to be tested can be used to determine the quality status of the physical object.

[0003] In the prior art, image detection devices need to analyze the image features of the entire image of the object to be detected in order to evaluate the quality of the physical object, which consumes considerable computing resources. In an environment where a large number of physical objects need to be detected, the current image detection technology cannot provide satisfactory performance.

[0004] Accordingly, the problem of consuming computing resources in image detection technology still needs to be solved. Summary of the invention

[0005] The main purpose of the present invention is to provide an image detection device and an image detection method for an object to be detected, so as to effectively compare the image of the object to be detected and quickly determine the quality status of the physical object.

[0006] According to one embodiment of the present invention, an image detection device is provided, comprising an image acquisition module, a storage medium and a processor. The image acquisition module is configured to obtain an image of an object to be detected. The storage medium is configured to store a standard image file array, which includes a plurality of standard object images. The processor is coupled to the image acquisition module and the storage medium and is configured to: obtain a plurality of sampled object images from the image of the object to be detected; store the plurality of sampled object images in a sampled image file array, wherein the sampled image file array and the standard image file array have the same array index; compare the plurality of sampled object images in the sampled image file array and the plurality of standard object images in the standard image file array according to the array index, so as to calculate an inference value of each sampled object image; and evaluate the quality of the object to be detected according to the inference values ​​of the plurality of sampled object images.

[0007] According to an embodiment of the present invention, the storage medium is configured to store a standard tilt angle; before the processor is configured to obtain the plurality of sampled object images using the image of the object to be detected, the process includes:

[0008] Calculating a tilt angle of the image of the object to be detected; and

[0009] The rotation offset of the image of the object to be detected is calculated according to a difference between the tilt angle and the standard tilt angle.

[0010] According to an embodiment of the present invention, the operations before the processor is configured to store the plurality of sampled object images in the sampled image array include:

[0011] Correcting the offsets of the plurality of sampled object images respectively according to the rotation offset; and

[0012] The calibrated sampled object images are stored in the sampled image array.

[0013] According to an embodiment of the present invention, the operation after the processor is configured to calculate the rotation offset of the image of the object to be detected includes:

[0014] Correcting the offset of the image of the object to be detected according to the rotation offset; and

[0015] A plurality of sampled object images are obtained from the corrected image of the object to be detected.

[0016] According to an embodiment of the present invention, the processor is configured to calculate the inference value of each sampled object image by:

[0017] The plurality of sampled object images after correction in the sampled image array and the plurality of standard object images in the standard image array are respectively compared according to the array index to calculate the inference value of each of the sampled object images.

[0018] According to an embodiment of the present invention, the operation in which the processor is configured to calculate the tilt angle of the image of the object to be detected includes:

[0019] Performing a binarization operation on the image of the object to be detected to obtain a first binarized image;

[0020] Detecting a plurality of first object contours in the first binary image and respectively calculating a plurality of first center coordinates of the plurality of first object contours; and

[0021] The tilt angle of the image of the object to be detected relative to a horizontal reference is calculated according to at least two coordinates of the plurality of first center coordinates and an origin coordinate.

[0022] According to an embodiment of the present invention, before the operation of obtaining the plurality of sampled object images in the to-be-detected object image using the plurality of first minimum circumscribed rectangles, the processor is configured to:

[0023] Calculating a plurality of first minimum circumscribed rectangles respectively according to the plurality of first object contours; and

[0024] In the to-be-detected object image, the plurality of first minimum circumscribed rectangles are used to obtain the plurality of sampled object images.

[0025] According to an embodiment of the present invention, before the storage medium is configured to store the standard image array, the processor is configured to:

[0026] Performing a binarization operation on a standard image to obtain a second binarized image, wherein the standard image includes a standard tilt angle;

[0027] detecting a plurality of second object contours in the second binary image;

[0028] Calculating a plurality of second minimum circumscribed rectangles respectively according to the plurality of second object contours; and

[0029] In the standard image, the plurality of second minimum circumscribed rectangles are respectively used to obtain the plurality of standard object images.

[0030] According to an embodiment of the present invention, the operation after the processor is configured to detect the plurality of second object contours in the second binary image includes:

[0031] respectively calculating a plurality of second center coordinates of the plurality of second object contours; and

[0032] The standard inclination angle of the standard image relative to a horizontal reference is calculated according to at least two of the plurality of second center coordinates and an origin coordinate.

[0033] According to one embodiment of the present invention, a method for image detection of an object to be detected is disclosed, comprising: obtaining a plurality of sampled object images from the image of the object to be detected; respectively correcting the offset of the plurality of sampled object images according to a rotation offset; storing the plurality of sampled object images in a sampled image array, wherein the sampled image array and a standard image array have the same array index, and the standard image array includes a plurality of standard object images; respectively comparing the plurality of sampled object images in the sampled image array and the plurality of standard object images in the standard image array according to the array index to calculate an inference value of each sampled object image; and evaluating the quality of the object to be detected according to the inference values ​​of the plurality of sampled object images.

[0034] According to an embodiment of the present invention, the steps before obtaining a plurality of sampled object images from the image of the object to be detected include:

[0035] Calculating a tilt angle of the image of the object to be detected; and

[0036] The rotation offset of the image of the object to be detected is calculated according to a difference between the tilt angle and a standard tilt angle.

[0037] According to an embodiment of the present invention, the steps before storing the plurality of sampled object images in the sampled image array include:

[0038] Correcting the offsets of the plurality of sampled object images respectively according to the rotation offset; and

[0039] The calibrated sampled object images are stored in the sampled image array.

[0040] According to an embodiment of the present invention, the steps after calculating the rotation offset of the image of the object to be detected include:

[0041] Correcting the image of the object to be detected according to the rotation offset; and

[0042] A plurality of sampled object images are obtained from the corrected image of the object to be detected.

[0043] According to an embodiment of the present invention, the step of calculating the inference value of each of the sampled object images comprises:

[0044] The plurality of sampled object images after correction in the sampled image array and the plurality of standard object images in the standard image array are respectively compared according to the array index to calculate the inference value of each of the sampled object images.

[0045] According to an embodiment of the present invention, the step of calculating the tilt angle of the image of the object to be detected further comprises:

[0046] Performing a binarization operation on the image of the object to be detected to obtain a first binarized image;

[0047] Detecting a plurality of first object contours in the first binary image and respectively calculating a plurality of first center coordinates of the plurality of first object contours; and

[0048] The tilt angle of the image of the object to be detected relative to a horizontal reference is calculated according to at least two coordinates of the plurality of first center coordinates and an origin coordinate.

[0049] According to an embodiment of the present invention, before the step of using the plurality of first minimum circumscribed rectangles to obtain the plurality of sampled object images in the image of the object to be detected includes:

[0050] The plurality of first minimum circumscribed rectangles are respectively calculated according to the plurality of first object contours.

[0051] According to one embodiment of the present invention, it further includes:

[0052] Performing a binarization operation on a standard image to obtain a second binarized image;

[0053] detecting a plurality of second object contours in the second binary image;

[0054] Calculating a plurality of second minimum circumscribed rectangles respectively according to the plurality of second object contours; and

[0055] In the standard image, the plurality of second minimum circumscribed rectangles are respectively used to obtain the plurality of standard object images.

[0056] According to one embodiment of the present invention, it further includes:

[0057] respectively calculating a plurality of second center coordinates of the plurality of second object contours; and

[0058] The standard inclination angle of the standard image relative to a horizontal reference is calculated according to at least two coordinates of the plurality of second center coordinates and an origin coordinate.

[0059] The present invention can reduce the problem of misjudgment when comparing image features of image blocks, and can also improve the efficiency of image detection as a whole.

[0060] In order to further understand the techniques, means and effects adopted by the present invention to achieve the predetermined objectives, please refer to the following detailed description and drawings of the present invention. It is believed that the objectives, features and characteristics of the present invention can be deeply and specifically understood thereby. However, the drawings are only provided for reference and illustration and are not intended to limit the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 A schematic diagram of an image of an object to be detected obtained by photographing a physical object with a camera;

[0062] Figure 2 is a block diagram of an image detection device according to an embodiment of the present invention;

[0063] Figure 3 is a flow chart of an image detection method according to an embodiment of the present invention;

[0064] Figure 4 is a schematic diagram of an image of an object to be detected according to an embodiment of the present invention;

[0065] Figure 5 is a schematic diagram of a binary image of an image of an object to be detected according to an embodiment of the present invention;

[0066] Figure 6 is a schematic diagram of the tilt angle of an image of an object to be detected according to an embodiment of the present invention;

[0067] Figure 7 A schematic diagram of a minimum circumscribed rectangle corresponding to the outline of each object on an image of an object to be detected according to an embodiment of the present invention;

[0068] Figure 8 is a schematic diagram of a sampling pattern array according to an embodiment of the present invention;

[0069] Fig. 9 A flow chart of establishing a standard image array according to an embodiment of the present invention;

[0070] Fig.10 is a schematic diagram of a standard image drawn according to an embodiment of the present invention;

[0071] Fig.11 is a schematic diagram of a binarized image of a standard image according to an embodiment of the present invention;

[0072] Fig.12 is a schematic diagram of a standard image array according to an embodiment of the present invention;

[0073] Wherein, the reference numerals are:

[0074] 100: Image of the object to be detected

[0075] 102, 104, 106: dotted frame

[0076] 112, 114, 116: Image blocks

[0077] 200: Image detection device

[0078] 210: Image acquisition module

[0079] 220: Processor

[0080] 230: Storage Media

[0081] 241: Sampling image array

[0082] 243: Multiple sampled object images

[0083] 245: Multiple first center coordinates

[0084] 251: Standard drawing array

[0085] 253: Multiple standard object images

[0086] 255: Multiple second center coordinates

[0087] 400: Image of the object to be detected

[0088] 500: Binarized image

[0089] 502, 504, 506, 508: Object outline

[0090] 702, 704, 706: Minimum enclosing rectangle

[0091] 802, 804, 806: Sampling object image

[0092] 1000: Standard image

[0093] 1002, 1004, 1006: Minimum enclosing rectangle

[0094] 1110: Binarized image

[0095] 1102, 1104, 1106: Object outline

[0096] 1202, 1204, 1206: Standard object images

[0097] S310~S370, S910~S980: Steps

[0098] L1, L2, L3: Straight line

[0099] θ1: Tilt angle

[0100] θ2: standard inclination

[0101] α: angle. DETAILED DESCRIPTION

[0102] The present invention is further described below in conjunction with drawings and embodiments so that relevant persons in the technical field to which the present invention belongs can better understand the present invention and implement it accordingly, but the embodiments are not intended to limit the present invention.

[0103] As used herein, terms such as "first" and "second" describe various elements, components, regions, layers and / or portions, which should not be limited by these terms. These terms may only be used to distinguish one element, component, region, layer or portion from another. Unless the context clearly indicates, terms such as "first" and "second" as used herein do not imply a sequence or order.

[0104] To facilitate understanding of the present invention, the technical terms "object to be tested" or "physical object" herein are exemplified by an electronic computer including hardware components. Similarly, the image associated with the "object to be tested" is exemplified by an image of an electronic computer. However, the present invention is not limited to the state of the "object to be tested" or "physical object", and any object that can be applied to image detection falls within the scope of the present invention.

[0105] To detect whether the keys of a computer have defects, the image detection device first converts the image of the computer into a black and white image, and then detects all possible outlines of the keys in the binary image. When the computer is tilted, the image detection device is limited to cutting with a rectangle and cannot rotate the rectangle freely when cutting the image block of the key in the image. As a result, the image detection device cannot obtain the complete outer frame of the key by beveling the rectangle when cutting the image block of the key in the image.

[0106] Please refer to Figure 1 , which is a schematic diagram of an image of an object to be detected obtained by a camera shooting a physical object. The content of the image of the object to be detected 100 is an electronic computer, and its placement angle is rotated to the left and presents a tilted state. The electronic computer includes a plurality of keys, such as an 'OFF' key, a '7' key, an '8' key, and a '9' key. Each key of the electronic computer has a key frame, and the image detection device locates the position of each key by detecting the key frame.

[0107] After the image detection device detects the positions of all the keys, it uses a rectangular frame to select the image blocks of the keys. For example, the rectangular frame is Figure 1 The dashed boxes 102, 104 and 106 are shown. The image detection device performs image segmentation on the image 100 of the object to be detected according to the coordinate positions of the dashed boxes 102, 104 and 106 to obtain image blocks 112, 114 and 116.

[0108] As described above, when the computer is tilted, the image detection device cannot obtain the complete outer frame of the key. Figure 1 The image block 112 is key '7', but in the image block 112, the outer frame of key '7' is incomplete, and other keys also have similar problems. If the image detection device cuts out an image block with an incomplete outer frame of a key, when the image block is subsequently detected, an incorrect comparison will occur in the process of determining the content of the image block due to incomplete frame lines, crooked fonts or other similar factors, resulting in a misjudgment of the quality status of the object to be detected.

[0109] Please refer to Figure 2 , which is a block diagram of an image detection device according to an embodiment of the present invention. The image detection device 200 includes an image acquisition module 210, a processor 220 and a storage medium 230. The processor 220 is coupled to the image acquisition module 210 and the storage medium 230.

[0110] In one embodiment, the image acquisition device 110 is configured to face a platform (not shown) and acquire an image of the object to be detected placed on the platform.

[0111] In one embodiment, the storage medium 230 is configured to store a sampled image array 241 and a standard image array 251. The sampled image array 232 includes a plurality of sampled object images 243 and a plurality of first center coordinates 245. The standard image array 251 includes a plurality of standard object images 253 and a plurality of second center coordinates 255. The operation of generating the sampled image array 241 and the standard image array 251 will be described below.

[0112] The image acquisition module 210 is, for example, a module including an image sensor and an image processing circuit.

[0113] The processor 220 can be, but is not limited to, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a central processing unit (CPU), a system on chip (SoC), a field programmable gate array (FPGA), a network processor chip, or a combination of the above components.

[0114] The storage medium 230 may be, but is not limited to, a random access memory (RAM), a flash memory (Flash memory), a read only memory (ROM), a hard disk drive (HDD), a solid state drive (SSD), an optical storage device, or a combination of the above elements.

[0115] In one embodiment, the image detection device 200 is used to obtain multiple sampled object images 243 from the image of the object to be detected and store the multiple sampled object images 243 in the sampled image array 241. Since the sampled image array 241 and the standard image array 251 have the same array index, the image detection device 200 samples the multiple sampled object images 243 in the image array 241 and the standard object images 253 in the standard image array 251 according to the array index to calculate the inference value of each sampled object image. After comprehensively analyzing the inference values ​​of all the sampled object images, the image detection device 200 will obtain the analysis result of the quality of the object to be detected. The detailed steps of the image detection method are described as follows.

[0116] Please refer to Figure 3 , which is a flow chart of an image detection method according to an embodiment of the present invention. The image detection method can be Figure 2 The image detection device 200 is executed.

[0117] In step S310 , the processor 220 calculates a tilt angle of the image of the object to be detected.

[0118] In step S320 , the processor 220 calculates the rotation offset of the image of the object to be detected according to the tilt angle and the standard tilt angle.

[0119] In step S330 , the processor 220 uses a plurality of minimum bounding rectangles in the to-be-detected object image to obtain a plurality of sampled object images.

[0120] In step S340 , the processor 220 corrects the offsets of the plurality of sampled object images respectively according to the rotation offsets.

[0121] In step S350 , the processor 220 stores the corrected plurality of sampled object images into a sampled image array.

[0122] In step S360 , the processor 220 compares the calibrated plurality of sampled object images and the plurality of standard object images respectively according to the array index of the sampled image array to calculate an inference score of each sampled object image.

[0123] In step S370 , the processor 220 evaluates the quality of the object to be detected according to the inference values ​​of the plurality of sampled object images.

[0124] In the embodiment of step S310, the image acquisition device 110 acquires an image of the object to be detected. Figure 4 , which is a schematic diagram of an image of an object to be detected according to an embodiment of the present invention. The content of the image of the object to be detected 400 is an electronic calculator having a plurality of buttons, and each button has a button frame. In this embodiment, the electronic calculator in the image of the object to be detected 400 is in a tilted state (relative to the shooting angle of the image acquisition module 210).

[0125] In the embodiment of step S320, the processor 220 calculates the tilt angle of the image of the object to be detected 400. The manner in which the processor 220 calculates the tilt angle of the image of the object to be detected 400 is described as follows.

[0126] In one embodiment, the processor 220 performs a binarization operation on the image 400 of the object to be detected to obtain a first binarized image.

[0127] In one embodiment, the binarization operation performed by the processor 320 can be a binarization operation (THRESH_BINARY), an inverse binarization operation (THRESH_BINARY_INV), a truncation operation (THRESH_TRUNC), a zeroing operation (THRESH_TOZERO) or an inverse zeroing operation (THRESH_TOZERO_INV) of OPENCV (Open Source Computer Vision Library), so that the image of the object to be detected is processed by the processor 320 to generate a binary image (or black and white image) accordingly.

[0128] Please refer to Figure 5, which is a schematic diagram of a binary image of an image of an object to be detected according to an embodiment of the present invention.

[0129] The first binary image 500 is a black and white image. Since the first binary image 500 has been processed, the image features present a high contrast, and the processor 220 can easily capture the outline of the key (eg, the object outlines 502, 504, 506, and 508 of the white image block) according to the image features.

[0130] In one embodiment, the processor 220 detects the first object contour 502 in the first binary image 500 and calculates the first center coordinates of the first object contour 502. Similarly, the processor 220 detects the first object contours 504, 506, and 508 in the first binary image 500 and respectively calculates the first center coordinates of the first object contours 504, 506, and 508. In other words, the processor 220 calculates the center coordinates of each object contour.

[0131] It is worth mentioning that the processor 220 can execute existing tools to obtain the center coordinates of the object contours 502 , 504 , 506 , and 508 , and the present invention does not limit the operation of the processor 220 to obtain the center coordinates.

[0132] In one embodiment, the processor 220 calculates the tilt angle of the image of the object to be detected relative to the horizontal reference according to at least two coordinates of the plurality of first center coordinates and the origin coordinates. For example, the difference between the y coordinate values ​​of the two coordinates is the smallest, that is, the two coordinates are located on the same straight line. Figure 5 As shown, the difference between the y coordinates of the center coordinates of the object contour 502 and the object contour 504 is smaller than the difference between the y coordinates of the center coordinates of the object contour 502 and the object contour 508. Therefore, when calculating the tilt angle, the processor 220 can take the center coordinates of the object contour 502 and the object contour 504 to calculate a straight line that can represent the tilt degree of the image 400 of the object to be detected.

[0133] In one embodiment, the origin coordinates may be the image origin coordinates at the upper left corner of the image 400 of the object to be detected, which are used as reference points for calculating the tilt degree of the image 400 to be detected.

[0134] Please refer to Figure 6 , which is a schematic diagram of the tilt angle of the image of the object to be detected according to an embodiment of the present invention.

[0135] According to the above embodiment, the straight line calculated by the processor 220 to represent the tilt of the image 400 of the object to be detected is parallel to the straight line L1. For ease of reading, the following description uses the straight line L1 to represent the tilt of the image 400 of the object to be detected.

[0136] like Figure 6 As shown, the straight line L2 is the horizontal reference. The processor 220 calculates the inclination angle of the image 400 of the object to be detected based on the straight line L1 and the straight line L2. The processor 220 further calculates the difference between the inclination angle and the standard inclination angle to obtain the angle. The angle is the rotational offset of the image 400 of the object to be detected relative to the standard inclination angle. It is worth mentioning that the standard inclination angle (i.e., the angle between the straight line L2 and the straight line L3) is the angle pre-set by the processor 220 according to the standard image, which will be described later.

[0137] In the embodiment of step S330, the processor 220 performs a first binarized image 500 ( Figure 5 ) to obtain the minimum bounding rectangle that can enclose each first object contour. Each minimum bounding rectangle is further used to cut out an image block corresponding to the object contour on the to-be-detected object image 400, thereby obtaining a sampled object image 243.

[0138] Please refer to Figure 7 , which is a schematic diagram of the minimum circumscribed rectangle corresponding to each object contour on the image of the object to be detected according to an embodiment of the present invention.

[0139] In one embodiment, the minimum bounding rectangle 702 may enclose the object outline 502 ( Figure 5 ); the minimum bounding rectangle 704 can enclose the object outline 504 ( Figure 5 ), and the minimum bounding rectangle 706 can enclose the object outline 506 ( Figure 5 ).

[0140] In one embodiment, the processor 220 uses the minimum bounding rectangle 702 to cut out a sampled object image (e.g., the image block of key '7') from the image of the object to be detected 400. Similarly, the processor 220 uses the minimum bounding rectangle 704 to cut out a sampled object image (e.g., the image block of key '8') from the image of the object to be detected 400; the processor 220 uses the minimum bounding rectangle 706 to cut out a sampled object image (e.g., the image block of key '9') from the image of the object to be detected 400.

[0141] It is worth mentioning that if some pixel values ​​of the key frame of the object to be detected image 400 are close to the binarization threshold value, in some cases, the features of the key frame will become background pixels after the binary image processing (for example, the key frame should be a white pixel in the binary image but is calculated as a black pixel). Therefore, the minimum bounding rectangle obtained from the binary image processing can surround the object outline of the binary image 500, but may not necessarily surround the key frame of the object to be detected image 400.

[0142] In the embodiment of step S340 , the processor 220 uses the rotation offset, ie, the angle, to perform angle offset correction on the obtained multiple sample object images.

[0143] For example, please refer to Figure 6 , with the straight line L2 as the reference, the tilt angle of the image 400 of the object to be detected is more than the standard tilt angle in the counterclockwise direction. Therefore, the processor 220 uses the aforementioned central coordinates as the reference to rotate the sampled object image in the clockwise direction to correct the rotation offset of the sampled object image so that the tilt angle of the sampled object image is consistent with the standard tilt angle. It is worth mentioning that each sampled object image has a corresponding central coordinate, so the processor 220 performs rotation correction for each sampled object image.

[0144] In the embodiment of step S350 , the processor 220 stores the calibrated sampled object image and the first center coordinates obtained above into the sampled image array.

[0145] Please refer to Figure 8 , which is a schematic diagram of a sampling pattern array according to an embodiment of the present invention.

[0146] The sampled image array 241 includes the aforementioned calibrated sampled object images 802, 804 and 806. Figure 7 The image area framed by the minimum bounding rectangle shown in the figure shows that the object contents of the corrected sampled object images 802, 804 and 806 are less skewed. For example, the number '7' in the corrected sampled object image 802 is less skewed. Figure 7 The number '7' of the image block framed by the minimum bounding rectangle 702 is correct (ie the tilt angle is adjusted to a counterclockwise offset angle relative to the horizontal reference).

[0147] It is worth mentioning that each column of the sample image array 241 records the center coordinates ( Figure 8 Not shown) and the sampled object image obtained from the to-be-detected object image 400, the center coordinates can also be used to represent the coordinates of the sampled object image.

[0148] In the embodiment of step S360, the processor 220 can read each entry in the sampled image array and the standard image array respectively. Since the standard image array is a comparison basis established in advance by analyzing the standard image (to be described in detail later), the inference value of each sampled object image can be calculated by comparing the similarity of the image features of the sampled object image and the standard object image after correction. This inference value represents whether the sampled object image is similar to the standard object image.

[0149] In the embodiment of step S370, the processor 220 can calculate the average value, standard deviation or similar statistical value of all inference values ​​to evaluate the quality of the object to be detected. For example, if the average value of the inference value is lower than the threshold value, it means that there are defects on the surface of the object to be detected as a whole, so the quality of the object to be detected is not good.

[0150] In another embodiment, after calculating the rotation offset of the image of the object to be detected 400 (step S320) and before obtaining a plurality of sampled object images 243 (step S330), the processor 220 corrects the image of the object to be detected 400 according to the rotation offset and obtains a plurality of sampled object images 243 from the corrected image of the object to be detected 400. In this embodiment, the processor 220 does not execute step S340, and executes steps S350, S360, and S370. In other words, the processor 220 first rotates and corrects the angle of the entire image of the object to be detected 400 before segmenting the image blocks.

[0151] For further instructions on how to create a standard drawing array, please refer to Fig. 9 . Fig. 9 FIG. 1 is a flow chart of establishing a standard image array according to an embodiment of the present invention. The steps of establishing a standard image array can be as follows: Figure 2 The image detection device 200 is executed.

[0152] In step S910 , the processor 220 obtains a standard image of a standard object.

[0153] In step S920 , the processor 220 performs a binarization operation on the standard image to obtain a second binarized image.

[0154] In step S930 , the processor 220 detects a plurality of second object contours in the second binary image.

[0155] In step S940 , the processor 220 calculates a plurality of second center coordinates of a plurality of second object contours respectively.

[0156] In step S950 , the processor 220 calculates a standard inclination angle of the standard image relative to a horizontal reference according to at least two coordinates of the plurality of second center coordinates and the origin coordinates.

[0157] In step S960 , the processor 220 calculates a plurality of second minimum bounding rectangles according to the plurality of second object contours.

[0158] In step S970 , the processor 220 obtains a plurality of standard object images using a plurality of second minimum bounding rectangles in the standard image.

[0159] In step S980 , the processor 220 stores a plurality of standard object images and a plurality of second center coordinates into a standard image array.

[0160] In the embodiment of step S910, the standard object refers to a physical object with the same appearance, function and model as the object to be tested and without any defects. Therefore, the standard image can be used as a comparison standard.

[0161] Please refer to Fig.10 , which is a schematic diagram of a standard image according to an embodiment of the present invention. The standard object was not placed properly when being photographed (relative to the shooting angle of the image acquisition module 210), so the content of the standard image 1000 is slightly tilted. In this embodiment, the content of the standard image 1000 is rotated counterclockwise relative to the horizontal reference (straight line L2) and offset by an inclination angle (standard inclination angle). In another embodiment, if the standard object is placed properly when being photographed, the angle between the content of the standard image 1000 and the horizontal reference is 0 degrees.

[0162] In the embodiment of step S920, the processor 220 performs a binarization operation on the standard image. Fig.11 , which is a schematic diagram of a binarized image of a standard image according to an embodiment of the present invention. The second binarized image 1100 may be a black and white image.

[0163] In the embodiment of step S930, Fig.11 As shown, since the second binary image 1100 has been processed, the image features present a high contrast, and the processor 220 can easily capture the contours corresponding to the keys (eg, the object contours 1102, 1104, and 1106 of the white image blocks) based on the image features.

[0164] In the embodiment of step S940, the processor 220 detects the second object contour 1102 in the second binary image 1100 and calculates the second center coordinates of the second object contour 1102. Similarly, the processor 220 detects the second object contours 1104 and 1106 in the second binary image 1100 and calculates the second center coordinates of the second object contours 1104 and 1106, respectively.

[0165] In the embodiment of step S950, the processor 220 calculates the standard inclination of the standard image relative to the horizontal reference according to at least two coordinates of the plurality of second center coordinates and the origin coordinates. For example, the difference between the y coordinate values ​​of the two coordinates is the smallest, that is, the keys corresponding to the two coordinates are located on the same column. Fig.11 As shown, the difference between the y coordinates of the center coordinates of object outline 1102 and object outline 1104 is smaller than the difference between the y coordinates of the center coordinates of object outline 1102 and object outline 1108 .

[0166] When calculating the tilt angle, the processor 220 may obtain the center coordinates of the object contour 1102 and the object contour 1104 to calculate a straight line that can represent the tilt degree of the standard image 1000, such as a straight line parallel to the straight line L3 ( Fig.10 Not shown), so the straight line L3 can be used to represent the tilt degree of the standard image 1000.

[0167] In one embodiment, the processor 220 calculates the angle between the straight line L3 and the straight line L2 (horizontal reference). The processor 220 uses the angle as a standard inclination angle for correcting the image of the object to be detected for multiple sampled object images.

[0168] In one embodiment, the origin coordinates may be the image origin coordinates at the upper left corner of the standard image 1000 or the upper left corner coordinates of the display screen (not shown), which serve as reference points for evaluating the tilt degree of the standard image 1000 .

[0169] In the embodiment of step S960, the processor 220 performs the processing of the second binarized image 1100 ( Fig.11 ) to obtain a minimum bounding rectangle that can enclose each second object contour. Each minimum bounding rectangle is further used to cut out an image block corresponding to the object contour on the standard image 1000 to obtain a plurality of standard object images.

[0170] Please refer to Fig.10 , the minimum enclosing rectangle 1002 can enclose the object outline 1102 ( Fig.11 ); the minimum enclosing rectangle 1004 can enclose the object outline 1104 ( Fig.11 ), and the minimum bounding rectangle 1006 can enclose the object outline 1106 ( Fig.11 ).

[0171] In the embodiment of step S970, the processor 220 uses the minimum bounding rectangle 1002 to cut out a standard object image (e.g., the image block of the key '7') from the standard image 1000. Similarly, the processor 220 uses the minimum bounding rectangle 1004 to cut out a standard object image (e.g., the image block of the key '8') from the standard image 1000; the processor 220 uses the minimum bounding rectangle 1006 to cut out a standard object image (e.g., the image block of the key '9') from the standard image 1000.

[0172] In the embodiment of step S980 , the processor 220 converts the acquired standard object image and the plurality of second center coordinates into a standard image array.

[0173] Please refer to Fig.12 , which is a schematic diagram of a standard image array according to an embodiment of the present invention.

[0174] Each column of the standard image array 251 records the center coordinates obtained from the binary image 1100 ( Fig.11 not shown) and from the standard image 1000 ( Fig.10 ) is obtained, so the center coordinates can also be used to represent the coordinates of the standard object image. For example, the object contour 1102 ( Fig.11 ) and the center coordinates of the standard object image 1202 ( Fig.12 ) will be recorded in the same column of the standard image array 251 so that the two are associated. Similarly, the columns of the standard object images 1204 and 1206 also record the corresponding center coordinates.

[0175] Since the columns of the same array index of the sampled image array 241 and the standard image array 251 store the same or similar center coordinates (i.e., the same or similar image positions), the columns of the same array index of the sampled image array 241 and the standard image array 251 correspond to each other. Figure 8 ) of the array index (1,1) (ie, the sample object image 802) is key '7'; the standard image array 250 ( Fig.12 ) is also key '7'. Similarly, the processor 220 maintains the correspondence between each column content of the sampled image array 241 and the standard image array 251 based on the center coordinates of the object contour to ensure the correctness of the inference value of the sampled object image subsequently calculated by the processor 220.

[0176] Please refer to Figure 3 Step 360 and refer to it together Figure 8 and Fig.12 The processor 220 compares the image features of the sampled object image 802 stored in the array index (1,1) of the sampled image array 241 with the image features of the standard object image 1202 stored in the array index (1,1) of the standard image array 251 to obtain the inference value of the sampled object image 802. In other words, the processor 220 detects the image features of each key respectively to evaluate whether the key of the object to be inspected has defects.

[0177] In one embodiment, after the processor 220 calculates the tilt angle of the image 400 of the object to be detected (step S320), the angle of the image 400 of the object to be detected can be rotated and corrected from the tilt angle to the standard tilt angle to correct the rotation offset of the entire image 400 of the object to be detected, and then the binarization image is performed to capture the object contour, calculate the center coordinates, and use the minimum circumscribed rectangle to cut out the sampled object image.

[0178] In one embodiment, after the processor 220 calculates the standard inclination of the standard object image 1000 relative to the horizontal reference (step S950), the standard object image 1000 may be rotationally corrected as a whole to be consistent with the horizontal reference (i.e., the value of the standard inclination is 0), or multiple standard object images may be rotationally corrected to be consistent with the horizontal reference. In this embodiment, when the processor 220 corrects the offset of the sampled object image in step S340, it is necessary to set the rotation offset to the horizontal reference (i.e., the value of the standard inclination is 0) to maintain the same rotation offset between the sampled object image and the standard object image, thereby improving the accuracy of the image block comparison.

[0179] In summary, the image detection device and image detection method proposed in the present invention only need to compare the image features of the image block to determine the quality of the object to be detected, solving the problem that the entire image needs to be compared to obtain the judgment result. In addition, the present invention reduces the problem of misjudgment when comparing the image features of the image block by correcting the rotation angle of the sampled object image. Overall, the present invention can improve the efficiency of image detection.

[0180] The above description is only a preferred specific example of the present invention, which does not limit the patent scope of the present invention. Therefore, all equivalent changes made by applying the content of the present invention are also included in the scope of the present invention and are hereby stated.

Claims

1. An image detection device, characterized in that: include: An image acquisition module configured to obtain an image of an object to be detected; a storage medium configured to store a standard image array, the standard image array comprising a plurality of standard object images; A processor, coupled to the image acquisition module and the storage medium, is configured to: Acquire a plurality of sampled object images from the image of the object to be detected; Storing the plurality of sampled object images in a sampled image array, wherein the sampled image array and the standard image array have the same array index; Comparing the plurality of sampled object images in the sampled image array and the plurality of standard object images in the standard image array according to the array index, respectively, to calculate an inference value of each of the sampled object images; as well as The quality of the object to be detected is evaluated according to the inferred values ​​of the plurality of sampled object images.

2. The image detection device according to claim 1, characterized in that: The storage medium is configured to store a standard tilt angle; Before the processor is configured to obtain the plurality of sampled object images using the image of the object to be detected, the process includes: Calculating a tilt angle of the image of the object to be detected; as well as The rotation offset of the image of the object to be detected is calculated according to a difference between the tilt angle and the standard tilt angle.

3. The image detection device according to claim 2, characterized in that: The operations before the processor is configured to store the plurality of sampled object images in the sampled image array include: Correcting the offsets of the plurality of sampled object images respectively according to the rotation offset; and The calibrated sampled object images are stored in the sampled image array.

4. The image detection device according to claim 2, characterized in that: The operations after the processor is configured to calculate the rotation offset of the image of the object to be detected include: Correcting the offset of the image of the object to be detected according to the rotation offset; and A plurality of sampled object images are obtained from the corrected image of the object to be detected.

5. The image detection device according to claim 3, characterized in that: The processor is configured to calculate the inference value of each sampled object image, including: The plurality of sampled object images after correction in the sampled image array and the plurality of standard object images in the standard image array are respectively compared according to the array index to calculate the inference value of each of the sampled object images.

6. The image detection device according to claim 2, characterized in that: The processor is configured to calculate the tilt angle of the image of the object to be detected, and the operation includes: Performing a binarization operation on the image of the object to be detected to obtain a first binarized image; Detecting a plurality of first object contours in the first binary image and respectively calculating a plurality of first center coordinates of the plurality of first object contours; and The tilt angle of the image of the object to be detected relative to a horizontal reference is calculated according to at least two coordinates of the plurality of first center coordinates and an origin coordinate.

7. The image detection device according to claim 6, characterized in that: Before the operation of obtaining the plurality of sampled object images in the to-be-detected object image using the plurality of first minimum circumscribed rectangles, the processor is configured to: Calculating a plurality of first minimum circumscribed rectangles respectively according to the plurality of first object contours; and In the to-be-detected object image, the plurality of first minimum circumscribed rectangles are used to obtain the plurality of sampled object images.

8. The image detection device according to claim 1, characterized in that: Before the storage medium is configured to store the standard image array, the processor is configured to: Performing a binarization operation on a standard image to obtain a second binarized image, wherein the standard image includes a standard tilt angle; detecting a plurality of second object contours in the second binary image; Calculating a plurality of second minimum circumscribed rectangles respectively according to the plurality of second object contours; as well as In the standard image, the plurality of second minimum circumscribed rectangles are respectively used to obtain the plurality of standard object images.

9. The image detection device according to claim 8, characterized in that: The operations after the processor is configured to detect the plurality of second object contours in the second binarized image include: respectively calculating a plurality of second center coordinates of the plurality of second object contours; and The standard inclination angle of the standard image relative to a horizontal reference is calculated according to at least two of the plurality of second center coordinates and an origin coordinate.

10. An image detection method for an object to be detected, characterized in that: include: Obtaining an image of an object to be detected; Acquire a plurality of sampled object images from the image of the object to be detected; Storing the plurality of sampled object images in a sampled image array, wherein the sampled image array and a standard image array have the same array index, and the standard image array includes a plurality of standard object images; Comparing the plurality of sampled object images in the sampled image array and the plurality of standard object images in the standard image array respectively according to the array index to calculate an inference value of each of the sampled object images; as well as The quality of the object to be detected is evaluated according to the inferred values ​​of the plurality of sampled object images.

11. The image detection method according to claim 10, characterized in that: The steps before obtaining a plurality of sampled object images from the image of the object to be detected include: Calculating a tilt angle of the image of the object to be detected; and The rotation offset of the image of the object to be detected is calculated according to a difference between the tilt angle and a standard tilt angle.

12. The image detection method according to claim 11, characterized in that: The steps before storing the plurality of sampled object images in the sampled image array include: Correcting the offsets of the plurality of sampled object images respectively according to the rotation offset; and The calibrated sampled object images are stored in the sampled image array.

13. The image detection method according to claim 11, characterized in that: The steps after calculating the rotation offset of the image of the object to be detected include: Correcting the image of the object to be detected according to the rotation offset; and A plurality of sampled object images are obtained from the corrected image of the object to be detected.

14. The image detection method according to claim 13, characterized in that: The step of calculating the inference value of each sampled object image comprises: The plurality of sampled object images after correction in the sampled image array and the plurality of standard object images in the standard image array are respectively compared according to the array index to calculate the inference value of each of the sampled object images.

15. The image detection method according to claim 11, characterized in that: The step of calculating the tilt angle of the image of the object to be detected further includes: Performing a binarization operation on the image of the object to be detected to obtain a first binarized image; Detecting a plurality of first object contours in the first binary image and respectively calculating a plurality of first center coordinates of the plurality of first object contours; and The tilt angle of the image of the object to be detected relative to a horizontal reference is calculated according to at least two coordinates of the plurality of first center coordinates and an origin coordinate.

16. The image detection method according to claim 15, characterized in that: Before the step of using the plurality of first minimum circumscribed rectangles to obtain the plurality of sampled object images in the to-be-detected object image, the method includes: The plurality of first minimum circumscribed rectangles are respectively calculated according to the plurality of first object contours.

17. The image detection method according to claim 10, characterized in that: Also includes: Performing a binarization operation on a standard image to obtain a second binarized image; detecting a plurality of second object contours in the second binary image; Calculating a plurality of second minimum circumscribed rectangles respectively according to the plurality of second object contours; and In the standard image, the plurality of second minimum circumscribed rectangles are respectively used to obtain the plurality of standard object images.

18. The method of claim 17, further comprising: respectively calculating a plurality of second center coordinates of the plurality of second object contours; as well as The standard inclination angle of the standard image relative to a horizontal reference is calculated according to at least two coordinates of the plurality of second center coordinates and an origin coordinate.