BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 shows examples of conventional Sobel filters and illustrations of conventional Sobel filters identifying pixel windows incorrectly.
FIG. 2 is a pattern detecting apparatus according to an embodiment of the present invention.
FIGS. 3 and 4 show twelve examples of predetermined result combinations and predetermined patterns.
FIG. 5 is an edge detecting apparatus according to an embodiment of the present invention.
DETAILED DESCRIPTION
Please refer to FIG. 2. FIG. 2 is a pattern detecting apparatus 200 according to an embodiment of the present invention. The pattern detecting apparatus 200 includes a comparing module 240 and a determining module 260. The comparing module 240 is utilized for comparing a plurality of pixels (including pixels A, B, C, D, E, F, G, H, and I) of a pixel window 220 in an image. The determining module 260 is utilized for determining whether the pixel window 220 matches any predetermined pattern of a plurality of predetermined patterns according to results of comparing the pixels utilizing the comparing module 240.
The comparing module 240 can include a plurality of comparing units 245, and each comparing unit 245 is utilized for determining whether a difference between two pixels of the pixel window 220 is larger than a predetermined threshold value TH. For example, a comparing unit 245 determines whether a difference abs (A-D) between pixels A and D is larger than a predetermined threshold value TH, while another comparing unit 245 determines whether a difference abs (A-B) between pixels A and B is larger than a predetermined threshold value TH, and still another comparing unit 245 determines whether a difference abs (A-E) between pixels A and E is larger than a predetermined threshold value TH, etc. Please note that “each comparing unit 245 uses the same predetermined threshold value” is only an example. “Different comparing units 245 use different predetermined threshold values” is also practicable. Other comparing methods with the same spirit all fall within the scope of the present invention.
A comparing result combination is generated according to a plurality of comparing results generated by the comparing units 245. The determining module 260 determines whether the comparing result combination is similar to any predetermined result combination of a plurality of predetermined result combinations in order to determine whether the pixel window 220 matches any predetermined pattern of the predetermined patterns. In this embodiment, the predetermined result combinations correspond to the predetermined patterns respectively. FIGS. 3 and 4 show twelve examples of predetermined result combinations and predetermined patterns. If the comparing result combination matches a predetermined result combination of “A=B=C=G=H=I && D=E=F && A!=D”, the determining module 260 determines the pixel window 220 matches a predetermined pattern of “horizontal edge pattern”. If the comparing result combination matches a predetermined result combination of “A=B=D=F=H=I && C=E=G && A!=E”, the determining module 260 determines the pixel window 220 matches a predetermined pattern of “right tilted edge pattern”. Please note that if the comparing result combination is similar to the predetermined result combination of “A=B=C=G=H=I && D=E=F && A!=D”, the determining module 260 will still determine the pixel window 220 matches a predetermined pattern of “horizontal edge pattern”. Similarly, if the comparing result combination is similar to the predetermined result combination of “A=B=D=F=H=I && C=E=G && A!=E”, the determining module 260 will still determine the pixel window 220 matches a predetermined pattern of “right tilted edge pattern”.
Although each predetermined pattern in the twelve examples shown in FIGS. 3 and 4 is a predetermined pattern of “edge pattern”, when defining the predetermined result combinations and the predetermined patterns, other predetermined result combinations and other predetermined patterns (which are not necessary to be corresponding to “edge”) can also be defined according to the system operation requirements to provide a pattern detecting function more completely.
Additionally, the pattern detecting apparatus of the present invention can be utilized with a conventional edge detecting module to compensate for the deficiencies of the conventional edge detecting module. FIG. 5 is an edge detecting apparatus according to an embodiment of the present invention. The edge detecting apparatus 500 of the embodiment includes an edge detecting module 520, a pattern detecting apparatus 540, and a detecting result integrating module 560. The edge detecting module 520 includes a conventional Sobel filter or Laplace filter, which determines whether a pixel in an input image corresponds to an edge via a conventional method. The pattern detecting apparatus 540 have the same configuration with the pattern detecting apparatus 200 shown in FIG. 2, and the pattern detecting apparatus 540 is utilized for detecting whether a pixel window in the input image matches or is similar to any predetermined pattern of a plurality of predetermined patterns to generate a pattern detecting result. The detecting result integrating module 560 is utilized for generating a final edge detecting result according to the edge detecting result and the pattern detecting result. Since the pattern detecting apparatus 540 is utilized to compensate for the deficiencies of the conventional edge detecting module 520, the edge detecting apparatus 500 of the embodiment are capable of detecting edge more accurately.
Various practicable methods for the operation of the detecting result integrating module 560 are provided. For example, the detecting result integrating module 560 can take the edge detecting results as a principal result, and take the pattern detecting results as an auxiliary result to output the final edge detecting result. The detecting result integrating module 560 can also take the pattern detecting results as the principal result, and take the edge detecting results as the auxiliary result to output the final edge detecting result. Taking the pixel window 150 shown in FIG. 1 as an example, the edge detecting results and the pattern detecting results outputted by the edge detecting module 520 and the pattern detecting apparatus 540 are a “non edge pattern” and “right tilted edge pattern” respectively, and the detecting result integrating module 560 can utilize the “right tilted edge pattern” as the final edge detecting result at this time. Taking the pixel window 160 shown in FIG. 1 as an example, the edge detecting results outputted by the edge detecting module 520 and the pattern detecting results outputted by the pattern detecting apparatus 540 are a “left tilted edge pattern” and a “right tilted edge pattern” respectively, and the detecting result integrating module 560 can utilize the “right tilted edge pattern” as the final edge detecting result at this time.
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.