Color calibration method and image processing device using the same

A color calibration method and an image processing device using the same are provided. The method includes: obtaining a first image of a calibration card having color blocks, each of which corresponds to a standard value; obtaining first sensing values according to the first image, wherein each of the first sensing values corresponds to one of the standard values; generating a calibration table according to the first sensing values and the standard values; determining if a recursive condition is satisfied. The method also includes: obtaining a second image of the calibration card if the recursive condition is not satisfied; obtaining second sensing values according to the second image; adjusting the second sensing values according to the calibration table to generate third sensing values; updating the calibration table according to the third sensing values and the standard values until the recursive condition is satisfied. Accordingly, the calibration table is generated automatically.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims the priority benefit of Taiwan application serial no. 101129559, filed on Aug. 15, 2012. The entirety of the above-mentioned patent application is hereby incorporated by reference herein and made a part of this specification.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The invention relates to a color calibration method and an image processing device using the same.

2. Background of the Invention

Generally, when a scanner captures an image of an object, the actual luminance of the object may not be the same as the luminance of the object in the captured image. There may be nonlinear distortion between the actual luminance of the object and the luminance of the object in the captured image, and the distortion may be expressed by formula (1) below.
Y∝Xγ(1)

Here, X denotes the actual luminance of the object, Y denotes the luminance of the object in the image, and γ is a parameter. Due to the nonlinear distortion that occurs at the time of capturing the image, the scanner may perform gamma correction on luminance or chrominance of an image after capturing the image, so as to remove the nonlinear distortion. The gamma correction refers to nonlinear compensation of an error in the image, such that the luminance of the object may have a linear relationship with the luminance of the corrected image. Gamma correction may be expressed by formula (2) below.
Y′∝Y1/γ(2)

Here, Y′ denotes the luminance after gamma correction, and γ is a parameter that is applied during gamma correction. After a calculation is made according to the formula (2), Y′ may have a linear relationship with X.

To accomplish the gamma correction, an analog method or a digital method is often applied. In the analog method, a nonlinear electronic circuit is employed to generate a result that is similar to the calculation result of the formula (2).

In the digital method, an exponential calculation is directly made according to the formula (2). However, the exponential calculation may not be instantaneously performed on certain devices, and therefore pre-calculated input and output results may be stored in a lookup table. When the gamma correction is to be performed, the adjusted luminance may be obtained by looking up the lookup table.

It is rather efficient to merely apply one γ to different scanners, whereas the numerical value of one γ may not be applicable to all of the scanners. If γ corresponding to each scanner is manually generated, a significant amount of time will be required. Therefore, how to automatically generate γ draws attention of researchers in the pertinent field.

SUMMARY OF THE INVENTION

An embodiment of the invention is directed to a color calibration method and an image processing device for automatically generating a calibration table.

In an embodiment of the invention, a color calibration method for an image processing device is provided. The color calibration method includes: obtaining a first image of a calibration card, wherein the calibration card has a plurality of color blocks, and each of the color blocks corresponds to a standard value; obtaining a plurality of first sensing values according to the first image, wherein each of the first sensing values corresponds to one of the standard values; generating a calibration table according to the first sensing values and the standard values; determining if a recursive condition is satisfied. The color calibration method also includes: obtaining a second image of the calibration card if the recursive condition is not satisfied, obtaining a plurality of second sensing values according to the second image, adjusting the second sensing values according to the calibration table to generate a plurality of third sensing values, and updating the calibration table according to the third sensing values and the standard values until the recursive condition is satisfied.

From another perspective, in an embodiment of the invention, an image processing device that includes an image capturing unit and a processor is provided. The image capturing unit is configured for obtaining a first image of a calibration card. The calibration card includes a plurality of color blocks, and each of the color blocks corresponds to a standard value. The processor is coupled to the image capturing unit for obtaining a plurality of first sensing values according to the first image, and each of the first sensing values corresponds to one of the standard values. Here, wherein the processor is configured to generate a calibration table according to the first sensing values and the standard values and determine if a recursive condition is satisfied. If the recursive condition is not satisfied, the processor is also configured to obtain a second image of the calibration card, obtain a plurality of second sensing values according to the second image, adjust the second sensing values according to the calibration table to generate a plurality of third sensing values, and update the calibration table according to the third sensing values and the standard values until the recursive condition is satisfied.

In light of the foregoing, the color calibration method and the image processing device described in the embodiments of the invention are provided for automatically generating a calibration table and updating the calibration table in a recursive manner.

Several exemplary embodiments accompanied with figures are described in detail below to further explain the invention.

DETAILED DESCRIPTION OF DISCLOSED EXEMPLARY EMBODIMENTS

First Embodiment

FIG. 1is a block diagram illustrating an image processing apparatus according to an embodiment of the invention.

With reference toFIG. 1, the image processing device100includes an image capturing unit110, a processor120, and a memory130. For instance, the image processing device100may be implemented in form of a scanner, a digital camera, a digital camcorder, a computer, or a server.

The image capturing unit110serves to obtain one or a plurality of images. For instance, the image capturing unit110includes a lens and a plurality of photosensitive devices. Charges on one photosensitive device form one color value, and one or more color values may constitute one pixel. However, in another embodiment of the invention, the image capturing unit110may be implemented in form of a communication interface for obtaining images from other devices, which should not be construed as a limitation to the invention.

The processor120serves to execute one or more program codes to correct color values in one image. For instance, the processor120may be a central processing unit (CPU) or an embedded microcontroller.

The memory130serves to store a program code or an image. In the present embodiment, the memory130stores a color calibration system132. The color calibration system132includes a plurality of modules, each of which achieves a specific function. The processor120executes each of the modules in the color calibration system132.

FIG. 2is a schematic diagram illustrating a color calibration system according to an embodiment of the invention.

With reference toFIG. 2, the color calibration system132includes a capturing module210, a calibration module220, and a recursive module230.

The processor120executes the capturing module210, so as to control the image capturing unit110and obtain one or more images. Besides, the processor120executes the calibration module220to generate a calibration table according to the image obtained by the processor120. The processor120further executes the recursive module to determine if a recursive condition is satisfied. If the recursive condition is not satisfied, the processor120continues to obtain another image through the capturing module210and updates the calibration table according to the image through the calibration module220. Here, the operations of the capturing module210, the calibration module220, and the recursive module230are performed by the processor120and will not be further described hereinafter.

FIG. 3AandFIG. 3Bare schematic diagrams illustrating a calibration card according to an embodiment of the invention.

With reference toFIG. 3AandFIG. 3B, the calibration card300includes a plurality of color blocks310(1) to310(A). The color in one of the color blocks310(1) to310(A) remains unchanged, and each of the color blocks310(1) to310(A) corresponds to a standard value. For instance, the color block310(1) corresponds to the standard value “0”, the color block310(2) corresponds to the standard value “11”, and so on. The calibration card300serves to provide the standard color blocks310(1) to310(A), such that the image processing device100may generate the calibration table according to the color blocks310(1) to310(A) and the corresponding standard values.

In the present embodiment, each standard value represents a numerical value of luminance. However, in another embodiment, each standard value may represent a numerical value of chrominance (e.g., red, green, or blue). Alternatively, each block may correspond to another standard value, which should not be construed as a limitation to the invention.

To generate the calibration table, the capturing module210obtains an image from the calibration card300and obtains a plurality of sensing values (also referred to as “first sensing values”) according to the image. For instance, the capturing module210obtains color values of pixels in a region of the image corresponding to the color block310(1). The capturing module210calculates an average of the color values and considers the average color value as the sensing value “2” of the corresponding color block310(1). Similarly, the capturing module210obtains color values of pixels in a region of the image corresponding to the color block310(2), calculates the average of the color values, and considers the average color value as the sensing value “4” of the corresponding color block310(2). The rest may be analogically deduced from the above.

Nonetheless, due to some hardware errors or noises, the sensing value and the standard value corresponding to the same color block may not be the same. For instance, both the sensing value “2” and the standard value “0” correspond to the same color block310(1), while there is a difference of 2 between the two values; both the sensing value “4” and the standard value “11” correspond to the same color block310(2), while there is a difference of 7 between the two values. The calibration module220may generate the calibration table according to the sensing values and the standard values shown inFIG. 3B.

FIG. 4andFIG. 5are schematic diagrams of establishing a calibration table according to an embodiment of the invention.

With reference toFIG. 4, the calibration table400includes a plurality of output values 410(0) to 410(255), and each of the output values 410(0) to 410(255) respectively corresponds to one of the indexes 420(0) to 420(255). When a numerical value is input, the calibration module220considers the numeral value as an index of the calibration table400and outputs a corresponding output value. For instance, if the input numerical value is “2”, the input numerical value is considered as the index 420(2), and the corresponding output value 410(2) is then output.

When the calibration table400is established, the calibration module220sets part of the indexes 420(0) to 420(255) as the sensing values shown inFIG. 3Band sets some of the output values 410(0) to 410(255) corresponding to the sensing values as the standard values. For instance, the standard value “0” corresponds to the sensing value “2”; therefore, the calibration module220sets the index 420(2) as the sensing value “2” and sets the output value 410(2) as the standard value “0”. The standard value “11” corresponds to the sensing value “4”; therefore, the calibration module220sets the index 420(4) as the sensing value “4” and sets the output value 410(4) corresponding to the sensing value “4” as the standard value “11”. The standard value “22” corresponds to the sensing value “5”; therefore, the calibration module220sets the index 420(5) as the sensing value “5” and sets the output value 410(5) as the standard value “22”. In the present embodiment, there are 24 standard values, and therefore there are only 24 output values (e.g., the output values 410(2), 410(4), 410(5), and 410(204)) are set as the corresponding standard values. The calibration module220also generates the output values that do not correspond to the sensing values. Specifically, the calibration module220obtains the minimum sensing value (i.e., the sensing value “2”) and the maximum sensing value (i.e., the sensing value “204”) from the sensing values. Besides, the calibration module220sets the output values 410(0) and 410(1) corresponding to the indexes 420(0) and 420(1) less than the minimum sensing value as a first preset value. The calibration module220also sets the output values 410(205) to 410(255) corresponding to the indexes 420(205) to 420(255) greater than the maximum sensing value as a second preset value. Moreover, the calibration module220generates the rest of output values (e.g., the output value 410(3)) through an interpolation algorithm.

With reference toFIG. 5, the calibration module220sets the first preset value as 0 and the second preset value as 255. That is, the output values 410(0) and 410(1) are setd as “0”, and the output values 410(205) to 410(255) are setd as “255”. According the output values 410(2) and 410(4), the calibration module220generates the output value 410(3) through an interpolation algorithm. For instance, the calibration module220calculates an average of the output values 410(2) and 410(4) to generate the output value 410(3).

However, in another embodiment of the invention, the calibration module220may perform the interpolation algorithm through a low-pass filter. Alternatively, the calibration module220may generate an exponential function or a polynomial function according to the output values 410(2), 410(4), 410(5), 410(204), and so on. According to the generated function, the calibration module220may calculate the output value 410(3), which should not be construed as a limitation to the invention. In addition, when a color value of a pixel is represented by more number of bits (i.e., greater than 8 bits), the calibration table400may include more indexes and more output values, and the first preset value and the second preset value may be configured as different numerical values, which should not be construed as a limitation to the invention.

After the calibration table400is generated, the recursive module230determines if a recursive condition is satisfied. If the recursive condition is satisfied, the calibration module220outputs the calibration table400. Thereafter, when the capturing module210obtains an image, the calibration module220may adjust the color values of pixels in the image according to the calibration table400. However, if the recursive condition is not satisfied, the calibration module220continues to update the calibration table400until the recursive condition is satisfied.

In process of updating the calibration table400, the capturing module210obtains another image (i.e., the second image) from the calibration card300and obtains a plurality of sensing values (also referred to as “second sensing values”) according to the image. The calibration module220adjusts the second sensing values according to the current calibration table400, so as to generate a plurality of sensing values (also referred to as “third sensing values”). Based on the standard values and the third sensing values, the calibration module220updates the calibration table400until the recursive module230determines that the recursive condition is satisfied.

FIG. 6toFIG. 9are schematic diagrams of updating a calibration table according to an embodiment of the invention.

With reference toFIG. 6, the second sensing values which are obtained by the capturing module210and correspond to the color blocks310(1) to310(3) and310(A) are “0”, “3”, “5”, . . . , and “204”. The calibration module220adjusts the second sensing values according to the calibration table400, so as to generate the third sensing values “0”, “6”, “22”, . . . , and “255”. For instance, the calibration module220considers “3” as the index of the calibration table400to generate the output value “6”, and the calibration module220considers “5” as the index of the calibration table400to generate the output value “22”. Note that the capturing module210may not be able to obtain the same sensing values corresponding to the same color block at different times. For instance, the capturing module210obtains the sensing value “4” (as shown inFIG. 3B) corresponding to the color block310(2) at the first time but obtains the sensing value “3” corresponding to the same color block310(2) at the second time.

The calibration module220may establish a temporary calibration table according to the aforesaid process of establishing the calibration table400. In particular, the calibration module220sets some of the indexes in the temporary calibration table as the third sensing values, sets the output values corresponding to the third sensing values as the standard values, and generates the output values not corresponding to the third sensing values.

With reference toFIG. 7, the temporary calibration table700includes a plurality of output values 710(0) to 710(255), and each of the output values 710(0) to 710(255) respectively corresponds to one of the indexes 720(0) to 720(255). The calibration module220sets the indexes 720(0), 720(6), and 720(22) as the third sensing values “0”, “6”, “22”, and “255”. The output values 710(0), 710(6), 710(22), and 710(255) are correspondingly set as the standard values “0”, “11”, “22”, and “255”.

With reference toFIG. 8, the calibration module220calculates the output values 710(1) to 710(5) and 710(11) not corresponding to the third sensing values according to an interpolation algorithm. For instance, the calibration module220generates the output value 710(11) (i.e. numerical value “14”) through the linear interpolation.

The calibration module220combines the temporary calibration table700with the calibration table400, so as to update the calibration table400. In particular, if the calibration table400includes a second index, and the second index corresponds to a second output value in the calibration table400, the calibration module220takes the second output value as the index of the temporary calibration table700, so as to obtain a fourth output value in the temporary calibration table700. The calibration module220then replaces the second output value with the fourth output value. For instance, as shown inFIG. 4andFIG. 8, the index 420(4) corresponds to the output value 410(4) (i.e. numerical value “11”). The calibration module220takes “11” as the index 720(11) of the temporary calibration table700and obtains the output value 710(11) (i.e. numerical value “14”). The calibration module220then sets the output value 410(4) as the output value 710(11), as shown inFIG. 9.

Here, Mnrepresents the calibration table400when the calibration table400is updated for the nthtime, and n is a positive integer. mn,0represents the 0thoutput value 410(0) in the calibration table400when the calibration table400is updated for the nthtime, and the rest may be analogically deduced from the above. Gnrepresents the temporary calibration table700generated when the calibration table400is updated for the nthtime, gn,0represents the 0thoutput value 710(0) when the calibration table400is updated for the nthtime, and the rest may be analogically deduced from the above. The step of combining the calibration table400with the temporary calibration table700may be represented by the following formulas (5) to (7).
Mn+1={mn+1,0,mn+1,1, . . . ,mn+1,255}  (5)
mn+1,j=gn,t(6)
t=mn,j(7)

That is, the jthoutput value mn,jin the calibration table400when the calibration table400is updated for the nthtime may be taken as the index t. The calibration module220may, according to the index t, find the output value gn,tof the temporary calibration table700. The output value gn,tmay be considered as the jthoutput value mn+1,jin the calibration table400when the calibration table400is updated for the (n+1)thtime.

The step of updating the calibration table400is repeated until the recursive module230determines that the recursive condition is satisfied. In an embodiment of the invention, the recursive module230determines if a recursive number matches a recursive threshold value; if yes, the recursive module230determines that the recursive condition is satisfied. The recursive number is updated as long as the calibration table400is updated. For instance, the default recursive number is 0, the recursive number is increased by 1 as long as the calibration table400is updated, and the recursive threshold value is 3. When the recursive number is greater than or equal to 3, the recursive module230determines that the recursive number matches the recursive threshold value. That is, as long as the calibration table300is updated three times, the recursive condition is deemed satisfied. However, in another embodiment, the default recursive number is 3, the recursive number is decreased by 1 as long as the calibration table400is updated, and the recursive threshold value is 0. As long as the recursive number is smaller than or equal to 0, the recursive module230determines that the recursive number matches the recursive threshold value. Note that the recursive threshold value may be set as 5, 10, and so on, which should not be construed as a limitation to the invention.

According to an embodiment of the invention, after the calibration table400is generated or updated, the recursive module230calculates a difference between the sensing values and the standard values. If the difference is less than a difference threshold, the recursive module230determines that the recursive condition is satisfied. For instance, the recursive module230calculates the difference according to the following formula (8):

Here, Rnrepresents the difference when the calibration table400is updated for the nthtime, j and k are integers, k represents the number of color blocks in the calibration card300, in,jrepresents the sensing value corresponding to the jthcolor block when the calibration table400is updated for the nthtime, and Sjrepresents the standard value corresponding to the jthcolor block. It should be mentioned that i1,jis not adjusted according to the calibration table in process of calculating R1(i.e., i1,jis the first sensing value). In process of calculating R2, i2,jis adjusted according to the calibration table M1(i.e., i2,jis the third sensing value rather than the second sensing value). After the calibration table Mnis generated, the recursive module230performs the calculation and determines if the difference Rnis less than a difference threshold. If the difference Rnis less than the difference threshold, the recursive module230determines that the recursive condition is satisfied and outputs the calibration table Mn.

The sum of squared error is calculated by applying the formula (8). However, in other embodiments of the invention, the difference may also be calculated by the recursive module230through calculating a mean squared error or a sum of absolute error, which should not be construed as a limitation to the invention.

In the present embodiment, the recursive module230determines that the recursive condition is satisfied when the difference is less than the difference threshold or when the recursive number matches the recursive threshold value. However, in other embodiments, the recursive module230may determine that the recursive condition is satisfied when the difference is less than the difference threshold and when the recursive number matches the recursive threshold value.

FIG. 10is a flowchart illustrating a color calibration method according to an embodiment of the invention.

With reference toFIG. 10, in step S1002, a capturing module210obtains a first image of a calibration card. The calibration card includes a plurality of color blocks, and each of the color blocks corresponds to a standard value.

In step S1004, the capturing module210obtains a plurality of first sensing values according to the first image, and each of the first sensing values corresponds to one of the standard values.

In step S1006, the calibration module220generates a calibration table according to the first sensing values and the standard values.

In step S1008, the recursive module230determines if a recursive condition is satisfied. If yes, said process is completed.

If the recursive condition is not satisfied, in step S1010, the capturing module210obtains a second image of the calibration card and obtains a plurality of second sensing values according to the second image. In step S1012, the calibration module220adjusts the second sensing values according to the calibration table, so as to generate a plurality of third sensing values. In step S1014, the calibration module220updates the calibration table according to the third sensing values and the standard values.

Each step shown inFIG. 10is already elaborated above and thus will not be further explained hereinafter.

Second Embodiment

The second embodiment is similar to the first embodiment, and thus only the difference between these two exemplary embodiments is described herein. According to the first embodiment, when the capturing module210obtains the sensing values at the first time, the calibration module220does not adjust the sensing values according to the calibration table. By contrast, according to the second embodiment, as long as the capturing module210obtains the sensing values, the calibration module220adjusts the sensing values according to the calibration table.

FIG. 11is a flowchart illustrating a color calibration method according to a second embodiment of the invention.

With reference toFIG. 11, in step S1102, the calibration module220and the recursive module230execute an initialization program. The calibration module220sets a default calibration table, and each output value in the default calibration table is equal to the corresponding index. That is, in the second embodiment, m1,ishown in the formula (3) is equal to i. The recursive module230also sets a recursive threshold value and a difference threshold.

In step S1104, the capturing module210obtains an image from the calibration card300and obtains a plurality of sensing values according to the image.

In step S1106, the calibration module220adjusts the sensing values according to the calibration table. Since the output value in the calibration table is equal to the corresponding index when the step S1106is performed for the first time, the adjusted sensing value is the same as the sensing value prior to adjustment.

In step S1108, the recursive module230calculates the difference according to the standard values and the adjusted sensing values. Namely, in the second embodiment, each sensing value in,jin the formula (8) is adjusted by the calibration module220according to the calibration table.

In step S1110, the recursive module230determines if a recursive condition is satisfied. In the second embodiment, the recursive module230determines that the recursive condition is satisfied when the difference is less than the difference threshold or when the recursive number matches the recursive threshold value. If the recursive condition is satisfied, the process shown inFIG. 11is completed.

However, if the recursive condition is not satisfied, in step S1112, the calibration module220generates a temporary calibration table according to the standard values and the adjusted sensing values. When the step S1112is performed for the first time, since the adjusted sensing value is equal to the sensing value prior to adjustment, the generated temporary calibration table is equal to the calibration table first generated in the first embodiment (as shown inFIG. 5).

In step S1114, the calibration module220combines the temporary calibration table with the calibration table and returns to the step S1104. Note that the combined calibration table is the same as the temporary calibration table when the step S1114is performed for the first time. In particular, the formulas (6) and (7) may be re-written as formulas (9) and (10) below.
t=m1,j=j(9)
m2,j=g1,t=g1,j(10)

To sum up, according to the color calibration method and the image processing device described herein, the calibration table may be generated in a recursive manner. Hence, the difference between the sensing values and the standard values may be gradually lessened and converged.