1. Field of the Invention
The present invention relates to an image processing apparatus that detects luminance values of a background by analyzing a luminance histogram of an image, to a luminance correction method, and to a storage medium storing a program.
2. Description of the Related Art
A reading apparatus called a scanner is known that optically reads documents such as document originals and images such as photographs, and converts the read documents and images into electronic data. In general, when a document original has been read by the reading apparatus, a background does not have the maximum luminance (255 in the case of a color image of RGB channels each having 8 bits), thereby causing various problems. For example, if the read image is displayed on a display apparatus, a dynamic range of the image will decrease. Also, if the read image is printed by a printing apparatus such as a printer, the running cost will increase as coloring material is ejected for the background as well. Furthermore, if the read image is stored in a compressed state in a storage apparatus such as a hard disk drive, the compression ratio will be reduced as the background has signal values, thereby lowering the efficiency of memory use.
For the aforementioned reasons, background removal processing for removing the color of the background is generally applied to the read image. For example, as the background removal processing, a method is known for estimating the luminance values of the background from the result of analyzing the image, and converting luminance values that are equal to or larger than the estimated luminance values into the maximum luminance; in this method, it is important to appropriately estimate the luminance values of the background.
In Japanese Patent Laid-Open No. 09-167227, a luminance histogram of an image including a subject and a background is obtained. Then, the frequency corresponding to the maximum luminance value out of the frequencies representing local peaks is determined as an axis, the shape of a histogram defined by the axis and the substantially maximum luminance value is flipped toward the lower luminance side over the axis, and the resultant histogram is used as a histogram corresponding only to the background (the luminance distribution of the background). Japanese Patent Laid-Open No. 09-167227 takes advantage of the fact that the histogram corresponding only to the background shows distribution that is bilaterally symmetrical with respect to the luminance value corresponding to the peak frequency.
In Japanese Patent Laid-Open No. 2001-197308, a density tone histogram is generated for an image including a background, characters, and the like. Then, a peak tone value corresponding to a peak frequency is calculated, a first tone value corresponding to a predetermined frequency threshold on the lower tone side of the peak tone value is obtained, and a reference threshold (the end point of distribution corresponding to the background) is calculated by adding, to the peak tone value, a value of a difference between the peak tone value and the first tone value. Japanese Patent Laid-Open No. 2001-197308 also takes advantage of the fact that the histogram obtained from an image including only the background shows distribution that is bilaterally symmetrical with respect to the peak tone value. The luminance distribution of the background can be obtained by utilizing the aforementioned nature of the histogram of the background that shows bilaterally symmetrical distribution.
Although the luminance distribution of the background is bilaterally symmetrical with respect to the axis, i.e. the peak value, the luminance distribution of areas other than the background, which are formed by coloring material ejected onto the background, is not always bilaterally symmetrical with respect to the axis, i.e. the peak value depending on the amount of the coloring material and the way the coloring material is ejected.
Neither Japanese Patent Laid-Open No. 09-167227 nor Japanese Patent Laid-Open No. 2001-197308 takes into consideration the fact that, in the case where the luminance distributions of light colors are composited with the luminance distribution of the background in the vicinity of the lower luminance side of the luminance distribution of the background, the peak value of the composite distribution actually shifts toward the lower luminance side. For this reason, if the shape of the histogram of the composite distribution on the higher luminance side is flipped over the axis passing through the peak of the composite distribution, the edge of the resultant symmetry line on the lower luminance side has lower luminance than the edge B of the actual luminance distribution of the background. If the background removal processing is executed based on the detected edge of the luminance distribution of the background, light colors are unnecessarily removed. As light colors, in some cases, serve as information that has been intentionally added by a creator of a document original for distinction from the background, unnecessary removal of light colors leads to loss of such information.
An aspect of the present invention is to eliminate the above-mentioned problems with the conventional technology. The present invention provides an image forming apparatus that improves the accuracy of detection of a luminance range of a background, a luminance correction method, and a storage medium storing a program.
The present invention in its one aspect provides an image forming apparatus comprising: an image data acquisition unit configured to acquire image data by optically reading a document; a frequency distribution acquisition unit configured to acquire a frequency distribution of luminances from the image data acquired by the image data acquisition unit; a generation unit configured to generate a frequency distribution corresponding to a frequency distribution of luminances of a background of the document, by using a maximum frequency of the frequency distribution acquired by the frequency distribution acquisition unit as a maximum frequency of the frequency distribution of the luminances of the background of the document; a difference acquisition unit configured to acquire a difference between the frequency distribution of the luminances of the background of the document generated by the generation unit and the frequency distribution of the luminances acquired by the frequency distribution acquisition unit; and a correction unit configured to correct the frequency distribution of the luminances of the background of the document based on the difference acquired by the difference acquisition unit.
The present invention can improve the accuracy of detection of a luminance range of a background.
Further features of the present invention will become apparent from the following description of exemplary embodiments with reference to the attached drawings.
Preferred embodiments of the present invention will now be described hereinafter in detail, with reference to the accompanying drawings. It is to be understood that the following embodiments are not intended to limit the claims of the present invention, and that not all of the combinations of the aspects that are described according to the following embodiments are necessarily required with respect to the means to solve the problems according to the present invention. Note that like constituent elements will be denoted by like reference signs, and redundant descriptions thereof will not be given.
An amplifier (AMP) 404 amplifies an analog electrical signal output from the CIS unit 300. An A/D conversion unit 405 applies A/D conversion to the amplified analog electrical signal and outputs, for example, digital image data in which each pixel has 16-bit component for each color (hereinafter referred to as image data). An image processing unit 600 applies various types of image processing to the digital image data converted by the A/D conversion unit 405. An interface control unit 406 reads image data from the image processing unit 600 and transmits the read image data to an external apparatus 412 together with control data. Alternatively, the interface control unit 406 outputs image data from the image processing unit and image data from the external apparatus 412 to an image printing unit 700 together with control data. The external apparatus 412 is, for example, a general-purpose personal computer. The image printing unit 700 converts image data into binary data indicating “print” or “not print” on a per-pixel basis, and prints the image data on a printing medium by, for example, ejecting ink from a printing head. For example, an inkjet printer, a laser beam printer using an electrophotography method, or a sublimation printer is used as the image printing unit 700.
The operations for executing the functions of the MFP 100 are classified roughly into two types. One type is associated with the case where the MFP 100 executes its functions based on a user operation on the operation unit 4, and the other type is associated with the case where the MFP 100 executes its functions based on an instruction from the external apparatus 412.
The description will be continued below with reference to
In the case where the MFP 100 operates based on an instruction from the external apparatus 412, the CPU 409 first receives a copy instruction, a scan instruction, etc. from the external apparatus 412 in the form of a job and the like. Thereafter, in a manner similar to the above description, the CPU 409 reads the control program 670 stored in the ROM 410, and executes the control program 670 using the RAM 411 as a working area. An LED 414 shown in
Specifics of the image processing unit 600 will now be described.
The digital image data to which the pre-gamma conversion has been applied is input to a color correction processing unit 630. The color correction processing unit 630 applies color correction processing to the input digital image data so as to achieve appropriate colors. In the present embodiment, background removal processing is executed as a part of the color correction processing. Color correction data 631 stored in the ROM 410 is used by the color correction processing unit 630. The digital image data to which the color correction processing has been applied is input to a filter processing unit 640. The filter processing unit 640 applies filter processing, such as edge enhancement and noise reduction, to the digital image data. Filter data 641 stored in the ROM 410 is used in the filter processing.
The digital image data to which the filter processing has been applied is input to a post-gamma conversion unit 650. The post-gamma conversion unit 650 finely adjusts the luminance characteristics of the input digital image data again in accordance with the intended use. Post-gamma data 651 stored in the ROM 410 is used by the post-gamma conversion unit 650. The digital image data to which post-gamma conversion processing has been applied is output to the interface control unit 406.
The CPU 409 supplies the shading data 611, the pre-gamma data 612, the color correction data 631, the filter data 641, and the post-gamma data 651 from the ROM 410 to the shading correction unit 610 to the post-gamma conversion unit 650 in accordance with corresponding processing. In the case where an instruction for reading a complementary color has been issued, a primary-complementary conversion unit 660 shown in
Luminance value=R×0.3+G×0.6+B×0.1 Expression 1
Then, a luminance histogram showing the correspondence between the luminance and the frequency is generated, and a distribution line (frequency distribution) that smoothly represents changes in the frequency is further obtained via a moving average and the like. This distribution line is indicated by a bold line in
In step S702, peak point A is identified from the distribution line obtained in step S701, peak point A being on an upward convex curve closest to the maximum luminance and corresponding to the maximum frequency. That is to say, in the case the frequency distribution shows a plurality of upward convex curves, peak point A of a curve closest to the maximum luminance is identified. It should be noted that peak point A is a luminance point whose frequency is higher than the frequencies of neighboring luminance points on both sides.
Next, point B is identified from the aforementioned curve, point B being on the higher luminance side of peak point A and having a frequency larger than a preset frequency value. It should be noted that the preset frequency value refers to the lower limit of frequency values that are not considered as noise. Furthermore, point B, which is on the higher luminance side of peak point A, is also identified as a substantial maximum luminance point. In the case where noise and the like need not be taken into consideration, the maximum luminance point on the higher luminance side of peak point A may be directly identified as point B.
In step S703, a symmetrical distribution is generated by flipping a distribution line from point A to point B toward the lower luminance side over a central axis that is parallel to the axis representing frequency and passes through peak point A, and point C located at a position symmetrical to point B is obtained. The obtained point C is the minimum luminance point in the generated distribution. In
Subsequently, in step S704, a difference between the symmetry line 1 from point C to point A obtained in step S703 and the distribution line 2 from point D to point A is evaluated as a level of deviation (hereinafter referred to as a degree of deviation). In other words, a degree of deviation (%) of a line connecting point C, point A and point B from the distribution line is evaluated. The degree of deviation is calculated using the following Expression 2.
Here, i denotes luminances between the luminance of point C and the luminance of point A. Furthermore, X denotes the frequencies on the distribution line, and Y denotes the frequencies on the symmetry line from point C to point A obtained in step S703. That is to say, Expression 2 represents the accumulation of ratios of frequency differences to the frequencies corresponding to the luminances of the luminance distribution of the background generated in step S703.
In step S704, whether or not the degree of deviation calculated using Expression 2 is larger than a preset reference value. The processing moves to step S705 if the degree of deviation is larger than the preset reference value, and to step S707 if the degree of deviation is smaller than the preset reference value.
If the degree of deviation is larger than the preset reference value in step S704, it can be said that the luminance distributions of various light colors exist in the vicinity of the lower luminance side of the luminance distribution of the background of the printing medium. This is because it is considered that the distribution line has deviated from the symmetry line as a result of compositing such luminance distributions of light colors. Furthermore, it is considered that, due to the presence of such luminance distributions of various light colors, the peak value of the composite distribution obtained from the luminance distributions of light colors and the luminance distribution of the background has shifted toward the lower luminance side of the peak value of the luminance distribution of the background. Based on this idea, the luminance range between the luminance of point C and the luminance of point B is wider than the actual luminance range of the background, that is to say, the range from point E to point B, toward the lower luminance side. Therefore, in the present embodiment, if the calculated degree of deviation is large in step S704, it is determined that it is necessary to perform correction to shift the luminance of point C toward the higher luminance side in order to detect the actual luminance range of the background with high accuracy.
On the other hand, if the degree of deviation is smaller than the preset reference value in step S704, it can be said that the luminance distributions of other light colors do not exist in the vicinity of the lower luminance side of the luminance distribution of the background of the printing medium. Furthermore, as the luminance distributions of other light colors do not exist, it can be said that the peak value of the distribution line is equal to the peak value of the luminance distribution of the background. Based on this idea, the luminance range between the luminance of point C and the luminance of point B is equal to the actual luminance range of the background. Therefore, in the present embodiment, if the calculated degree of deviation is small in step S704, it is determined that the luminance of point C can be used as-is for the actual luminance range of the background.
In step S705, a luminance correction amount α for correcting the luminance of point C toward the higher luminance side is calculated. The luminance correction amount α is calculated using the following Expression 3.
α=maximum correction amount×(degree of deviation−reference value)/(maximum degree of deviation−reference value) Expression 3
Here, the maximum correction amount denotes the maximum value that the luminance correction amount α could take, for example, a luminance value of five, ten, and so on. The degree of deviation is a value calculated using Expression 2. The maximum degree of deviation is a value preset based on the degrees of deviation that were actually measured for a plurality of types of printing mediums, and is expressed as, for example, 60%. The maximum degree of deviation may be, for example, an average value of the degrees of deviation that were actually measured for the plurality of types of printing mediums. If the degree of deviation is larger than the maximum degree of deviation in the portion (degree of deviation−reference value)/(maximum degree of deviation−reference value) of Expression 3, the luminance correction amount α becomes larger than the maximum correction amount, thereby leading to overcorrection. Therefore, if the comparison between the calculated degree of deviation and the maximum degree of deviation shows that the degree of deviation is larger than the maximum degree of deviation, the degree of deviation may be considered to be equal to the maximum degree of deviation so as to prevent the luminance correction amount α from becoming larger than the maximum correction amount.
In step S706, the luminance correction amount α calculated using Expression 3 is added to the luminance of point C. Finally, in step S707, the background removal processing is executed based on the luminance of point C. The background removal processing in step S707 is the same as general background removal processing for removing the luminance distribution of luminances at or above a certain luminance value.
As described above, in the case where the background removal processing is executed, the present embodiment makes it possible to prevent unnecessary removal of the distribution of light colors that could serve as an information source. In the present embodiment, the luminance distribution of the background of the printing medium has been described as including the maximum luminance of the printed image. It should be noted that the same goes for the case where the luminance distribution of the background of the printing medium includes the minimum luminance of the printed image. One applicable example is the case where the background has a dark color. In this case, the luminance distribution shown in
In the first embodiment, the degree of deviation of the distribution line from point D to point A from the symmetry line from point C to point A is obtained under the assumption that the frequency differences corresponding to the luminances in the relevant luminance range have the same degree of reliability. The present embodiment differs from the first embodiment in that the degrees of reliability of the frequency differences vary depending on the luminances.
For example, the integrated value of the frequency differences between the symmetry line from point C to point A and the distribution line from point D to point A is the same in
In the present embodiment, the degree of deviation is calculated using the following Expression 4.
Here, i denotes luminances between the luminance of point C and the luminance of point A. Furthermore, X denotes the frequencies on the distribution line, and Y denotes the frequencies on the symmetry line from point C to point A obtained in step S703. In addition, a denotes the weight (degree of reliability) corresponding to each luminance, and the value of a increases as the luminance increases in the luminance range between point C to point A.
In the present embodiment, it is considered that, in the vicinity of peak point A, the influence on the luminance correction amount α is large even if the deviation of the distribution line from the symmetry line is minute. On the other hand, it is considered that, in the vicinity of point C, the influence on the luminance correction amount α is small even if the deviation of the distribution line from the symmetry line is significant. As a result, the luminance correction amount α can be calculated more correctly.
In the first and second embodiments, the degree of deviation from the symmetry line connecting point C, point A and point B is calculated based on the integrated value of the frequency differences from point C to point A. However, alternatively, it is possible to calculate the frequency difference between the distribution line and the symmetry line only at point C as the degree of deviation. Point C corrected by the luminance correction amount α can be used for purposes other than the background removal. For example, in separating image regions in the image, corrected point C may be used to determine the background and regions other than the background. Alternatively, in transmitting and receiving the image using a black-and-white facsimile machine, corrected point C may be used as a threshold for binarization.
Embodiments of the present invention can also be realized by a computer of a system or apparatus that reads out and executes computer executable instructions recorded on a storage medium (e.g., non-transitory computer-readable storage medium) to perform the functions of one or more of the above-described embodiment(s) of the present invention, and by a method performed by the computer of the system or apparatus by, for example, reading out and executing the computer executable instructions from the storage medium to perform the functions of one or more of the above-described embodiment(s). The computer may comprise one or more of a central processing unit (CPU), micro processing unit (MPU), or other circuitry, and may include a network of separate computers or separate computer processors. The computer executable instructions may be provided to the computer, for example, from a network or the storage medium. The storage medium may include, for example, one or more of a hard disk, a random-access memory (RAM), a read only memory (ROM), a storage of distributed computing systems, an optical disk (such as a compact disc (CD), digital versatile disc (DVD), or Blu-ray Disc (BD)™), a flash memory device, a memory card, and the like.
While the present invention has been described with reference to exemplary embodiments, it is to be understood that the invention is not limited to the disclosed exemplary embodiments. The scope of the following claims is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.
This application claims the benefit of Japanese Patent Application No. 2013-004050, filed Jan. 11, 2013, which is hereby incorporated by reference herein in its entirety.
Number | Date | Country | Kind |
---|---|---|---|
2013-004050 | Jan 2013 | JP | national |
Number | Name | Date | Kind |
---|---|---|---|
6009213 | Miyake | Dec 1999 | A |
6608926 | Suwa et al. | Aug 2003 | B1 |
6694051 | Yamazoe et al. | Feb 2004 | B1 |
6813386 | Noguchi et al. | Nov 2004 | B2 |
7006668 | Iguchi et al. | Feb 2006 | B2 |
7103214 | Kusakabe et al. | Sep 2006 | B2 |
7167205 | Akiyama et al. | Jan 2007 | B2 |
7177463 | Kusakabe et al. | Feb 2007 | B2 |
7432985 | Ishikawa et al. | Oct 2008 | B2 |
7433538 | Kusakabe et al. | Oct 2008 | B2 |
7634153 | Miyake et al. | Dec 2009 | B2 |
7738030 | Akiyama et al. | Jun 2010 | B2 |
7924469 | Ono et al. | Apr 2011 | B2 |
7944588 | Yamada et al. | May 2011 | B2 |
8023764 | Miyake et al. | Sep 2011 | B2 |
8175155 | Suwa et al. | May 2012 | B2 |
8237991 | Ono et al. | Aug 2012 | B2 |
8306357 | Miyake et al. | Nov 2012 | B2 |
8600154 | Umeda et al. | Dec 2013 | B2 |
8675249 | Umeda et al. | Mar 2014 | B2 |
20010007596 | Noguchi et al. | Jul 2001 | A1 |
20130028537 | Miyake et al. | Jan 2013 | A1 |
20140010415 | Kunieda et al. | Jan 2014 | A1 |
20140010442 | Kato et al. | Jan 2014 | A1 |
20140010450 | Suwa et al. | Jan 2014 | A1 |
20140010451 | Sumi et al. | Jan 2014 | A1 |
20140013213 | Kajiwara et al. | Jan 2014 | A1 |
20140037208 | Umeda et al. | Feb 2014 | A1 |
20140044354 | Umeda et al. | Feb 2014 | A1 |
Number | Date | Country |
---|---|---|
09-167227 | Jun 1997 | JP |
2001-197308 | Jul 2001 | JP |
Entry |
---|
Machine translation of JP-H09-167227, published Jun. 1997 by Kurosu. |
Number | Date | Country | |
---|---|---|---|
20140198354 A1 | Jul 2014 | US |