1. Technical Field
Embodiments of the present disclosure relate to image processing technologies, and particularly to a system and method for marking discrepancies between two images.
2. Description of Related Art
Automatic optical inspection (AOI) devices are widely used to automatically inspect a captured image of an object which is being tested, such as a motherboard or a printed circuit board (PCB), to find discrepancies between the captured image and a standard image of the object. In general, an iteration method is usually used to inspect any discrepancies by analyzing each pixel of the two images, which is time consuming and costly.
The present disclosure, including the accompanying drawings, is illustrated by way of examples and not by way of limitation. It should be noted that references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references mean at least one.
The storage system 12 stores a prototypical image or a standard image (herein after referred as to “standard image”) of the object 3, as shown in
In one embodiment, the image marking system 11 includes an image obtaining module 111, a matrix creation module 112, a matrix calculation module 113, and an image marking module 114. The modules 111-114 may comprise computerized instructions in the form of one or more programs that are stored in the storage system 12, and executed by the at least one processor 13 to provide functions for marking the discrepant parts of the digital image, and displaying the marked digital image on the display device 14.
In general, the word “module,” as used herein, refers to logic embodied in hardware or firmware, or to a collection of software instructions, written in a program language. In one embodiment, the program language may be Java, C, or assembly. One or more software instructions in the modules may be embedded in firmware, such as in an EPROM. The modules described herein may be implemented as either software and/or hardware modules and may be stored in any type of non-transitory computer-readable medium or other storage device. Some non-limiting examples of non-transitory computer-readable media include CDs, DVDs, BLU-RAY, flash memory, and hard disk drives.
The image obtaining module 111 is operable to capture a digital image of the object 3 using the image capturing device 2, and to obtain the standard image of the object 3 from the storage system 12. As shown in
The image obtaining module 111 is further operable to compare an image average energy density (IAED) value of the digital image and an IAED value of the standard image to generate an image of discrepancies found to exist between the captured digital image and the standard image (herein after “discrepant image”), and separate the discrepant image into an R (red) grayscale image, a G (green) grayscale image, and a B (blue) grayscale image based on the RGB channels of the discrepant image. In one embodiment, the discrepant image includes discrepant parts found between the digital image and the standard image. The RGB channels include an R channel, a G channel, and a B channel of the discrepant image. The RGB values of each pixel are described using brightness values of the R, G, and B channels of each pixel. The IAED is defined as an image energy density of each pixel of the image having N*N pixels, and is calculated according to the equation IAED=(R+G+B)/N/N, where R represents a pixel value of the R channel, G represents a pixel value of the G channel, and B represents a pixel value of the B channel. The pixel value of the R channel, the G channel, or the B channel may be an integer in the range of 0 to 255.
The matrix creation module 112 is operable to create an R channel matrix group according to a brightness value of each pixel of the R grayscale image, create a G channel matrix group according to a brightness value of each pixel of the G grayscale image, and create a B channel matrix group according to a brightness value of each pixel of the B grayscale image. The R channel matrix group includes a plurality of R channel matrixes, wherein the number of the R channel matrixes is equal to the number of the pixels of the R grayscale image. The G channel matrix group includes a plurality of R channel matrixes, wherein the number of the R channel matrixes is equal to the number of the pixels of the G grayscale image. The B channel matrix group includes a plurality of R channel matrixes, wherein the number of the B channel matrixes is equal to the number of the pixels of the R grayscale image. In one embodiment, the R channel matrix, the G channel matrix, and the B channel matrix may be created using a hessian matrix. Each of the R channel matrix group, the G channel matrix group, and the B channel matrix group includes positive definite matrixes and negative definite matrixes. Each of the positive definite matrixes or negative definite matrixes may be described as a second-order partial derivatives matrix.
The matrix creation module 112 is further operable to determine R channel negative matrixes from the R channel matrix group, G channel negative matrixes from the G channel matrix group, and B channel negative matrixes from the B channel matrix group. In one embodiment, if the brightness value of a pixel (X, Y) is E(X, Y), the matrix creation module 112 determines the negative matrixes by comparing the brightness values of the pixels surrounding the pixel (X, Y). If E(Xn−1, Ym)<E(Xn, Ym), E(Xn, Ym)>E(Xn+1, Ym), E(Xn, Ym−1)<E(Xn, Ym), and E(Xn, Ym)>E(Xn, Ym+1), the created matrixes including the brightness values of the pixel (X, Y) and the pixels surrounding the pixel (X, Y) are determined as negative matrixes.
The matrix calculation module 113 is operable to calculate a first pixel group {R(X1, Y1), R(X2, Y2), . . . R(Xp, Yp)} that is composed of p pixels corresponding to local maximums of the R channel negative matrixes, a second pixel group {G(M1, N1), G(M2, N2), . . . G(Mq, Nq)} that is composed of q pixels corresponding to local maximums of the G channel negative matrixes, and a third pixel group {B(T1, S1), B(T2, S2), . . . B(Tr, Sr)} that is composed of r pixels corresponding to local maximums of the B channel negative matrixes. In the embodiment, the matrix calculation module 113 may determine the local maximums of the R, G, and B channel negative matrixes by calculating a second-order partial derivatives of each negative matrix of the R, G, and B channel negative matrixes. The pixels corresponding to the local maximums of the R, G, and B channel negative matrixes are respectively composed of the first pixel group, the second pixel group, and the third pixel group.
The matrix calculation module 113 is further operable to calculate an intersection of the first, second, and third pixel groups, to obtain a target pixel group {(X1, Y1), (X2, Y2), . . . (Xj, Yj)} which requires to be marked. In one embodiment, if Xp=Mq=Tr, and Yp=Nq=Sr, the pixels R(Xp, Yp), G(Mq, Nq), and B(Tr, Sr) are determined to be the same pixel, that is to say one pixel of the target pixel group (Xj, Yj).
The image marking module 114 is operable to determine a smallest area for each pixel (Xj, Yj) of the target pixel group that contains all black pixels surrounding the pixel (Xj, Yj) in the discrepant image. In the embodiment, if the brightness value of a pixel is 0, the pixel is defined as a black pixel. If the distance between a black pixel and the pixel (Xj, Yj) is less than the distance between the black pixel and any other pixel of the target group, the black pixel is defined to be a black pixel surrounding the pixel (Xj, Yj).
The image marking module 114 is further operable to mark each of the determined smallest areas in the captured digital image of the object 3, to isolate and mark the discrepant parts of the digital image. As shown in
In block S20, the image obtaining module 111 captures a digital image of the object 3 using the image capturing device 2, and obtains a standard image of the object 3 from the storage system 12. As shown in
In block S21, the image obtaining module 111 compares an IAED value of the digital image and an IAED value of the standard image to generate a discrepant image from the digital image and the standard image. For example, image C in
In block S22, the image obtaining module 11 separates the discrepant image into an R grayscale image, a G grayscale image, and a B grayscale image based on the RGB channels of the discrepant image. In the embodiment, the RGB channels include an R channel, a G channel, and a B channel of the discrepant image. The RGB values of each pixel of the discrepant image are described using the brightness values of the R, G, and B channels of each pixel.
In block S23, the matrix creation module 112 creates an R channel matrix group according to the brightness value of each pixel of the R grayscale image, creates a G channel matrix group according to the brightness value of each pixel of the G grayscale image, and creates a B channel matrix group according to the brightness value of each pixel of the B grayscale image. Details of the R channel matrix group, the G channel matrix, and the B channel matrix are described above.
In block S24, the matrix creation module 112 determines the R channel negative matrixes from the R channel matrix group, the G channel negative matrixes from the G channel matrix group, and the B channel negative matrixes from the B channel matrix group. In one embodiment, each of the R channel matrix group, the G channel matrix group, and the B channel matrix group includes one or more positive definite matrixes and one or more negative definite matrixes. Each of the definite matrixes or negative definite matrixes may be described as a second-order partial derivatives matrix.
In block S25, the matrix calculation module 113 calculates a first pixel group {R(X1, Y1), R(X2, Y2), . . . R(Xp, Yp)} that is composed of p pixels corresponding to the local maximums of the R channel negative matrixes, a second pixel group {G(M1, N1), G(M2, N2), . . . G(Mq, Nq)} composed of q pixels corresponding to the local maximums of the G channel negative matrixes, and a third pixel group {B(T1, S1), B(T2, S2), . . . B(Tr, Sr)} composed of r pixels corresponding to the local maximums of the B channel negative matrixes. In the embodiment, the matrix calculation module 113 may determine the local maximums of the R, G, and B channel negative matrixes by calculating the second-order partial derivatives of each negative matrix of the R, G, and B channel negative matrixes. The pixels corresponding to the local maximums of the R, G, and B channel negative matrixes are respectively composed of the first, second, and third pixel groups.
In block S26, the matrix calculation module 113 calculates an intersection of the first, second, and third pixel groups, to obtain a target pixel group {(X1, Y1), (X2, Y2), . . . (Xj, Yj)}. In one embodiment, if Xp=Mq=Tr, and Yp=Nq=Sr, the pixels R(Xp, Yp), G(Mq, Nq), and B(Tr, Sr) are determined to be the same pixel, that is to say one pixel of the target pixel group (Xj, Yj).
In block S27, the image marking module 114 determines a smallest area for each pixel (Xj, Yj) of the target pixel group that contains all the black pixels surrounding the pixel (Xj, Yj) in the discrepant image. In the embodiment, if the brightness value of a pixel is 0, the pixel is defined as a black pixel. If the distance between that black pixel and the pixel (Xj, Yj) is less than the distance between that black pixel and any other pixel of the target group, that black pixel is defined to be a black pixel surrounding the pixel (Xj, Yj).
In block S28, the image marking module 114 marks each of the determined smallest areas in the captured digital image of the object 3, to mark out the discrepant parts of the digital image. As shown in
Although certain embodiments of the present disclosure have been specifically described, the present disclosure is not to be construed as being limited thereto. Various changes or modifications may be made to the present disclosure without departing from the scope and spirit of the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
201010573285.X | Dec 2010 | CN | national |