1. Technical Field
Embodiments of the present disclosure relate to image processing technology, and particularly to a computing device and a method of image matching.
2. Description of Related Art
In a structured light three-dimensional (3D) measurement system, structured light is projected on an object. An image of the object is captured by a camera. The image is encoded and matched using an image matching method. The image matching process ensures accuracy of the structured light 3D measurement system. Generally, the image matching method include a phase shifting method and a phase encoding method based on a one-dimensional sine grating, such as, a binary gray code method and a multi frequency heterodyne principle, for example. However, as a limitation of the one-dimensional sine grating, an obtained phase using the one dimensional sine grating cannot directly be used to match images.
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.”
In general, the word “module,” as used hereinafter, refers to logic embodied in hardware or firmware, or to a collection of software instructions, written in a programming language, such as, for example, Java, C, or assembly. One or more software instructions in the modules may be embedded in firmware. It will be appreciated that modules may comprise connected logic units, such as gates and flip-flops, and may comprise programmable units, such as programmable gate arrays or processors. 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 storage medium or other computer storage device.
The computing device 2 is connected to a measurement device 1. The measurement device 1 includes at least two cameras 10 and a projector 11. One camera 10 is positioned on the left of the projector 11 (hereinafter “the left camera”) and the other camera 10 is positioned on the right of the projector 11 (hereinafter “the right camera”). The projector 11 projects gratings with a number M of frequencies on an object 13 positioned on a work table 12. The gratings generate deformations on the surface of the object 13, and the cameras 10 captures images of gratings on the object 13. The captured images are represented as grating images. The left camera captures a number N of left grating images of the gratings with each of the frequencies on the object 13. The right camera captures a number N of right grating images of the gratings with each of the frequencies on the object 13.
The system 20 obtains a first phase grayscale image according to the left grating images, and obtains a second phase grayscale image according to the right grating images. Then the system 20 obtains a matched image by matching the first phase grayscale and the second phase grayscale.
In step S10, the receiving module 200 receives a number M of frequencies of gratings, cycles of gratings with each of the frequencies, and phase shifting times N. N represents a number of phase shifting times in an N-step phase shifting method.
In step S11, the control module 201 controls the projector 11 to project gratings on the object 13, and acquires a number N of left grating images captured by the left camera and a number N of right grating images captured by the right camera of the gratings with each of the frequencies on the object 13. For example, if M is three and N is four, for a first frequency, the left camera captures four left grating images and the right camera captures four right grating images. That is, the left camera captures M*N left grating images, and the right camera also captures M*N right grating images.
In step S12, the classification module 202 classifies the left grating images into groups of left grating images, and classifies the right grating images into groups of right grating images, according to the frequencies of the gratings. Each group of left grating images and each group of right grating images correspond to one of the frequencies.
In step S13, the computation module 203 computes luminous intensity of each pixel in each of the left grating images and the right grating images. In detail, a luminous intensity of a pixel of an ith grating image in a group of left grating images or a group of right grating images of a grating with a mth frequency is computed according to a formula as follows.
In the formula, “a” represents a coefficient, “x” represents an abscissa of the pixel in the ith grating image, “y” represents an ordinate of the pixel in the ith grating image, “φm” represents cycles of the grating with the mth frequency, “m” is an integer and more than zero, “i” is an integer and more than zero, and m≦M, i≦N.
In step S14, the computation module 203 computes a phase principal value of pixels having same coordinates in each group of left grating images of the gratings with each of the frequencies according to luminous intensities of the pixels having same coordinates in the group of left grating images and an N-step phase shifting method, and computes a phase principal value of pixels having same coordinates in each group of right grating images of the gratings with each of the frequencies according to luminous intensity of the pixels having same coordinates in the group of right grating images and the N-step phase shifting method.
In detail, a phase principle value θ(x, y) of pixels having same coordinates in a group of left grating images or a group of right grating images of the gratings with the mth frequency is computed according to a formula as follows.
Ii(x, y) represents a luminous intensity of a pixel of the ith grating image in the group of the left grating images when the phase principle value θ(x, y) of the pixels having same coordinates in the group of left grating images is computed, or represents a luminous intensity of a pixel of the ith grating image in the group of the right grating images when the phase principle value θ(x, y) of the pixels having same coordinates in the group of right grating images is computed.
In step S15, the computation module 203 computes a phase of the pixels having same coordinates in the left grating images according to the phase principal value of the pixels having same coordinates in each group of left grating images, and obtains a first phase grayscale image according to the phase of the pixels having same coordinates in each group of left grating images. The computation module 203 also computes a phase of the pixels having same coordinates in the right grating images according to the phase principal value of the pixels having same coordinates in each group of left grating images, and obtains a first phase grayscale image according to the phase of the pixels having same coordinates in each group of left grating images.
In detail, the number M of frequencies (λ1, λ2 . . . λm . . . λM) are arranged according to a descending sequence. λm represents a mth frequency, and λM represents a maximum frequency of the gratings. A phase principle value of the pixels in a group of the left grating images or a right grating images of the gratings with the frequency λm is represented as θm. An absolute phase of the pixels in a group of the left grating images or a right grating images of the gratings with the frequency λm is represented as Φm. Because the first grating frequencies λ1 is smallest, an absolute phase Φ1of the pixels in a group of the left grating images or a right grating images of the first grating frequencies λ1 is equal to θ1. An absolute phase Φ2 of the pixels in a group of the left grating images or a right grating images of the second grating frequencies λ2 is computed according to the absolute phase Φ1 and the phase principle value θ2, that is,
An absolute phase ΦM of the pixels in a group of the left grating images or a right grating images of the second grating frequencies λM is computed according to a formula as follows.
The INT represents that a result of
is rounded. ΦM-1 represents an absolute phase of the pixels in a group of the left grating images or a right grating images of the gratings with the frequency λM-1. Therefore, the phase of the pixels having same coordinates in the left grating images or the right grating images is equal to ΦM.
In step S16, the match module 204 obtains a matched image by matching the first phase grayscale image and the second phase grayscale image.
In detail, if a phase of a specified pixel in the first phase grayscale image is represented with P0, the match module 204 determines four adjacent pixels in the second phase grayscale image for the specified pixel according to the following conditions. As show in
Then in the second phase grayscale, the match module 204 computes coordinates (x′, y′) of a match pixel using a bilinear interpolation method according to the four adjacent pixels in the second phase grayscale image according to formulas as follows.
It should be emphasized that the above-described embodiments of the present disclosure, including any particular embodiments, are merely possible examples of implementations, set forth for a clear understanding of the principles of the disclosure. Many variations and modifications may be made to the above-described embodiment(s) of the disclosure without departing substantially from the spirit and principles of the disclosure. All such modifications and variations are intended to be included herein within the scope of this disclosure and protected by the following claims.
Number | Date | Country | Kind |
---|---|---|---|
2013101110377 | Apr 2013 | CN | national |