Apparatus using histogram analysis of colour tints

Abstract: An image processing apparatus includes an image processing unit, a counter, and a determining unit. The image processing unit processes image data between the first and second color values of an input image. The counter counts the generation frequencies of the respective color values of the input image and generates a histogram. After smoothing of the histogram the determining unit determines the first and second color values on the basis of the count result obtained by the counter.

Description: BACKGROUND OF THE INVENTION Field of the Invention The present invention relates to an image processing apparatus for processing a color image, and an image processing method thereof. Description of Related Art The following image reproduction function has recently been proposed in a digital copying machine, an image scanner, a facsimile apparatus, and the like. First the color information of an original is converted into color signals by a photoelectric conversion element such as a color CCD or the like. Areas which are determined, on the basis of these color signals, to have the same color are replaced with a predetermined pattern such as a dot, horizontal line, or wavy line pattern corresponding to the color. This pattern is then reproduced in a single color to reproduce a monochrome image, thereby realizing a visual effect similar to that obtained by reproducing a color image. In patterning color data, however, since color boundaries for patterning are fixed, the following problem is posed. If a portion of an image on an original has a color close to a boundary, the image is converted into two patterns because of the gradation of the color of the image, resulting in a poor processing result. The present invention is concerned with solving the above problem. The present invention is also concerned with providing an image processing apparatus which can perform patterning of color data to generate a beautiful, easy-to-see pattern image, and also with providing an image processing apparatus which can automatically determine a color range to be image-processed. European Patent Specification no. EP-A-0922008 discloses an image processing method in which pattern signals are generated in accordance with discriminated colors in an image color signal, and in which the pattern signals are reproduced with the densities of the patterns varied in accordance with the brightness distribution of the original image. In accordance with the present invention there is provided an image processing apparatus as set out in claim 1. Features and advantages of the present invention will be apparent from the following detailed description which is given by way of example in conjunction with the accompanying drawings and the appended claims. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a block diagram showing a copying machine according to an embodiment of the present invention; Fig. 2 is a block diagram showing a data processing unit 102b; Fig. 3 is a block diagram showing a color discriminating unit 501; Fig. 4 is a chart for explaining a color plane; Fig. 5 is a graph for explaining a histogram of hue values; Fig. 6 is a flow chart showing a procedure for smoothing processing; Fig. 7 is a graph showing a histogram obtained after smoothing processing; Fig. 8 is a flow chart showing a procedure for determining threshold values; Fig. 9 is a flow chart showing a procedure for slant detection; Fig. 10 is a flow chart showing a procedure for maximum value detection; Fig. 11 is a flow chart showing a procedure for detecting a minimum value in the + direction; Fig. 12 is a flow chart showing a procedure for detecting a minimum value in the - direction; Fig. 13 is a block diagram showing a pattern selecting unit 502; Fig. 14 is a block diagram showing a pattern generating unit 114 and an address control unit 115; Figs. 15A and 15B are views for explaining pattern data stored in a ROM 130; Fig. 16 is a timing chart of the address control unit 115; Fig. 17 is a graph for explaining a histogram of hue values; and Figs. 18A and 18B are flow charts showing a procedure for determining threshold values. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT An embodiment of the present invention will be described below with reference to the accompanying drawings. Fig. 1 is a block diagram showing a digital copying machine according to the embodiment of the present invention. A full-color original 100 is illuminated by a lamp (not shown). In an image reading unit 101, the full-color image is then formed on the light-receiving surface of a color CCD sensor 101b by a lens 101a, and the R (red), G (green), and B (blue) image data of each line of the image are read as analog signals, respectively, at a rate of 400 dpi, for example. The read signals are converted into digital signals by an A/D converter 101c. The digital signals are then sent from the image reading unit 101 to an image processing unit 102. In the image processing unit 102, the R, G, and B digital signals are corrected by a shading compensation circuit 102a in accordance with the light amount irregularity of the lamp, the sensitivity error of the color CCD sensor 101b with respect to each pixel, and the like, thus obtaining 8-bit R, G, and B digital signals. Subsequently, in a data processing unit 102b, the colors of the image data are discriminated on the basis of these digital signals, and are converted into patterns corresponding to the respective colors. The respective patterns are converted into density data by a LOG conversion unit 102c to be reproduced as a monochrome image by a printer 103. The printer 103 includes a circuit for controlling, e.g., a motor for conveying a transfer sheet, a laser recording portion for writing image data from the image processing unit 102 on the photosensitive drum, and a developing control circuit for developing an image in monochrome. In addition, a CPU circuit unit 104 includes a CPU 104a, a ROM 104b, and a RAM 104c. The CPU circuit unit 104 controls the overall copying sequence of the digital copying machine by controlling the image reading unit 101, the image processing unit 102, the printer 103, and the like. Fig. 2 is a block diagram of the image processing unit 102b. A brightness signal generating unit 110 generates non-color-separated image data throughout the entire wavelength region, i.e., monochrome brightness data Dout, from the color-separated R, G, and B signals from the image reading unit 101. This data is then input to an input terminal A of a selector 112. Note that the brightness signal generating unit 110 generates the brightness data Dout by calculating the averages of the R, G, and B data using, e.g., an adder and a multiplier. As shown in detail in Fig. 3, a color discriminating unit 501 detects color components of the color original 100 by using a hue signal in order to reproduce the color image in monochrome patterns. In this case, the hue signal is used to accurately discriminate colors even if identical colors differ in vividness and brightness. Strictly speaking, the meaning of the word "hue" used in the following description is different from the general meaning of the word. R, G, and B data input to the color discriminating unit 501 respectively consist of 8-bit data and are data having a total of 2 24 colors. Since direct processing of such a large amount of data requires a large-scale, expensive circuit, the following processing is performed. A max/mid/min detecting unit 120 compares the R, G, and B data through comparators to obtain values max (maximum values), values mid (middle values), and values min (minimum values), and outputs corresponding order signals. The values min are output to a multiplier 113 shown in Fig. 2. As is known in the Munsell system or the like, a color space is represented by saturation, lightness, and hue. First, R, G, and B data need to be converted into plane data, i.e., two-dimensional data. In this case, since the common portions of R, G, and B data, i.e., minimum values min (R, G, B) of the R, G, and B data, are achromatic components, the data min (R, G, B) are respectively subtracted from the respective color data, and the remaining data are used as chromatic components (subtracters 121 and 122 in Fig. 3). As shown in Fig. 4, the plane data obtained by such conversion is a 0°-360° plane which is divided into six sectors respectively representing color data based on the orders of the magnitudes of the R, G, and B data, i.e., R > G > B, R > B > G, G > B > R, G > R > B, B > G > R, and B > R > G. As a result, each 8-bit data is converted into a two-dimensional color space. A hue detecting unit 123 outputs hue values corresponding to values (max - min) from the subtracter 121, values (mid - min) from the subtracter 122, and order signals from the max/mid/min detecting unit 120. As such hue values, values ranging from "0" to "239", with blue (B) serving as a start point in Fig. 4, are output to a FIFO memory 201. An achromatic component has a relatively small value (max - min). If, therefore, a value (max - min) is smaller than a certain value, a hue value other than "0" to "239" is output, thereby forming a histogram of only chromatic components, as will be described later. A rate multiplier 200 is designed to output a signal once per 16 pixels in the main scanning direction of the original 100 and output a signal once per 16 lines in the sub scanning direction. Therefore, one hue value from the hue detecting unit 123 is loaded in the FIFO memory 210 per 16 x 16 pixels. The hue values loaded in the FIFO memory 210 in this manner are sequentially read out by a CPU 126 on the basis of a program pre-stored in the ROM 104b shown in Fig. 1. The read values ranging from "0" to "239" are respectively accumulated from a histogram. The histogram is then loaded in a RAM 202. If the accumulation data are represented by a[0] to a[239], since the hue values of this histogram are discretely distributed, as shown in Fig. 5, it is difficult to determine threshold values from the histogram. For this reason, in the embodiment, smoothing processing is performed with respect to such data according to the following equation: a[i] = (a[i - 2] + a[i - 1] + a[i] + a[i + 1] + a[i + 2])/5 where 0 ≤ i < 240. Since the changes in hue value are still coarse after one smoothing operation, smoothing is performed twice in the embodiment to form a histogram representing smooth changes in hue value, as shown in Fig. 6. More specifically, in step S1 shown in Fig. 6, a smoothing operation counter j is reset. In step S2, a hue value counter i is reset. In step S3, smoothing is performed according to the above equation. In the loop of steps S3 to S5, the first smoothing operation is performed with respect to values i ranging from "0" to "239". Assume that in the above equation, a[-2] = a[238], a[-1] = a[239], a[240] = a[0], and a[241] = a[1]. In step S6, the smoothing operation counter j is incremented. In the loop of steps S2 to S7, the second smoothing operation is performed. Fig. 7 shows a histogram obtained by performing smoothing processing twice. In this embodiment, hue values at points A to I are obtained from this smoothed histogram, as shown in Fig. 7. Fig. 8 is a flow chart showing an outline of a procedure for determining threshold values. Fig. 9 is a flow chart showing a detailed procedure for slant detection in Fig. 8. Fig. 10 is a flow chart showing a detailed procedure for maximum value detection in Fig. 8. Fig. 11 is a flow chart showing a detailed procedure for minimum value detection in the + direction in Fig. 8. Fig. 12 is a flow chart showing a detailed procedure for minimum value detection in the - direction in Fig. 8. In step S10 shown in Fig. 8, the slant of each hue value is obtained. In step S20, the maximum value of the hue values is obtained. In step S30, the minimum value of the hue values in the + direction is obtained. In step S40, the minimum value of the hue values in the - direction is obtained. If it is determined in step S50 that detection has not been performed a predetermined number of times, the flow advances to step S20. If detection has been performed the predetermined number of times, the processing is ended. According the procedure for slant detection shown in Fig. 9, a slant b[i] of a hue value i (= [0] to [239]) is obtained as follows: If a[i] - a[i - 1] > 0, then b[i] = 1 (S11, S12) If a[i] - a[i - 1] = 0, then b[i] = 0 (S11, S13) If a[i] - a[i - 1] < 0, then b[i] = -1 (S11, S14) where 0 ≤ i < 240. When the slants b[i] in the whole area of the histogram are obtained, the flow advances from step S15 to step S20 in Fig. 10. In the procedure for maximum value detection shown in Fig. 10, the respective parameters are initialized in step S21. With the first detection, a maximum value a[A] of a[0] to a[239] is obtained (steps S22 to S25). In this case, therefore, the maximum value a[A] is the hue value at a position A. A procedure for the second and subsequent maximum value detections will be described later. In the procedure for minimum value detection in the + direction shown in Fig. 11, the respective parameters are initialized in step S31. Subsequently, the hue value is changed in the + direction from the hue value at the position A, at which the maximum value a[A] is detected in step S20 in Fig. 10, as a start point, and the hue value which satisfies one of the following three conditions first is obtained and detected as a threshold value. The first condition is that matching of histogram patterns in target areas (i - 2), (i - 1), (i), (i + 1), and (i + 2) of hue values is performed as follows (step S32): a[i - 2] ≠ 0, a[i - 1] ≠ 0, a[i] = 0, a[i + 1] = 0, a[i + 2] = 0 The hue value i which satisfies this condition is stored as a temporary threshold value (step S34). The second condition is that when a target hue value is equal to the previously detected threshold value, the corresponding hue value i is stored as a temporary threshold value (steps S33 and S34). The third condition is that when an accumulation value a[i] is smaller than a setting value α (step S35), the corresponding hue value i is stored as a temporary threshold value (step S36). After the above-described condition is satisfied, matching of slant patterns in the target areas (i - 2), (i - 1), (i), (i + 1), and (i + 2) of the hue values is performed as follows (step S37): b[i - 2] ≠ -1, b[i - 1] ≠ -1, b[i] ≠ -1, b[i + 1] ≠ -1, b[i + 2] ≠ -1 When this slant pattern matching condition is satisfied, the hue value stored in step S34 or S36 is obtained as a threshold value. In this case, the hue value at a position B is set as a threshold value. In the procedure for minimum value detection in the - direction shown in Fig. 12, the respective parameters are initialized in step S41. Subsequently, the hue value is changed in the - direction from the hue value at the position A, at which the maximum value a[A] is detected in step S20 in Fig. 10, as a start point, and the hue value which satisfies one of the following three conditions first is obtained and detected as a threshold value. The first condition is that matching of histogram patterns in target areas (i - 2), (i - 1), (i), (i + 1), and (i + 2) of hue values is performed as follows (step S42): a[i - 2] = 0, a[i - 1] = 0, a[i] = 0, a[i + 1] ≠ 0, a[i + 2] ≠ 0 The hue value i which satisfies this condition is stored as a temporary threshold value (step S44). The second condition is the same as that in the procedure for minimum value detection in the + direction. Therefore, when a target hue value is equal to the previously detected threshold value, the corresponding hue value i is stored as a temporary threshold value (steps S43 and S34). The third condition is that when the accumulation value a[i] is smaller than the setting value α (step S45), the corresponding hue value i is stored as a temporary threshold value (step S46). After the above-described condition is satisfied, matching of slant patterns in the target areas (i - 2), (i - 1), (i), (i + 1), and (i + 2) of the hue values is performed as follows (step S47): b[i - 2] ≠ 1, b[i - 1] ≠ 1, b[i] ≠ 1, b[i + 1] ≠ 1, b[i + 2] ≠ 1 When this slant pattern matching condition is satisfied, the hue value stored in step S44 or S46 is obtained as a threshold value. In this case, the hue value at a position C is set as a threshold value. In the second procedure for maximum value detection shown in Fig. 10, the respective parameters are initialized in step S20. Thereafter, in step S21, the area between the threshold values obtained in the above-described manner is masked. More specifically, the area between the positions B and C is masked, and a maximum value a[D] of a[0] to a[C - 1] and a[B + 1] to a[239] is obtained (step S22 to S24). Subsequently, in steps S30 and S40, the hue values at positions E and F, at which the hue value is minimized in the + direction and the - direction, with a position D of the obtained maximum value a[D] being regarded as the center, are obtained as threshold values. In addition, in the third procedure for maximum value detection, the maximum value at a position G and the hue values at minimum value positions H and I corresponding to the position G are obtained as threshold values. This threshold value determination processing is performed a predetermined number of times. The threshold values at the positions C, B, F, E, I, and H are respectively set in window comparators 301 to 306 for color selection (Fig. 3), in the order named by the CPU 126, as shown in Fig. 13. More specifically, the threshold values in the largest area between the positions C and B, the threshold values in the second largest area between the positions F and E, and the threshold values in the third largest area between the positions I and H are respectively set in the window comparators. When the original 100 is read by the second scan operation, a hue signal from the hue detecting unit 123 is input to a color selecting unit 401. If the hue value of the hue signal is larger than the threshold value at the position C and is smaller than the threshold value at the position B, i.e., falls in the range of the hue values between the positions B and C, both the window comparators 301 and 302 output "1", while an output from a corresponding AND gate 307 is set at "1". Similarly, if the hue value of the hue signal falls in the range of hue values between the positions E and F, both outputs from the window comparators 303 and 304 are set at "1", while an output from an AND gate 308 is set at "1". If the hue value of the hue signal falls in the range of the hue values between the positions H and I, both outputs from the window comparators 305 and 306 are set at "1", while an output from an AND gate 309 is set at "1". When one of the output signals from the AND gates 307 to 309 is set at "1", an output from an OR gate 310 is set at "1". The selector 112 shown in Fig. 2 then selects the pattern signal from the multiplier 113 in accordance with the output from the OR gate 310. Pattern data from a pattern generating unit 114 is selected by the output signals from the AND gates 307 to 309 and AND gates 311 to 313. The pattern data is then output to the multiplier 113 in Fig. 2 through an OR gate 315 to be multiplied by the darkest signals min (R, G, B) from the color separating unit 501. The resultant data is output to an input terminal B of the selector 112. Fig. 14 shows the detailed arrangement of the pattern generating unit 114 and an address control unit 115 in Fig. 13. The pattern generating unit 114 is constituted by a ROM 130 in which dot data for patterns are pre-stored at addresses constituted by high order addresses and low order addresses, as shown in Figs. 15A and 15B. The address control unit 115 generates a read address of the ROM 130. A main scanning counter 131 of the address control unit 115 counts the pulses of a pixel count signal VCLK in synchronism with a horizontal sync signal HSYNC, and generates a high order address of the ROM 130, as shown in Fig. 16. A sub scanning counter 133 counts the pulses of the horizontal sync signal HSYNC in synchronism with a signal ITOP which is set at low level while the image reading unit 101 shown in Fig. 1 reads the original 100, thus generating a low order address of the ROM 130. The multiplier 113 in Fig. 2 multiplies the minimum value signals, i.e., the darkest signals min (R, G, B) from the color discriminating unit 501 and the dot data read out from the ROM 130, and outputs the resultant data to the input terminal B of the selector 112. The darkest signals min (R, G, B) are used for the following reason. The level of the brightness signal Dout generated from an ND signal varies depending on the color. For example, the level of a yellow signal is close to that of a white signal. In this case, if brightest signals max (R, G, B) are used, image data of the original 100 is omitted. In this embodiment, patterning is performed with respect to three hue ranges, i.e., ranges having three peaks, in a histogram. If, however, a hue value histogram of an original image has four peaks, as shown in Fig. 17, patterning is not performed with respect to a hue range between positions L and K, although patterning is performed with respect to hue ranges between positions C and B, positions F and E, and positions I and H. Another embodiment for solving such a problem will be described below. In this embodiment, although only three patterns can be generated, patterning can be performed with respect to the fourth and subsequent peaks of a histogram. Figs. 18A and 18B are flow charts showing a procedure for determining threshold values. Since the processing in steps S10 to S40 are described above, a detailed description thereof will be omitted. In step S20 to S40, a peak, i.e., a maximum value, in a hue value histogram is detected. In addition, processing of detecting the range of the peak, i.e., a minimum value, is performed. When all the peaks to be detected, i.e., the maximum values, are detected by repeating this processing (step S60), the maximum value and minimum value detection processing is terminated, and it is checked whether the number of peaks is larger than three (step S61). If it is determined in step S61 that the number of peaks is larger than three, a counter N is initialized to "4" (step S62). The range of the peak on the left side of the Nth peak is compared with the range of the peak on the right side of the Nth peak (step S63). If the range of the peak on the left side is larger, the range of the peak on the right side and the range of the Nth peak are added together to form a new range (step S64). The counter N is then incremented by one (step S65). If there is the Nth peak, the flow advances to step S63 (step S66). If it is determined in step S63 that the range of the peak on the right side is larger, the range of the peak on the left side and the range of the Nth peak are added together to form a new range (step S67). The flow then advances to step S65. If it is determined in step S66 that no Nth peak is present, i.e., the processing of generating three range data from the range data of all the peaks is completed, threshold values on both sides (+ and - directions) of the first peak are respectively set in the window comparators 301 and 302 (step S68). Threshold values on both sides of the second peak are respectively set in the window comparators 303 and 304 (step S69). Threshold values on both sides of the third peak are respectively set in the window comparators 305 and 306 (step S70). With this operation, the processing is ended. This processing will be described with reference to Fig. 17. In processing of the range (K - L) of the fourth peak, the range width (B - C) of the first peak and the range width (H - I) of the third peak are compared with each other. Since the range width (B - C) is larger than the range width (H - I), the range width of the third peak is set to be the range between the positions C and I. That is, the threshold value at the position B is set in the window comparator 301; the threshold value at the position C, in the window comparator 302; the threshold value at the position E, in the window comparator 303; the threshold value at the position F, in the window comparator 304; the threshold value at the position K, in the window comparator 305; and the threshold value at the position 1, in the window comparator 306. Furthermore, referring to Fig. 17, the ranges between the positions B and H, and the positions C and I may be set as the first and second ranges, respectively, so that the color pattern between the positions L and K may be a synthetic pattern obtained by synthesizing the patterns between the positions B and C, and the positions H and I. As has been described above, according to the present invention, the original 100 is pre-scanned to form a hue value histogram, and threshold values are set at positions where accumulated hue values are small in the histogram. A histogram area between a pair of threshold values belongs to any one of the three color areas, i.e., the mountain-like R, G, and B hue value distribution areas. Therefore, color detection can be accurately and reliably performed to prevent a region with a single color, which is to be converted into one pattern, from being converted into a patterned area and a non-patterned area, and also prevent the worst error, i.e., the omission of color data. That is, the present invention can reproduce areas, of a color original, which have the same color, as an easy-to-see pattern having a single color. The present invention is not limited to a copying machine and can be applied to a reader, a printer, a facsimile apparatus, and the like. In addition, the present invention can be applied to not only patterning but also color conversion processing.

Claims: An image processing apparatus comprising: an image processing unit (102) for receiving a pixel color image signal representing an image, and for processing the color image signal so as to generate an output signal representing an image in which colored portions have been replaced by monochromatic patterns, and characterised in that the image processing unit (102) comprises detecting means (501) for detecting the color components of the color image signal by using hue components extracted from said colour image signal; the detecting means separating hue components of the color image signal into a histogram formed by a plurality of discrete hue values, and wherein at least three minima are detected in the histogram so formed with separate pairs of minima each enclosing a peak hue value, and converting the hue values lying between each said pair of minima into different monochromatic patterns. Apparatus according to claim 1, wherein said detecting means carries out smoothing on the hue values which make up said histogram. Apparatus according to claim 2, wherein the detecting means are adapted to detect the minima by detecting a slope value for each hue value and by matching slant patterns defined by the detected slope values so as to define said minima. Apparatus according to claim 3, wherein one pair of minima has been established, said detection means is adapted to repeat the process to obtain the second pair of minima. Apparatus according to any preceding claim, wherein color image signal is represented by an array of pixels in a main scanning direction and in a sub-scanning direction transverse to the main scanning direction; and wherein the detection means include means for selecting from the array one pixel per n x m pixels in said array, where n, m are both > 1 to provide a hue value.

Inventors: ABE YOSHINORI, ICHIKAWA HIROYUKI, ITO AKIO, MIYAKE SHOJI, ABE, YOSHINORI, ICHIKAWA, HIROYUKI, ITO, AKIO, MIYAKE, SHOJI, ABE, YOSHINORI, C/O CANON K.K., Ichikawa, Hiroyuki, c/o Canon K.K:, Ito, Akio, c/o Canon K.K., Miyake, Shoji, c/o Canon K.K.
Applicants: CANON KK, CANON KABUSHIKI KAISHA
Application year: 1993
Main classification: H04N1
IPC codes: H04N9, H04N1