JP2007272878A - Image processing program and image processing device - Google Patents

Image processing program and image processing device Download PDF

Info

Publication number
JP2007272878A
JP2007272878A JP2007056555A JP2007056555A JP2007272878A JP 2007272878 A JP2007272878 A JP 2007272878A JP 2007056555 A JP2007056555 A JP 2007056555A JP 2007056555 A JP2007056555 A JP 2007056555A JP 2007272878 A JP2007272878 A JP 2007272878A
Authority
JP
Japan
Prior art keywords
image
pixel
reduced
value
retinex
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2007056555A
Other languages
Japanese (ja)
Other versions
JP4687667B2 (en
Inventor
Masashi Kuno
雅司 久野
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Brother Industries Ltd
Original Assignee
Brother Industries Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Brother Industries Ltd filed Critical Brother Industries Ltd
Priority to JP2007056555A priority Critical patent/JP4687667B2/en
Publication of JP2007272878A publication Critical patent/JP2007272878A/en
Application granted granted Critical
Publication of JP4687667B2 publication Critical patent/JP4687667B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Processing (AREA)
  • Facsimile Image Signal Circuits (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide an image processing program and an image processing device capable of carrying out Retinex processing at high speed. <P>SOLUTION: A peripheral average luminance image obtaining peripheral average luminance on each pixel of a reduced image is obtained. This processing is computed by carrying out convolution of a coefficient of a filer prepared using a Gaussian function, and the values of peripheral pixels. The filter coefficient is expressed by F(x, y), and the convolution is expressed by F(x, y)*I(x, y). A reduced Retinex image is then formed of the peripheral average luminance image formed by the convolution, and the reduced image obtained by reducing an original image. The thus formed reduced Retinex image is enlarged and normalized to form an output image using the value of the original image. <P>COPYRIGHT: (C)2008,JPO&INPIT

Description

本発明は、画像処理プログラムおよび画像処理装置に関し、特にレティネックス処理を高速化することができる画像処理プログラムおよび画像処理装置に関するものである。   The present invention relates to an image processing program and an image processing apparatus, and more particularly to an image processing program and an image processing apparatus that can speed up Retinex processing.

逆光条件下で被写体が撮像された場合、被写体部分の画像は、詳細な態様が判別困難となるほど明度やコントラストの低い不明瞭な逆光画像となる。かかる逆光画像のみならず、露光の過不足や、撮像時のぶれやぼけ、ノイズ、光量不足などによる劣悪な画像を、画像処理によって明度やコントラストを向上させて画質を改良することが行われている。かかる画像処理の1手法として、レティネックス処理(Retinex処理)が知られている。   When a subject is imaged under backlight conditions, the image of the subject portion becomes an unclear backlight image with low brightness and contrast as the detailed mode becomes difficult to distinguish. In addition to such backlit images, poor images due to overexposure and underexposure, blurring and blurring during shooting, noise, insufficient light quantity, etc. are being used to improve image quality by improving brightness and contrast through image processing. Yes. As one method of such image processing, Retinex processing (Retinex processing) is known.

レティネックス処理は、高画質部分については入力画像データを保持し、主に低画質部分の画質改良を行うものである。このレティネックス処理では、ガウスフィルタにより、元の画像の各画素データを周辺画素の画素データを反映させた値に補正し、その補正された画素データの自然対数から元の画像のリファレンス成分データを算出し、元画像の画素成分で元の画像の画素データを除してイルミナンス成分データを算出する。つまり、元の画像を、リファレンス成分とイルミナンス成分との2の構成成分に分けるのである。そして、イルミナンス成分に対してガンマ補正等の明度や階調(コントラスト)を補正する処理を行った後、その補正されたイルミナンス成分と、リファレンス成分とを合成することにより、元の画像に対し逆光画像部分などの低画質部分の画質が改良された画像データを生成することができる。   In the Retinex process, the input image data is held for the high-quality part, and the image quality is mainly improved for the low-quality part. In this Retinex processing, each pixel data of the original image is corrected to a value reflecting the pixel data of the surrounding pixels by a Gaussian filter, and the reference component data of the original image is obtained from the natural logarithm of the corrected pixel data. The illuminance component data is calculated by dividing the pixel data of the original image by the pixel component of the original image. That is, the original image is divided into two constituent components, a reference component and an illuminance component. Then, after performing processing for correcting the brightness and gradation (contrast) such as gamma correction for the illuminance component, the corrected illuminance component and the reference component are combined, and the original image is backlit. Image data in which the image quality of a low image quality portion such as an image portion is improved can be generated.

特許3731577号(特許文献1)には、このレティネックス処理の処理速度を高速にする方法が開示されている。この方法は、図7に示すように、元画像を平均画素法などの方法により縮小画像(解像度が低い)を形成し、その縮小画像の各画素について周辺平均輝度を求めた周辺平均輝度画像(ボケ画像)を形成し、そのボケ画像を拡大した拡大ボケ画像と元画像とからレティネックス処理画像を形成し、更に、そのレティネックス処理画像と元画像とから出力画像を形成している。   Japanese Patent No. 3731577 (Patent Document 1) discloses a method for increasing the processing speed of the Retinex processing. As shown in FIG. 7, this method forms a reduced image (low resolution) from the original image by a method such as an average pixel method, and calculates a peripheral average luminance image (peripheral average luminance) for each pixel of the reduced image ( A blurred image), an enlarged blurred image obtained by enlarging the blurred image, and an original image to form a Retinex processed image, and further, an output image is formed from the Retinex processed image and the original image.

図7において、横方向の座標をx、縦方向の座標をyとし、元画像および縮小画像の画素の値(濃度値)をI(x、y)で表している。縮小画像からボケ画像を形成する場合は、フィルタの係数をF(x,y)として、畳み込み演算(コンボリューション)が行われる。次式は、その畳み込み演算を表す。
F(x、y)*I(x,y)
また、レティネックス処理画像をR(x,y)、出力画像をOut(x,y)で表している。
特許3731577号公報
In FIG. 7, the horizontal coordinate is x, the vertical coordinate is y, and the pixel values (density values) of the original image and the reduced image are represented by I (x, y). When a blurred image is formed from a reduced image, a convolution operation (convolution) is performed with the filter coefficient set to F (x, y). The following expression represents the convolution operation.
F (x, y) * I (x, y)
The Retinex processed image is represented by R (x, y), and the output image is represented by Out (x, y).
Japanese Patent No. 3731577

しかしながら、特許文献1に開示された発明では、拡大したボケ画像と元画像とからレティネックス処理画像を求めるために、対数演算を多く行わなければならず、演算に時間がかかるという問題点があった。また、出力画像を形成する際には、正規化を行うためにレティネックス処理画像(R(x,y))を一時記憶するメモリが必要である。正規化を行うためには、レティネックス処理画像の画素が取る値の最大値および最小値を抽出し、その抽出された最大値と最小値とを範囲とする各値の画素の頻度を集計したヒストグラムを作成して上位および下位の値をクリッピングする。したがって、レティネックス処理画像を一時記憶しなければならず、そのメモリの容量が大きくなるという欠点もあった。   However, in the invention disclosed in Patent Document 1, in order to obtain a Retinex-processed image from an enlarged blurred image and an original image, a large number of logarithmic operations must be performed, which requires a long time for the calculation. It was. Further, when forming the output image, a memory for temporarily storing the Retinex processed image (R (x, y)) is necessary for normalization. In order to perform normalization, the maximum value and the minimum value of the values taken by the pixels of the Retinex processed image are extracted, and the frequencies of the pixels of each value in the range of the extracted maximum value and minimum value are aggregated. Create a histogram to clip upper and lower values. Therefore, the Retinex processed image has to be temporarily stored, and there is a disadvantage that the capacity of the memory becomes large.

本発明は、上記問題点を解決するためになされたものであり、レティネックス処理を高速化することができる画像処理プログラムおよび画像処理装置を提供することを目的としている。   SUMMARY An advantage of some aspects of the invention is that it provides an image processing program and an image processing apparatus capable of speeding up the Retinex process.

この目的を達成するために、請求項1記載の画像処理プログラムは、レティネックス処理をコンピュータにより実行させるものであり、元画像の周辺平均輝度画像を形成する周辺平均輝度画像形成ステップと、その周辺平均輝度画像形成ステップにより形成された周辺平均輝度画像と元画像とに基づいて元画像のサイズより小さい画像サイズの縮小レティネックス画像を形成する縮小レティネックス画像形成ステップと、その縮小レティネックス画像形成ステップにより形成された縮小レティネックス画像を拡大する拡大処理ステップと、その拡大処理ステップにより拡大された画像情報と、元画像とに基づいて出力画像を形成する出力画像形成ステップとを備えている。   In order to achieve this object, an image processing program according to claim 1 causes a Retinex process to be executed by a computer, a peripheral average luminance image forming step for forming a peripheral average luminance image of an original image, and a periphery thereof A reduced Retinex image forming step for forming a reduced Retinex image having an image size smaller than the size of the original image based on the peripheral average luminance image formed by the average luminance image forming step and the original image, and the reduced Retinex image formation An enlargement processing step for enlarging the reduced Retinex image formed by the steps, an output image formation step for forming an output image based on the image information enlarged by the enlargement processing step, and the original image.

請求項2記載の画像処理プログラムは、請求項1記載の画像処理プログラムにおいて、前記周辺平均輝度画像形成ステップは、元画像より画像サイズが小さい縮小画像を形成し、その縮小画像の周辺平均輝度画像を形成する縮小周辺平均輝度画像形成ステップを備え、前記縮小レティネックス画像形成ステップは、前記縮小周辺平均輝度画像形成ステップにより形成された縮小周辺平均輝度画像と縮小画像とに基づいて縮小レティネックス画像を形成する。   The image processing program according to claim 2 is the image processing program according to claim 1, wherein the peripheral average luminance image forming step forms a reduced image having an image size smaller than the original image, and the peripheral average luminance image of the reduced image. A reduced peripheral average luminance image forming step, wherein the reduced Retinex image forming step is based on the reduced peripheral average luminance image and the reduced image formed by the reduced peripheral average luminance image forming step. Form.

請求項3記載の画像処理プログラムは、請求項2記載の画像処理プログラムにおいて、前記縮小周辺平均輝度画像形成ステップは、元画像から縮小画像を形成するために最近傍(Nearest Neighbor)法により画素を抽出するサンプリングステップと、そのサンプリングステップにより抽出された画素の値とフィルタ係数との畳み込み演算を行う演算ステップとを備えている。   The image processing program according to claim 3 is the image processing program according to claim 2, wherein the reduced peripheral average luminance image forming step is configured to generate pixels by a nearest neighbor method in order to form a reduced image from the original image. A sampling step for extraction and a calculation step for performing a convolution operation between the pixel value extracted by the sampling step and the filter coefficient are provided.

請求項4記載の画像処理プログラムは、請求項2記載の画像処理プログラムにおいて、前記縮小周辺平均輝度画像形成ステップは、元画像を平均画素法により縮小する画像縮小ステップと、その縮小ステップにより縮小された画像の画素とフィルタ係数との畳み込み演算を行う演算ステップとを備えている。   The image processing program according to claim 4 is the image processing program according to claim 2, wherein the reduced peripheral average luminance image forming step is reduced by an image reduction step of reducing the original image by an average pixel method and a reduction step thereof. And a calculation step for performing a convolution calculation between the pixel of the image and the filter coefficient.

請求項5記載の画像処理プログラムは、請求項1記載の画像処理プログラムにおいて、前記周辺平均輝度画像形成ステップは、元画像を構成する全画素について周辺平均輝度を求めるフィルタ処理ステップと、そのフィルタ処理ステップにより求められた周辺平均輝度により形成される画像を縮小する縮小ステップとを備えている。   The image processing program according to claim 5 is the image processing program according to claim 1, wherein the peripheral average luminance image forming step includes a filter processing step for obtaining a peripheral average luminance for all pixels constituting the original image, and the filter processing thereof. A reduction step of reducing an image formed by the peripheral average luminance obtained in the step.

請求項6記載の画像処理プログラムは、請求項1から5のいずれかに記載の画像処理プログラムにおいて、前記拡大処理ステップは、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素の位置の周囲に存在する縮小レティネックス画像の画素の値に基づいて値を取得する。   An image processing program according to a sixth aspect is the image processing program according to any one of the first to fifth aspects, wherein the enlargement processing step is performed such that pixels of the reduced Retinex image corresponding to the pixels constituting the enlarged image are obtained. If it does not exist, a value is acquired based on the pixel values of the reduced Retinex image existing around the pixel position.

請求項7記載の画像処理プログラムは、請求項6記載の画像処理プログラムにおいて、前記拡大処理ステップは、前記画素の位置の周囲に存在する縮小レティネックス画像の複数の画素の値に基づいて補間演算により値を求める補間演算ステップを備えている。   The image processing program according to claim 7 is the image processing program according to claim 6, wherein the enlargement processing step performs an interpolation operation based on values of a plurality of pixels of the reduced Retinex image existing around the pixel position. An interpolation calculation step for obtaining a value is provided.

請求項8記載の画像処理プログラムは、請求項7記載の画像処理プログラムにおいて、前記補間演算ステップは、値を求める画素の位置の周囲に存在する縮小レティネックス画像の画素の値と、値を求める画素に対応する元画像の画素の値と前記周囲に存在する画素に対応する元画像の値との差により重み付けを行って補間演算を行う。   An image processing program according to an eighth aspect of the present invention is the image processing program according to the seventh aspect, wherein the interpolation calculation step obtains a pixel value and a value of a reduced Retinex image existing around the position of the pixel whose value is to be obtained. Interpolation is performed by weighting the difference between the pixel value of the original image corresponding to the pixel and the value of the original image corresponding to the surrounding pixels.

請求項9記載の画像処理プログラムは、請求項1から5のいずれかに記載の画像処理プログラムにおいて、前記拡大処理ステップは、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素に対応する元画像の画素の値に近い値を有し、その画素の周囲に存在する元画像の画素に対応する縮小レティネックス画像の画素の値に基づいて値を取得する。   An image processing program according to a ninth aspect is the image processing program according to any one of the first to fifth aspects, wherein the enlargement processing step is performed such that pixels of the reduced Retinex image corresponding to pixels constituting the enlarged image are displayed. If it does not exist, it has a value close to the value of the pixel of the original image corresponding to the pixel, and a value based on the value of the pixel of the reduced Retinex image corresponding to the pixel of the original image existing around the pixel. get.

請求項10記載の画像処理プログラムは、請求項1から5のいずれかに記載の画像処理プログラムにおいて、前記拡大処理ステップは、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素に対応する元画像の画素の値と、その元画像の画素の近傍の画素の値との平均値に近い値を有し、その画素の周囲に存在する元画像の画素に対応する縮小レティネックス画像の画素の値に基づいて値を取得する。   An image processing program according to a tenth aspect is the image processing program according to any one of the first to fifth aspects, wherein the enlargement processing step includes a step of calculating a pixel of the reduced Retinex image corresponding to a pixel constituting the enlarged image. If it does not exist, it has a value close to the average value of the pixel value of the original image corresponding to the pixel and the pixel value in the vicinity of the pixel of the original image, and the original image existing around the pixel A value is acquired based on the pixel value of the reduced Retinex image corresponding to the pixel.

請求項11記載の画像処理装置は、レティネックス処理をコンピュータにより実行させるものであり、元画像の周辺平均輝度画像を形成する周辺平均輝度画像形成手段と、その周辺平均輝度画像形成手段により形成された周辺平均輝度画像と元画像とに基づいて元画像のサイズより小さい画像サイズの縮小レティネックス画像を形成する縮小レティネックス画像形成手段と、その縮小レティネックス画像形成手段により形成された縮小レティネックス画像を拡大する拡大処理手段と、その拡大処理手段により拡大された画像情報と、元画像とに基づいて出力画像を形成する出力画像形成手段とを備えている。   The image processing apparatus according to claim 11 is a computer that executes Retinex processing by a computer, and is formed by a peripheral average luminance image forming unit that forms a peripheral average luminance image of an original image, and a peripheral average luminance image forming unit. A reduced Retinex image forming means for forming a reduced Retinex image having an image size smaller than the size of the original image based on the peripheral average luminance image and the original image, and a reduced Retinex formed by the reduced Retinex image forming means Enlarging processing means for enlarging the image, output image forming means for forming an output image based on the image information enlarged by the enlarging processing means, and the original image are provided.

請求項12記載の画像処理装置は、請求項11記載の画像処理装置において、前記周辺平均輝度画像形成手段は、元画像より画像サイズが小さい縮小画像を形成し、その縮小画像の周辺平均輝度画像を形成する縮小周辺平均輝度画像形成手段を備え、前記縮小レティネックス画像形成手段は、前記縮小周辺平均輝度画像形成手段により形成された縮小周辺平均輝度画像と縮小画像とに基づいて縮小レティネックス画像を形成する。   The image processing device according to claim 12 is the image processing device according to claim 11, wherein the peripheral average luminance image forming unit forms a reduced image having an image size smaller than the original image, and the peripheral average luminance image of the reduced image. Reduced peripheral average luminance image forming means, and the reduced Retinex image forming means is a reduced Retinex image based on the reduced peripheral average luminance image and the reduced image formed by the reduced peripheral average luminance image forming means. Form.

請求項13記載の画像処理装置は、請求項12記載の画像処理装置において、前記縮小周辺平均輝度画像形成手段は、元画像から縮小画像を形成するために最近傍法により画素を抽出するサンプリング手段と、そのサンプリング手段により抽出された画素の値とフィルタ係数との畳み込み演算を行う演算手段とを備えている。   The image processing apparatus according to claim 13, wherein the reduced peripheral average luminance image forming means extracts sampling pixels by a nearest neighbor method in order to form a reduced image from the original image. And an arithmetic means for performing a convolution operation between the pixel value extracted by the sampling means and the filter coefficient.

請求項14記載の画像処理装置は、請求項12記載の画像処理装置において、前記縮小周辺平均輝度画像形成手段は、元画像を平均画素法により縮小する画像縮小手段と、その縮小手段により縮小された画像の画素とフィルタ係数との畳み込み演算を行う演算手段とを備えている。   The image processing device according to claim 14 is the image processing device according to claim 12, wherein the reduced peripheral average luminance image forming means is reduced by an image reduction means for reducing the original image by an average pixel method, and the reduction means. Arithmetic means for performing a convolution operation between the pixels of the image and the filter coefficient.

請求項15記載の画像処理装置は、請求項11記載の画像処理装置において、前記周辺平均輝度画像形成手段は、元画像を構成する全画素について周辺平均輝度を求めるフィルタ処理手段と、そのフィルタ処理手段により求められた周辺平均輝度により形成される画像を縮小する縮小手段とを備えている。   The image processing device according to claim 15 is the image processing device according to claim 11, wherein the peripheral average luminance image forming unit is a filter processing unit that obtains the peripheral average luminance for all pixels constituting the original image, and the filter processing thereof. Reduction means for reducing the image formed by the peripheral average luminance obtained by the means.

請求項16記載の画像処理装置は、請求項11から15のいずれかに記載の画像処理装置において、前記拡大処理手段は、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素の位置の周囲に存在する縮小レティネックス画像の画素の値に基づいて値を取得する。   The image processing device according to claim 16 is the image processing device according to any one of claims 11 to 15, wherein the enlargement processing unit includes pixels of the reduced Retinex image corresponding to the pixels constituting the enlarged image. If it does not exist, a value is acquired based on the pixel values of the reduced Retinex image existing around the pixel position.

請求項17記載の画像処理装置は、請求項16記載の画像処理装置において、前記拡大処理手段は、前記画素の位置の周囲に存在する縮小レティネックス画像の複数の画素の値に基づいて補間演算により値を求める補間演算手段を備えている。   The image processing device according to claim 17 is the image processing device according to claim 16, wherein the enlargement processing unit performs an interpolation operation based on values of a plurality of pixels of the reduced Retinex image existing around the pixel position. Interpolation calculation means for obtaining the value is provided.

請求項18記載の画像処理装置は、請求項17記載の画像処理装置において、前記補間演算手段は、値を求める画素の位置の周囲に存在する縮小レティネックス画像の画素の値と、値を求める画素に対応する元画像の画素の値と前記周囲に存在する画素に対応する元画像の値との差により重み付けを行って補間演算を行う。   The image processing device according to claim 18, in the image processing device according to claim 17, wherein the interpolation calculation means obtains the pixel value of the reduced Retinex image existing around the position of the pixel whose value is to be obtained, and the value. Interpolation is performed by weighting the difference between the pixel value of the original image corresponding to the pixel and the value of the original image corresponding to the surrounding pixels.

請求項19記載の画像処理装置は、請求項11から15のいずれかに記載の画像処理装置において、前記拡大処理手段は、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素に対応する元画像の画素の値に近い値を有し、その画素の周囲に存在する元画像の画素に対応する縮小レティネックス画像の画素の値に基づいて値を取得する。   The image processing device according to claim 19 is the image processing device according to any one of claims 11 to 15, wherein the enlargement processing unit includes pixels of the reduced Retinex image corresponding to the pixels constituting the enlarged image. If it does not exist, it has a value close to the value of the pixel of the original image corresponding to the pixel, and a value based on the value of the pixel of the reduced Retinex image corresponding to the pixel of the original image existing around the pixel. get.

請求項20記載の画像処理装置は、請求項11から15のいずれかに記載の画像処理装置において、前記拡大処理手段は、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素に対応する元画像の画素の値と、その元画像の画素の近傍の画素の値との平均値に近い値を有し、その画素の周囲に存在する元画像の画素に対応する縮小レティネックス画像の画素の値に基づいて値を取得する。   The image processing device according to claim 20 is the image processing device according to any one of claims 11 to 15, wherein the enlargement processing unit includes pixels of a reduced Retinex image corresponding to pixels constituting the enlarged image. If it does not exist, it has a value close to the average value of the pixel value of the original image corresponding to the pixel and the pixel value in the vicinity of the pixel of the original image, and the original image existing around the pixel A value is acquired based on the pixel value of the reduced Retinex image corresponding to the pixel.

請求項1記載の画像処理プログラムによれば、元画像の周辺平均輝度画像を形成する周辺平均輝度画像形成ステップと、その周辺平均輝度画像形成ステップにより形成された周辺平均輝度画像と元画像とに基づいて縮小レティネックス画像形成ステップにより元画像のサイズより小さい画像サイズの縮小レティネックス画像を形成する。次に、その形成された縮小レティネックス画像を拡大処理ステップにより拡大し、その拡大された画像情報と、元画像とに基づいて出力画像形成ステップにより出力画像を形成するので、サイズが小さい周辺平均輝度画像を拡大し、その拡大された画像と元画像とからレティネックス画像を形成する処理に比べ、縮小レティネックス画像を形成する際の対数演算の回数が少なく、高速で処理を行うことができるという効果がある。また、縮小レティネックス画像は、サイズが小さいので、メモリ容量を少なくすることができるという効果もある。   According to the image processing program of claim 1, the peripheral average luminance image forming step for forming the peripheral average luminance image of the original image, the peripheral average luminance image formed by the peripheral average luminance image forming step, and the original image Based on this, the reduced Retinex image forming step forms a reduced Retinex image having an image size smaller than that of the original image. Next, the formed reduced Retinex image is enlarged by the enlargement processing step, and the output image is formed by the output image forming step based on the enlarged image information and the original image. Compared with the process of enlarging a luminance image and forming a Retinex image from the enlarged image and the original image, the number of logarithmic operations when forming a reduced Retinex image is small, and processing can be performed at high speed. There is an effect. Further, since the reduced Retinex image is small in size, there is an effect that the memory capacity can be reduced.

請求項2記載の画像処理プログラムによれば、請求項1記載の画像処理プログラムの奏する効果に加え、周辺平均輝度画像形成ステップは、元画像より画像サイズが小さい縮小画像を形成し、その縮小画像の周辺平均輝度画像を形成する縮小周辺平均輝度画像形成ステップを備え、縮小レティネックス画像形成ステップは、縮小周辺平均輝度画像形成ステップにより形成された縮小周辺平均輝度画像と縮小画像とに基づいて縮小レティネックス画像を形成するので、縮小画像の周辺平均輝度画像を形成する場合に行われる畳み込み演算の演算回数を減少させることができ、高速で処理できるという効果がある。   According to the image processing program of claim 2, in addition to the effect of the image processing program of claim 1, the peripheral average luminance image forming step forms a reduced image having an image size smaller than that of the original image, and the reduced image The reduced peripheral average luminance image forming step for forming the peripheral average luminance image of the image is reduced, and the reduced Retinex image forming step is reduced based on the reduced peripheral average luminance image and the reduced image formed by the reduced peripheral average luminance image forming step. Since the Retinex image is formed, the number of convolution operations performed when forming the peripheral average luminance image of the reduced image can be reduced, and there is an effect that processing can be performed at high speed.

請求項3記載の画像処理プログラムによれば、請求項2記載の画像処理プログラムの奏する効果に加え、縮小周辺平均輝度画像形成ステップは、元画像から最近傍法により画素を抽出するサンプリングステップと、そのサンプリングステップにより抽出された画素の値とフィルタ係数との畳み込み演算を行う演算ステップとを備えているので、縮小画像を形成するための画素の抽出が容易であるとともに、畳み込み演算で行われる積和演算の回数が少なくて済み、高速で処理することができるという効果がある。   According to the image processing program of claim 3, in addition to the effect produced by the image processing program of claim 2, the reduced peripheral average luminance image forming step includes a sampling step of extracting pixels from the original image by a nearest neighbor method, A calculation step for performing a convolution operation between the pixel value extracted by the sampling step and the filter coefficient, so that it is easy to extract pixels for forming a reduced image and a product to be performed by the convolution operation. There is an effect that the number of times of the sum operation is small and processing can be performed at high speed.

請求項4記載の画像処理プログラムによれば、請求項2記載の画像処理プログラムの奏する効果に加え、縮小周辺平均輝度画像形成ステップは、元画像を平均画素法により縮小する画像縮小ステップと、その縮小ステップにより縮小された画像の画素とフィルタ係数との畳み込み演算を行う演算ステップとを備えているので、畳み込み演算において使用される画素の値は、画像を形成する全画素の値を反映したものであり、高画質の画像を得ることができるという効果がある。   According to the image processing program of claim 4, in addition to the effect produced by the image processing program of claim 2, the reduced peripheral average luminance image forming step includes an image reduction step of reducing the original image by an average pixel method, Since it has a calculation step that performs a convolution operation between the pixel of the image reduced by the reduction step and the filter coefficient, the value of the pixel used in the convolution operation reflects the value of all the pixels forming the image Therefore, there is an effect that a high-quality image can be obtained.

請求項5記載の画像処理プログラムによれば、請求項1記載の画像処理プログラムの奏する効果に加え、周辺平均輝度画像形成ステップは、元画像を構成する全画素について周辺平均輝度を求めるフィルタ処理ステップと、そのフィルタ処理ステップにより求められた周辺平均輝度により形成される画像を縮小する縮小ステップとを備えているので、畳み込み演算における積和演算の回数は減少しないが、より高画質の画像を得ることができるという効果がある。   According to the image processing program of claim 5, in addition to the effect produced by the image processing program of claim 1, the peripheral average luminance image forming step is a filter processing step for obtaining the peripheral average luminance for all the pixels constituting the original image. And a reduction step for reducing the image formed by the peripheral average luminance obtained by the filter processing step, the number of product-sum operations in the convolution operation is not reduced, but a higher quality image is obtained. There is an effect that can be.

請求項6記載の画像処理プログラムによれば、請求項1から5のいずれかに記載の画像処理プログラムの奏する効果に加え、拡大処理ステップは、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素の位置の周囲に存在する縮小レティネックス画像の画素の値に基づいて値を取得するので、処理が簡単であり、高速に処理することができるという効果がある。   According to the image processing program of the sixth aspect, in addition to the effect produced by the image processing program according to any one of the first to fifth aspects, the enlargement processing step includes a reduction ratio corresponding to the pixels constituting the enlarged image. When the pixel of the nexus image does not exist, the value is acquired based on the value of the pixel of the reduced retinex image existing around the pixel position, so that the processing is simple and the processing can be performed at high speed. effective.

請求項7記載の画像処理プログラムによれば、請求項6記載の画像処理プログラムの奏する効果に加え、拡大処理ステップは、画素の位置の周囲に存在する縮小レティネックス画像の複数の画素の値に基づいて補間演算により値を求める補間演算ステップを備えているので、最も近い位置の画素の値とする場合に比べ、その画素の周囲の値を反映し、より高画質の画像を得ることができるという効果がある。   According to the image processing program of the seventh aspect, in addition to the effect produced by the image processing program of the sixth aspect, the enlargement processing step converts the values of a plurality of pixels of the reduced Retinex image existing around the pixel position. Since an interpolation calculation step for obtaining a value by interpolation calculation is provided, it is possible to obtain a higher quality image by reflecting the values around the pixel as compared with the value of the pixel at the closest position. There is an effect.

請求項8記載の画像処理プログラムによれば、請求項7記載の画像処理プログラムの奏する効果に加え、補間演算ステップは、値を求める画素の位置の周囲に存在する縮小レティネックス画像の画素の値と、値を求める画素に対応する元画像の画素の値と周囲に存在する画素に対応する元画像の値との差により重み付けを行って補間演算を行うので、その画素に対応する元画像の画素の値とその周辺の画素の値とが反映され、より高画質の画像を得ることができるという効果がある。   According to the image processing program of the eighth aspect, in addition to the effect produced by the image processing program of the seventh aspect, the interpolation calculation step includes the value of the pixel of the reduced Retinex image existing around the position of the pixel whose value is to be obtained. And the interpolation calculation is performed by weighting the difference between the value of the pixel of the original image corresponding to the pixel for which the value is obtained and the value of the original image corresponding to the pixel existing in the surrounding area. The pixel value and the values of the surrounding pixels are reflected, and there is an effect that a higher quality image can be obtained.

請求項9記載の画像処理プログラムによれば、請求項1から5のいずれかに記載の画像処理プログラムの奏する効果に加え、拡大処理ステップは、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素に対応する元画像の画素の値に近い値を有し、その画素の周囲に存在する元画像の画素に対応する縮小レティネックス画像の画素の値に基づいて値を取得するので、位置的に近い縮小レティネックス画像の画素の値を採用するよりも、よりよい近似を行うことができ、より高画質の画像を得ることができるという効果がある。   According to the image processing program of the ninth aspect, in addition to the effect produced by the image processing program according to any one of the first to fifth aspects, the enlargement processing step includes a reduction ratio corresponding to the pixels constituting the enlarged image. When the pixel of the nexus image does not exist, the value of the pixel of the reduced Retinex image corresponding to the pixel of the original image existing around the pixel has a value close to the value of the pixel of the original image corresponding to the pixel Since the value is acquired based on the above, it is possible to perform a better approximation and obtain a higher quality image than to employ the pixel value of the reduced Retinex image that is close in position. .

請求項10記載の画像処理プログラムによれば、請求項1から5のいずれかに記載の画像処理プログラムの奏する効果に加え、拡大処理ステップは、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素に対応する元画像の画素の値と、その元画像の画素の近傍の画素の値との平均値に近い値を有し、その画素の周囲に存在する元画像の画素に対応する縮小レティネックス画像の画素の値に基づいて値を取得するので、求める画素の近傍の画素の値を反映し、より高画質の画像を得ることができるという効果がある。   According to the image processing program of the tenth aspect, in addition to the effect produced by the image processing program according to any one of the first to fifth aspects, the enlargement processing step includes a reduction ratio corresponding to the pixels constituting the enlarged image. When the pixel of the nexus image does not exist, it has a value close to the average value of the value of the pixel of the original image corresponding to the pixel and the value of the pixel in the vicinity of the pixel of the original image, and around the pixel Since the value is acquired based on the pixel value of the reduced Retinex image corresponding to the pixel of the existing original image, the value of the pixel in the vicinity of the desired pixel can be reflected, and a higher quality image can be obtained. There is.

請求項11記載の画像処理装置によれば、元画像の周辺平均輝度画像を形成する周辺平均輝度画像形成手段と、その周辺平均輝度画像形成手段により形成された周辺平均輝度画像と元画像とに基づいて縮小レティネックス画像形成手段により元画像のサイズより小さい画像サイズの縮小レティネックス画像を形成する。次に、その形成された縮小レティネックス画像を拡大処理手段により拡大し、その拡大された画像情報と、元画像とに基づいて出力画像形成手段により出力画像を形成するので、サイズが小さい周辺平均輝度画像を拡大し、その拡大された画像と元画像とからレティネックス画像を形成する処理に比べ、縮小レティネックス画像を形成する際の対数演算の回数が少なく、高速で処理を行うことができるという効果がある。また、縮小レティネックス画像は、サイズが小さいので、メモリ容量を少なくすることができるという効果もある。   According to the image processing apparatus of claim 11, the peripheral average luminance image forming unit that forms the peripheral average luminance image of the original image, the peripheral average luminance image formed by the peripheral average luminance image forming unit, and the original image Based on this, a reduced Retinex image forming unit forms a reduced Retinex image having an image size smaller than that of the original image. Next, the formed reduced Retinex image is enlarged by the enlargement processing means, and an output image is formed by the output image forming means based on the enlarged image information and the original image. Compared with the process of enlarging a luminance image and forming a Retinex image from the enlarged image and the original image, the number of logarithmic operations when forming a reduced Retinex image is small, and processing can be performed at high speed. There is an effect. Further, since the reduced Retinex image is small in size, there is an effect that the memory capacity can be reduced.

請求項12記載の画像処理装置によれば、請求項11記載の画像処理装置の奏する効果に加え、周辺平均輝度画像形成手段は、元画像より画像サイズが小さい縮小画像を形成し、その縮小画像の周辺平均輝度画像を形成する縮小周辺平均輝度画像形成手段を備え、縮小レティネックス画像形成手段は、縮小周辺平均輝度画像形成手段により形成された縮小周辺平均輝度画像と縮小画像とに基づいて縮小レティネックス画像を形成するので、縮小画像の周辺平均輝度画像を形成する場合に行われる畳み込み演算の演算回数を減少させることができ、高速で処理できるという効果がある。   According to the image processing device of the twelfth aspect, in addition to the effect produced by the image processing device of the eleventh aspect, the peripheral average luminance image forming unit forms a reduced image having an image size smaller than the original image, and the reduced image The reduced peripheral average luminance image forming means for forming the peripheral average luminance image of the image is reduced, and the reduced Retinex image forming means is reduced based on the reduced peripheral average luminance image and the reduced image formed by the reduced peripheral average luminance image forming means. Since the Retinex image is formed, the number of convolution operations performed when forming the peripheral average luminance image of the reduced image can be reduced, and there is an effect that processing can be performed at high speed.

請求項13記載の画像処理装置によれば、請求項12記載の画像処理装置の奏する効果に加え、縮小周辺平均輝度画像形成手段は、元画像から最近傍法により画素を抽出するサンプリング手段と、そのサンプリング手段により抽出された画素の値とフィルタ係数との畳み込み演算を行う演算手段とを備えているので、縮小画像を形成するための画素の抽出が容易であるとともに、畳み込み演算で行われる積和演算の回数が少なくて済み、高速で処理することができるという効果がある。   According to the image processing device of claim 13, in addition to the effect produced by the image processing device of claim 12, the reduced peripheral average luminance image forming means includes sampling means for extracting pixels from the original image by the nearest neighbor method, Since there is a calculation means for performing a convolution operation between the pixel value extracted by the sampling means and the filter coefficient, it is easy to extract pixels for forming a reduced image, and a product to be performed by the convolution calculation is used. There is an effect that the number of times of the sum operation is small and processing can be performed at high speed.

請求項14記載の画像処理装置によれば、請求項12記載の画像処理装置の奏する効果に加え、縮小周辺平均輝度画像形成手段は、元画像を平均画素法により縮小する画像縮小手段と、その縮小手段により縮小された画像の画素とフィルタ係数との畳み込み演算を行う演算手段とを備えているので、畳み込み演算において使用される画素の値は、画像を形成する全画素の値を反映したものであり、高画質の画像を得ることができるという効果がある。   According to the image processing device of the fourteenth aspect, in addition to the effect produced by the image processing device of the twelfth aspect, the reduced peripheral average luminance image forming unit includes an image reducing unit that reduces the original image by an average pixel method, Since it is provided with arithmetic means for performing a convolution operation between the pixel of the image reduced by the reduction means and the filter coefficient, the pixel values used in the convolution operation reflect the values of all the pixels forming the image. Therefore, there is an effect that a high-quality image can be obtained.

請求項15記載の画像処理装置によれば、請求項11記載の画像処理装置の奏する効果に加え、周辺平均輝度画像形成手段は、元画像を構成する全画素について周辺平均輝度を求めるフィルタ処理手段と、そのフィルタ処理手段により求められた周辺平均輝度により形成される画像を縮小する縮小手段とを備えているので、畳み込み演算における積和演算の回数は減少しないが、より高画質の画像を得ることができるという効果がある。   According to the image processing device of claim 15, in addition to the effect achieved by the image processing device of claim 11, the peripheral average luminance image forming unit is a filter processing unit that calculates the peripheral average luminance for all the pixels constituting the original image. And a reduction means for reducing the image formed by the peripheral average luminance obtained by the filter processing means, the number of product-sum operations in the convolution operation is not reduced, but a higher quality image is obtained. There is an effect that can be.

請求項16記載の画像処理装置によれば、請求項11から15のいずれかに記載の画像処理装置の奏する効果に加え、拡大処理手段は、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素の位置の周囲に存在する縮小レティネックス画像の画素の値に基づいて値を取得するので、処理が簡単であり、高速に処理することができるという効果がある。   According to the image processing apparatus of the sixteenth aspect, in addition to the effect produced by the image processing apparatus according to any one of the eleventh to fifteenth aspects, the enlargement processing means includes a reduction ratio corresponding to the pixels constituting the enlarged image. When the pixel of the nexus image does not exist, the value is acquired based on the value of the pixel of the reduced retinex image existing around the pixel position, so that the processing is simple and the processing can be performed at high speed. effective.

請求項17記載の画像処理装置によれば、請求項16記載の画像処理装置の奏する効果に加え、拡大処理手段は、画素の位置の周囲に存在する縮小レティネックス画像の複数の画素の値に基づいて補間演算により値を求める補間演算手段を備えているので、最も近い位置の画素の値とする場合に比べ、その画素の周囲の値を反映し、より高画質の画像を得ることができるという効果がある。   According to the image processing device of claim 17, in addition to the effect produced by the image processing device of claim 16, the enlargement processing means converts the values of the plurality of pixels of the reduced Retinex image existing around the pixel position. Interpolation calculation means for obtaining a value by interpolation calculation based on it is provided, so that a higher quality image can be obtained by reflecting the values around the pixel as compared with the value of the pixel at the nearest position. There is an effect.

請求項18記載の画像処理装置によれば、請求項17記載の画像処理装置の奏する効果に加え、補間演算手段は、値を求める画素の位置の周囲に存在する縮小レティネックス画像の画素の値と、値を求める画素に対応する元画像の画素の値と周囲に存在する画素に対応する元画像の値との差により重み付けを行って補間演算を行うので、その画素に対応する元画像の画素の値とその周辺の画素の値とが反映され、より高画質の画像を得ることができるという効果がある。   According to the image processing device of claim 18, in addition to the effect achieved by the image processing device of claim 17, the interpolation calculation means is configured to obtain the pixel value of the reduced Retinex image existing around the position of the pixel whose value is to be obtained. And the interpolation calculation is performed by weighting the difference between the value of the pixel of the original image corresponding to the pixel for which the value is obtained and the value of the original image corresponding to the pixel existing in the surrounding area. The pixel value and the values of the surrounding pixels are reflected, and there is an effect that a higher quality image can be obtained.

請求項19記載の画像処理装置によれば、請求項11から15のいずれかに記載の画像処理装置の奏する効果に加え、拡大処理手段は、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素に対応する元画像の画素の値に近い値を有し、その画素の周囲に存在する元画像の画素に対応する縮小レティネックス画像の画素の値に基づいて値を取得するので、位置的に近い縮小レティネックス画像の画素の値を採用するよりも、よりよい近似を行うことができ、より高画質の画像を得ることができるという効果がある。   According to the image processing device of the nineteenth aspect, in addition to the effect produced by the image processing device according to any one of the eleventh to fifteenth aspects, the enlargement processing means includes a reduction ratio corresponding to the pixels constituting the enlarged image. When the pixel of the nexus image does not exist, the value of the pixel of the reduced Retinex image corresponding to the pixel of the original image existing around the pixel has a value close to the value of the pixel of the original image corresponding to the pixel Since the value is acquired based on the above, it is possible to perform a better approximation and obtain a higher quality image than to employ the pixel value of the reduced Retinex image that is close in position. .

請求項20記載の画像処理装置によれば、請求項11から15のいずれかに記載の画像処理装置の奏する効果に加え、拡大処理手段は、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素に対応する元画像の画素の値と、その元画像の画素の近傍の画素の値との平均値に近い値を有し、その画素の周囲に存在する元画像の画素に対応する縮小レティネックス画像の画素の値に基づいて値を取得するので、求める画素の近傍の画素の値を反映し、より高画質の画像を得ることができるという効果がある。   According to the image processing device of the twentieth aspect, in addition to the effect produced by the image processing device according to any one of the eleventh to fifteenth aspects, the enlargement processing means includes a reduction ratio corresponding to the pixels constituting the enlarged image. When the pixel of the nexus image does not exist, it has a value close to the average value of the value of the pixel of the original image corresponding to the pixel and the value of the pixel in the vicinity of the pixel of the original image, and around the pixel Since the value is acquired based on the pixel value of the reduced Retinex image corresponding to the pixel of the existing original image, the value of the pixel in the vicinity of the desired pixel can be reflected, and a higher quality image can be obtained. There is.

以下、本発明の好ましい実施形態について添付図面を参照して説明する。図1は、本実施形態の画像処理のプログラムを搭載したプリンタ1の電気的な構成を示したブロック図である。本実施形態においては、プリンタ1に搭載された画像処理のプログラムは、パーソナルコンピュータ(以下「PC」と称する)2や、デジタルカメラ21や、外部メディア20から入力された画像データ(原画像データなど)に対しレティネックス処理(Retinex処理)を実行して、画像データの逆光画像部分などの低画質領域の補正を実行するように構成されている。   Hereinafter, preferred embodiments of the present invention will be described with reference to the accompanying drawings. FIG. 1 is a block diagram showing an electrical configuration of a printer 1 equipped with an image processing program according to the present embodiment. In the present embodiment, the image processing program installed in the printer 1 is image data (original image data or the like) input from the personal computer (hereinafter referred to as “PC”) 2, the digital camera 21, or the external medium 20. ), A Retinex process (Retinex process) is executed to correct a low image quality region such as a backlight image portion of the image data.

図1に示すように、プリンタ1には、CPU11、ROM12、RAM13、印刷ヘッドなどから構成され、印刷媒体(例えば、紙媒体など)への印刷(出力)を行う印刷部15、出力画像サイズなどの入力値をユーザが入力可能なユーザ操作部(例えば、テンキーなど)を有する操作パネル16とを備えている。   As shown in FIG. 1, the printer 1 includes a CPU 11, a ROM 12, a RAM 13, a print head, and the like, and includes a printing unit 15 that performs printing (output) on a print medium (for example, a paper medium), an output image size, and the like. And an operation panel 16 having a user operation unit (for example, a numeric keypad) through which the user can input the input value.

また、プリンタ1は、ケーブル5を介してPC2と接続可能なインターフェイス(以下「I/F」と称する)17と、ケーブル6を介してデジタルカメラ21と接続可能なI/F18と、外部メディア20(例えば、SDメモリカード、メモリスティックなどのフラッシュメモリにより構成される)を着脱自在に装着可能な外部メディアスロット19とを備えている。近年、これらのI/F17、18により行われる通信方法としてUSB(Universal Serial Bus)が使用される。   The printer 1 includes an interface (hereinafter referred to as “I / F”) 17 that can be connected to the PC 2 via the cable 5, an I / F 18 that can be connected to the digital camera 21 via the cable 6, and an external medium 20. And an external media slot 19 that can be detachably mounted (for example, a flash memory such as an SD memory card or a memory stick). In recent years, USB (Universal Serial Bus) is used as a communication method performed by these I / Fs 17 and 18.

よって、プリンタ1は、PC2に記憶されている画像データをケーブル5及びI/F17を介して入力することが可能であると共に、デジタルカメラ21によって撮影された画像データをケーブル6及びI/F18を介して入力することが可能である。さらに、外部メディアスロット19に装着された外部メディア20から、その外部メディア21に記憶されている画像データを入力することが可能である。   Therefore, the printer 1 can input the image data stored in the PC 2 via the cable 5 and the I / F 17 and also the image data photographed by the digital camera 21 via the cable 6 and the I / F 18. It is possible to input via. Further, it is possible to input image data stored in the external medium 21 from the external medium 20 mounted in the external media slot 19.

CPU11は、プリンタ1全体を制御する演算処理装置(演算装置)である。ROM12は、CPU11により実行される各種制御プログラムやそのプログラムを実行する際に用いられる固定値などを記憶するものであり、この実施形態では、レティネックス処理などの画像の処理を行う画像処理プログラムを記憶する画像処理プログラムメモリ12aと、その処理において使用されるガウス関数を記憶するガウス関数メモリ12b等を備えている。   The CPU 11 is an arithmetic processing device (arithmetic device) that controls the entire printer 1. The ROM 12 stores various control programs executed by the CPU 11 and fixed values used when executing the programs. In this embodiment, an image processing program that performs image processing such as Retinex processing is stored. An image processing program memory 12a for storing data, a Gaussian function memory 12b for storing Gaussian functions used in the processing, and the like are provided.

レティネックス処理におけるフィルタ処理(マスク処理ともいう)に使用されるフィルタの係数は、ガウス関数メモリ12bに記憶されたガウス関数を用いて演算により求められる。   The filter coefficient used for the filter processing (also referred to as mask processing) in the Retinex processing is obtained by calculation using a Gaussian function stored in the Gaussian function memory 12b.

RAM13は、CPU11で実行される制御プログラムに必要な各種レジスタ群などが設定されたワーキングエリアや、処理中のデータを一時的に格納するテンポラリエリア等を有しランダムにアクセスできる書き換え可能なメモリであり、元画像データを記憶する原画像メモリ13aと、レティネックス処理により求められる縮小レティネックス画像を記憶する縮小レティネックス画像メモリ13b等を備えている。   The RAM 13 is a rewritable memory that has a working area in which various register groups necessary for a control program executed by the CPU 11 are set, a temporary area that temporarily stores data being processed, and can be accessed at random. And an original image memory 13a for storing original image data, a reduced Retinex image memory 13b for storing reduced Retinex images obtained by Retinex processing, and the like.

元画像データメモリ13aは、PC2、デジタルカメラ21、及び外部メディア20から、それぞれ、I/F17、I/F18、及び外部メディアスロット19を介して入力した画像データを記憶するものである。なお、本実施形態では、元画像データ及び出力画像データはいずれも、RGB値から構成され、これらのRGB値は、「0」〜「255」の範囲の値である。   The original image data memory 13 a stores image data input from the PC 2, the digital camera 21, and the external media 20 via the I / F 17, I / F 18, and external media slot 19, respectively. In the present embodiment, both the original image data and the output image data are composed of RGB values, and these RGB values are values in the range of “0” to “255”.

尚、RGB値は、光の3原色である赤を表すR値と、緑を表すG値と、青を示すB値とを構成成分とする値である。光の3原色の混色により各種の色は生成されるので、入力画像の各画素の色は、R値とG値とB値との組合せ(RGB値)により1の色(色相や階調など)が示される。このRGB値の値が大きいほど、輝度(明度)は高くなる。   Note that the RGB value is a value having, as constituent components, an R value representing red, which is the three primary colors of light, a G value representing green, and a B value representing blue. Since various colors are generated by mixing the three primary colors of light, the color of each pixel of the input image is one color (hue, gradation, etc.) by a combination of R value, G value, and B value (RGB value). ) Is displayed. The luminance (lightness) increases as the RGB value increases.

縮小レティネックス画像メモリ13bは、レティネックス処理の途中において、平均輝度画像と、元画像とにより形成される画像を記憶するメモリである。出力画像が形成される際には、この縮小レティネックス画像の各画素の最大値および最小値が検出されて、ヒストグラムの上位および下位の値を制限するクリッピング処理などにより正規化が行われる。   The reduced Retinex image memory 13b is a memory that stores an image formed by the average luminance image and the original image during the Retinex process. When the output image is formed, the maximum value and the minimum value of each pixel of the reduced Retinex image are detected, and normalization is performed by a clipping process for limiting the upper and lower values of the histogram.

次に図2を参照して、プリンタ1のCPU11によって実行されるレティネックス処理について説明する。図2は、本プリンタ1で実行されるレティネックス処理の概要を模式的に示す図である。   Next, the Retinex process executed by the CPU 11 of the printer 1 will be described with reference to FIG. FIG. 2 is a diagram schematically showing an outline of the Retinex process executed by the printer 1.

まず、元画像から、縮小画像を形成する。この縮小画像を形成する方法としては、元画像を構成する画素のうち、所定の間隔で抽出(サンプリング)した画素の値(濃度値)をとる最近傍法(ニアレストネイバー法)、周囲の4つの画素の値から線形補間により値を求めるバイリニア法、周囲の16個の画素の値から3次関数を用いて補間により値を求めるバイキュービック法、元画像の占める面積を考慮して値を平均することにより値を求める平均画素法などが知られている。このうち、最近傍法は、単に所定の位置の画素を抽出ものであるので処理が簡単であり、高速で処理することができる。一方、平均画素法は、全ての画素を用いて縮小する方法であるので、縮小された画像が最も高画質である。   First, a reduced image is formed from the original image. As a method of forming this reduced image, the nearest neighbor method (nearest neighbor method) that takes the value (density value) of pixels extracted (sampled) at predetermined intervals among the pixels constituting the original image, and the surrounding four methods Bilinear method for obtaining a value by linear interpolation from the values of one pixel, Bicubic method for obtaining a value by interpolation using the cubic function from the values of 16 surrounding pixels, and averaging the values in consideration of the area occupied by the original image An average pixel method for obtaining a value by doing so is known. Of these, the nearest neighbor method is simple because it simply extracts pixels at a predetermined position, and can be processed at high speed. On the other hand, since the average pixel method is a method of reducing using all the pixels, the reduced image has the highest image quality.

次に、縮小された画像の各画素についての周辺平均輝度を求めた周辺平均輝度画像を求める。この処理は、ガウス関数を用いて作成されたフィルタの係数と、縮小画像の画素の値とを畳み込み演算(コンボリューション)することにより算出される。元画像を縮小した縮小画像の画素の横座標をx、縦座標をyで表し、その画素の値をI(x、y)で表し、フィルタの係数を同様に、F(x、y)とし、畳み込み演算をF(x,y)*I(x、y)として表す。   Next, a peripheral average luminance image obtained by calculating the peripheral average luminance for each pixel of the reduced image is obtained. This processing is calculated by convolving a filter coefficient created using a Gaussian function and the pixel value of the reduced image. The abscissa of the pixel of the reduced image obtained by reducing the original image is represented by x, the ordinate is represented by y, the value of the pixel is represented by I (x, y), and the filter coefficient is similarly F (x, y). The convolution operation is represented as F (x, y) * I (x, y).

次に、畳み込み演算により形成された周辺平均輝度画像と、縮小画像とから縮小レティネックス画像を形成する。この演算は、レティネックス画像の画素の値をR(x,y)とし、次に示す数式1で表される。   Next, a reduced Retinex image is formed from the peripheral average luminance image formed by the convolution operation and the reduced image. This calculation is expressed by Equation 1 below, where R (x, y) is the pixel value of the Retinex image.

Figure 2007272878
この数式が示すように、この処理では、各画素について、対数変換が行われる。
Figure 2007272878
As shown in this equation, logarithmic conversion is performed for each pixel in this process.

次に、このようにして形成された縮小レティネックス画像を拡大するとともに正規化し、元画像の値を使って出力画像を形成する。この演算は、出力画像の画素の値をOut(x、y)として、次に示す数式2で表される。   Next, the reduced Retinex image formed in this way is enlarged and normalized, and an output image is formed using the values of the original image. This calculation is expressed by Equation 2 below, where Out (x, y) is the pixel value of the output image.

Figure 2007272878
ここで、refle(x、y)は、R(x、y)を正規化した値である。
なお、縮小レティネックス画像を拡大する方法には、各種の方法があり、後述する。
Figure 2007272878
Here, refle (x, y) is a value obtained by normalizing R (x, y).
There are various methods for enlarging the reduced Retinex image, which will be described later.

次に、図3および図4を参照して、周辺平均輝度画像の形成方法について説明する。図3(a)は、元画像の画素を示すテーブルであって、ここでは、横16、縦16の画素により構成され、各画素の値Iには、添え字xを左端から右方へ向かって0,1,2・・、添え字yを上端から下方向かって0,1,2・・・を付加している。   Next, a method for forming a peripheral average luminance image will be described with reference to FIGS. FIG. 3A is a table showing the pixels of the original image, which is composed of 16 horizontal pixels and 16 vertical pixels. In each pixel value I, a suffix x is applied from the left end to the right. .., 0, 1, 2,..., 0, 1, 2,.

図3(b)は、フィルタの構成を示すテーブルであって、ここでは、横5、縦5の画素により構成され、各フィルタ係数Fは、元画像の場合と同様に添え字x、yを付加している。これらのフィルタ係数は、ガウス関数を使用して中央部の値は大きく、中央から距離が遠くなるほど値が小さくなる値が形成される。   FIG. 3B is a table showing the configuration of the filter. Here, the table is composed of 5 pixels in the horizontal direction and 5 pixels in the vertical direction, and each filter coefficient F has subscripts x and y as in the case of the original image. It is added. These filter coefficients have a large value at the center using a Gaussian function, and a value that decreases as the distance from the center increases.

この図3(b)に示すフィルタと、図3(a)に示す元画像を縮小した縮小画像の各画素とについて、畳み込み演算を行うことにより、周辺平均輝度画像が形成される。   A peripheral average luminance image is formed by performing a convolution operation on the filter shown in FIG. 3B and each pixel of the reduced image obtained by reducing the original image shown in FIG.

次に、このようにして形成された周辺平均輝度画像と縮小画像とを上記数式1により演算を行うことにより、図4(a)に示す縮小レティネックス画像を形成する。図4(a)は、画像のサイズを縮小(解像度を低下)した縮小レティネックス画像を示すテーブルであり、横5、縦5の画素より構成され、各画素の値Qには、元画像の場合と同様に添え字x、yを付加している。   Next, a reduced Retinex image shown in FIG. 4A is formed by calculating the peripheral average luminance image and the reduced image thus formed according to the above mathematical formula 1. FIG. 4A is a table showing a reduced Retinex image obtained by reducing the size of the image (decreasing the resolution). The table includes 5 pixels in the horizontal direction and 5 pixels in the vertical direction. The value Q of each pixel includes the value Q of the original image. Subscripts x and y are added as in the case.

図4(a)に示す縮小レティネックス画像を形成する方法には、上記のように、まず、元画像を縮小し、その縮小した縮小画像に対してフィルタ処理を行って縮小された周辺平均輝度画像を形成し、その縮小された周辺平均輝度画像と縮小画像とから数式1を用いて縮小レティネック画像を形成する方法と、周辺平均輝度画像を、元画像のサイズ(元の解像度)で形成し、その周辺平均輝度画像を縮小し、元画像を縮小した縮小画像とに基づいて数式1を用いて縮小レティネックス画像を形成する方法とがある。   In the method of forming the reduced Retinex image shown in FIG. 4A, as described above, first, the original image is reduced, and the reduced average image is reduced by filtering the reduced image. A method of forming an image and forming a reduced Retinec image using Equation 1 from the reduced peripheral average luminance image and the reduced image, and forming the peripheral average luminance image at the size of the original image (original resolution) There is a method of reducing the peripheral average luminance image and forming a reduced Retinex image using Equation 1 based on the reduced image obtained by reducing the original image.

元画像を縮小し、その縮小された画像にフィルタ処理を行う場合は、畳み込み演算における積和演算の回数を減少させることができるので、より高速に演算を行うことができる。また、画像を縮小する際に、平均画素法を使用すると、全ての画素の値を反映させることができるので、処理された画像の画質を高画質にすることができる。   When the original image is reduced and filter processing is performed on the reduced image, the number of product-sum operations in the convolution operation can be reduced, so that the operation can be performed at higher speed. Further, when the average pixel method is used when reducing the image, the values of all the pixels can be reflected, so that the image quality of the processed image can be improved.

また、数式1の対数演算を行う回数は、縮小しないレティネック画像を形成する場合に比べて少ないので、処理を高速化することができるとともに、一時記憶する必要があるレティネックス画像を記憶するメモリの記憶容量を削減することができる。   Further, since the number of times the logarithmic calculation of Formula 1 is performed is smaller than that in the case of forming a retinex image that is not reduced, the processing can be speeded up and a memory for storing a retinex image that needs to be temporarily stored is stored. The storage capacity can be reduced.

いずれの場合も、画像を縮小する方法としては、ニアレストネーバ法、バイリニア法、バイキュービック法、平均画素法などを用いることができる。縮小画像を形成した場合に、その縮小画像を記憶し、その記憶した縮小画像に基づいて周辺平均輝度画像を形成し、次に、その周辺平均輝度画像と、記憶した縮小画像とに基づいて縮小レティネックス画像を形成してもよいし、縮小画像を記憶せずに、周辺平均輝度画像を形成する場合および縮小レティネックス画像を形成する場合に縮小画像を形成するようにしてもよい。   In any case, the nearest neighbor method, bilinear method, bicubic method, average pixel method, or the like can be used as a method for reducing an image. When a reduced image is formed, the reduced image is stored, a peripheral average luminance image is formed based on the stored reduced image, and then reduced based on the peripheral average luminance image and the stored reduced image. A Retinex image may be formed, or a reduced image may be formed when a peripheral average luminance image is formed without storing a reduced image and when a reduced Retinex image is formed.

次に図4(a)に示す縮小レティネックス画像を図4(b)に示すレティネックス画像に拡大する方法について説明する。図4(b)は、レティネックス画像を示すテーブルであって、ここでは、元画像と同様に、横16、縦16の画素により構成され、各画素の値Rには、元画像の場合と同様に添え字x、yを付加している。グレーで示す画素の位置については、図4(a)に示す縮小レティネックス画像に対応する値が求められていることを示している。   Next, a method for enlarging the reduced Retinex image shown in FIG. 4A to the Retinex image shown in FIG. 4B will be described. FIG. 4B is a table showing Retinex images. Here, similarly to the original image, the table is composed of 16 pixels in the horizontal direction and 16 pixels in the vertical direction, and the value R of each pixel is the same as in the case of the original image. Similarly, subscripts x and y are added. As for the position of the pixel shown in gray, it indicates that a value corresponding to the reduced Retinex image shown in FIG.

縮小レティネックス画像を拡大する方法には、次に示す5つの方法がある。
(1)第1の方法
最も座標位置が近い縮小レティネックス画像の画素の値とする。
例えば、図4(b)に示すレティネックス画像において、R(0,0)、R(0,1)、R(0,2)、R(1,0)、R(1,1)、R(1,2)、R(2,0)、R(2,1)、R(2,2)の値は、縮小レティネックス画像のQ(0,0)の値とし、R(0,3)、R(0,4)、R(0,5)、R(0,6)、R(1,3)、R(1,4)、R(1,5)、R(1,6)、R(2,3)、R(2,4)、R(2,5)、R(2,6)の値は、縮小レティネックス画像のQ(0,4)の値などとする。
There are the following five methods for enlarging the reduced Retinex image.
(1) First method A pixel value of a reduced Retinex image having the closest coordinate position is used.
For example, in the Retinex image shown in FIG. 4B, R (0,0), R (0,1), R (0,2), R (1,0), R (1,1), R The values of (1,2), R (2,0), R (2,1), R (2,2) are the values of Q (0,0) of the reduced Retinex image, and R (0,3) ), R (0,4), R (0,5), R (0,6), R (1,3), R (1,4), R (1,5), R (1,6) , R (2,3), R (2,4), R (2,5), R (2,6) are the values of Q (0,4) of the reduced Retinex image.

(2)第2の方法
座標位置の周囲4つの位置の縮小レティネックス画像の値から線形補間により求める。
例えば、R(1,1)の値は、次式により求める。
(2) Second method Obtained by linear interpolation from the values of the reduced Retinex images at four positions around the coordinate position.
For example, the value of R (1,1) is obtained by the following equation.

Figure 2007272878
(3)第3の方法
第3の方法については、図5を参照して説明する。図5は、元画像の一部の画素の値を示すテーブルである。求めるレティネックス画像の座標位置に対応する元画像の画素の値に最も近い元画像の画素の値に対応する縮小レティネックス画像の画素の値とする。例えば、R(1,1)を求める場合に、図5に示すようにI(1,1)が190であり、
I(0,0)=200、I(0,4)=180、I(4,0)=195,I(4,4)=210であるとすれば、190に最も近い値である195の値を有するI(4,0)に対応する縮小レティネックス画像の画素の値であるQ(4,0)とする。
尚、図5において、説明に使用しない画素については、その値を「−」で示している。
Figure 2007272878
(3) Third Method The third method will be described with reference to FIG. FIG. 5 is a table showing values of some pixels of the original image. The pixel value of the reduced Retinex image corresponding to the pixel value of the original image closest to the pixel value of the original image corresponding to the coordinate position of the Retinex image to be obtained is set. For example, when R (1,1) is obtained, I (1,1) is 190 as shown in FIG.
If I (0,0) = 200, I (0,4) = 180, I (4,0) = 195, I (4,4) = 210, the value of 195 closest to 190 Let Q (4,0) be the pixel value of the reduced Retinex image corresponding to I (4,0) having a value.
In FIG. 5, the value of a pixel that is not used for description is indicated by “−”.

(4)第4の方法
第3の方法の変形であって、求めるレティネックス画像の座標位置に対応する元画像の画素およびその画素の近傍の画素の平均の値に最も近い元画像の画素の値に対応する縮小レティネックス画像の画素の値とする。例えば、着目する画素の左右上下に隣合う4つの画素との平均をとるものとし、(3)の場合と同様に、I(0,0)=200、I(0,4)=180、I(4,0)=195,I(4,4)=210であり、R(1,1)を求める場合に、I(1,1)の値が190、I(0,1)の値が200、I(1,0)の値が210、I(1,2)の値が215、I(2,1)の値が220であるとすると、平均値は、(190+200+210+215+220)/5=207となる。
したがって、I(0,4)=210の値が最も近いのでQ(0,4)をとる。
(4) Fourth method This is a modification of the third method, in which the pixel of the original image closest to the average value of the pixel of the original image corresponding to the coordinate position of the Retinex image to be obtained and the pixels in the vicinity of the pixel is calculated. The pixel value of the reduced Retinex image corresponding to the value is used. For example, the average of four pixels adjacent to the left and right and up and down of the pixel of interest is taken, and, as in (3), I (0,0) = 200, I (0,4) = 180, I (4,0) = 195, I (4,4) = 210, and when R (1,1) is obtained, the value of I (1,1) is 190, and the value of I (0,1) is Assuming 200, the value of I (1,0) is 210, the value of I (1,2) is 215, and the value of I (2,1) is 220, the average value is (190 + 200 + 210 + 215 + 220) / 5 = 207 It becomes.
Therefore, since the value of I (0,4) = 210 is the closest, Q (0,4) is taken.

尚、ここでは、5つの画素の平均をとるものとしたが、更に対角線上の画素の値を加えて平均を取るようにしてもよい。また、これらの画素の値の最小値と最大値とを検出し、その最小値と最大値との平均値を取るようにしてもよい。   Here, the average of the five pixels is taken, but the value of the pixels on the diagonal line may be added to take the average. Further, the minimum value and the maximum value of these pixel values may be detected, and an average value of the minimum value and the maximum value may be taken.

(5)第5の方法
第2の方法の変形であって、求める画素の近傍の4つの縮小レティネックス画像の画素の値を使用し、求める画素に対応する元画像の値と、その4つの画素の元画像の値との差を重み係数として補間演算を行う。すなわち、まず求める画素に対応する元画像の画素の値と、その近傍の4点に対応する元画像の画素の値との差の絶対値を求める。
例えば、R(1,1)は、次式により演算される。
(5) Fifth method This is a modification of the second method, and uses the values of the four reduced Retinex images in the vicinity of the pixel to be obtained, the values of the original image corresponding to the pixel to be obtained, and the four Interpolation is performed using the difference between the pixel value and the original image as a weighting factor. That is, first, the absolute value of the difference between the pixel value of the original image corresponding to the pixel to be obtained and the pixel value of the original image corresponding to the four neighboring points is obtained.
For example, R (1,1) is calculated by the following equation.

Figure 2007272878
ここで、
diff(0,0)=abs(I(0,0)−I(1,1))
diff(4,0)=abs(I(4,0)−I(1,1))
diff(0,4)=abs(I(0,4)−I(1,1))
diff(4,4)=abs(I(4,4)−I(1,1))
ただし、absは、絶対値である。
次に、これらの絶対値、diff(0,0)、diff(4,0)、diff(0,4)、diff(4,4)のうちの最大値diff_maxを求める。
Figure 2007272878
here,
diff (0,0) = abs (I (0,0) -I (1,1))
diff (4,0) = abs (I (4,0) -I (1,1))
diff (0,4) = abs (I (0,4) -I (1,1))
diff (4,4) = abs (I (4,4) -I (1,1))
Here, abs is an absolute value.
Next, the maximum value diff_max among these absolute values, diff (0, 0), diff (4, 0), diff (0, 4), diff (4, 4) is obtained.

次に、この最大値diff_maxと、各絶対値との差を次式により求め、
difm(0,0)=diff_max−diff(0,0)
difm(4,0)=diff_max−diff(4,0)
difm(0,4)=diff_max−diff(0,4)
difm(4,4)=diff_max−diff(4,4)
これらの和である、diff_sumを、次式により演算する。
diff_sum=difm(0,0)+difm(4,0)+difm(0,4)+
difm(4,4)
各4点の重み係数、W(0,0)、W(4,0)、W(0,4)、W(4,4)は、最大値diff_maxと各絶対値との差を、上記和により除する次式により求められる。
W(0,0)=difm(0,0)/diff_sum
W(4,0)=difm(4,0)/diff_sum
W(0,4)=difm(0,4)/diff_sum
W(4,4)=difm(4,4)/diff_sum
この第5の方法によれば、元画像の画素の濃度値が反映されるので、より高画質の処理画像を得ることができる。
Next, the difference between the maximum value diff_max and each absolute value is obtained by the following equation:
diffm (0,0) = diff_max−diff (0,0)
difm (4,0) = diff_max−diff (4,0)
diffm (0,4) = diff_max−diff (0,4)
difm (4,4) = diff_max−diff (4,4)
Diff_sum, which is the sum of these, is calculated by the following equation.
diff_sum = difm (0,0) + difm (4,0) + difm (0,4) +
difm (4,4)
The weighting factors for each of the four points, W (0,0), W (4,0), W (0,4), and W (4,4) are the sum of the difference between the maximum value diff_max and each absolute value. Is obtained by the following equation.
W (0,0) = diffm (0,0) / diff_sum
W (4,0) = diffm (4,0) / diff_sum
W (0,4) = diffm (0,4) / diff_sum
W (4,4) = diffm (4,4) / diff_sum
According to the fifth method, since the density value of the pixel of the original image is reflected, a processed image with higher image quality can be obtained.

図6は、本発明によるレティネックス処理を行った画像を示す一例であり、図6(a)は、第2の方法により拡大を行った場合の画像を示す、破線Aで示す部分に、シャギーが発生している。一方、図6(b)は、第5の方法により拡大を行った場合の画像であり、図6(a)のようにシャギーを発生することなくレティネックス処理が行われた画像を示す。   FIG. 6 is an example showing an image that has been subjected to Retinex processing according to the present invention, and FIG. 6 (a) shows a shaggy in a portion indicated by a broken line A that shows an image when enlarged by the second method. Has occurred. On the other hand, FIG. 6B shows an image when enlargement is performed by the fifth method, and shows an image that has been subjected to Retinex processing without generating shaggy as shown in FIG.

以上、説明したように上記実施形態によれば、レティネックス処理を行う場合に、元画像の解像度を低下させた縮小レティネックス画像を形成し、次に、その縮小レティネックス画像を拡大するとともに、正規化を行ってレティネックス画像を形成し、さらに元画像とで出力画像を形成するので、縮小レティネック画像を形成する場合の演算を高速化することができるとともに、縮小レティネックス画像は、サイズが小さいのでメモリの記憶容量を削減することができる。よって、画像処理装置を安価に提供することができる。   As described above, according to the above-described embodiment, when performing Retinex processing, a reduced Retinex image in which the resolution of the original image is reduced is formed, and then the reduced Retinex image is enlarged. Since the Retinex image is formed by normalization and the output image is formed with the original image, the calculation for forming the reduced Retinex image can be speeded up, and the reduced Retinex image has a size. Since it is small, the storage capacity of the memory can be reduced. Therefore, the image processing apparatus can be provided at a low cost.

以上、実施形態に基づいて本発明を説明したが、本発明は上記各実施形態に何ら限定されるものでなく、本発明の趣旨を逸脱しない範囲内で種々の改良変形が可能であることは容易に推察できるものである。   As described above, the present invention has been described based on the embodiments. However, the present invention is not limited to the above embodiments, and various improvements and modifications can be made without departing from the spirit of the present invention. It can be easily guessed.

例えば、上記実施形態では、色表現系はRGB形式としたが、RGB形式以外の他の色表現系、例えば、Lab形式や、Ycc形式など、明度と色成分とが分かれている形式の場合には、明度成分(L又はY)に本発明を実施できるから、Lab形式、又はYcc形式にも、本発明を適用しても良い。   For example, in the above embodiment, the color representation system is the RGB format, but other color representation systems other than the RGB format, for example, a format in which brightness and color components are separated, such as Lab format and Ycc format. Since the present invention can be applied to the lightness component (L or Y), the present invention may be applied to the Lab format or the Ycc format.

また、上記実施形態では、ガウス関数を用いて演算によりフィルタ係数を求めるものとしたが、よく用いる画像のサイズや画質に応じて画質の劣化が少ないフィルタを予めメモリに記憶し、その記憶されたフィルタのフィルタ係数と画素の濃度値とを演算することによりフィルタ処理を行うようにしてもよい。   In the above embodiment, the filter coefficient is obtained by calculation using a Gaussian function. However, a filter with little deterioration in image quality according to the size and image quality of a frequently used image is stored in the memory in advance and stored. Filter processing may be performed by calculating the filter coefficient of the filter and the density value of the pixel.

また、上記実施形態では、本発明の画像処理プログラムは、プリンタ1に組み込まれたCPU11により実行されるものとしたが、パーソナルコンピュータにアプリケーションとして供給され、パーソナルコンピュータに組み込まれたCPUなどにより実行されるようにしてもよい。   In the above embodiment, the image processing program of the present invention is executed by the CPU 11 incorporated in the printer 1, but is supplied as an application to the personal computer and executed by the CPU incorporated in the personal computer. You may make it do.

また、レティネックス処理は、SSR(シングルスケール法)であってもMSR(マルチスケール法)であってもよい。   The Retinex process may be SSR (single scale method) or MSR (multiscale method).

また、上記実施形態の画像処理では、CPU11によりレティネックス処理を行うものとしたが、DSP(Digital Signal Processor)により行ってもよい。DSPを用いると、より高速に積和演算などの処理を実行することができる。   In the image processing of the above embodiment, the Retinex processing is performed by the CPU 11, but may be performed by a DSP (Digital Signal Processor). If a DSP is used, processing such as a product-sum operation can be executed at a higher speed.

本発明の実施形態の画像処理プログラムを搭載したプリンタの電気的構成を示すブロック図である。1 is a block diagram showing an electrical configuration of a printer equipped with an image processing program according to an embodiment of the present invention. 画像処理プログラムにより行われる処理を示すフロー図である。It is a flowchart which shows the process performed by an image processing program. (a)は、元画像の画素を示し、(b)は、フィルタの構成を示すテーブルである。(A) shows the pixel of an original image, (b) is a table which shows the structure of a filter. (a)は、縮小レティネックス画像を、(b)は、(a)に示す縮小レティネックス画像を拡大したレティネックス画像を示すテーブルである。(A) is a table showing a reduced Retinex image, and (b) is a table showing a Retinex image obtained by enlarging the reduced Retinex image shown in (a). 元画像の一部の画素を示すテーブルである。It is a table which shows some pixels of an original image. 本発明によるレティネックス処理を行った画像を示す一例であり、(a)は、第2の方法により拡大を行った場合の画像を示し、(b)は、第5の方法により拡大を行った場合の画像を示す。It is an example which shows the image which performed the Retinex process by this invention, (a) shows the image at the time of enlarging by the 2nd method, (b) enlarged by the 5th method An image of the case is shown. 従来の技術におけるレティネックス処理を示すフロー図である。It is a flowchart which shows the Retinex process in a prior art.

符号の説明Explanation of symbols

1 プリンタ
2 パーソナルコンピュータ
11 CPU
12 ROM
12a 画像処理プログラムメモリ
13 RAM
13b 縮小レティネックス画像メモリ
1 Printer 2 Personal Computer 11 CPU
12 ROM
12a Image processing program memory 13 RAM
13b Reduced Retinex image memory

Claims (20)

レティネックス処理をコンピュータにより実行させる画像処理プログラムにおいて、
元画像の周辺平均輝度画像を形成する周辺平均輝度画像形成ステップと、
その周辺平均輝度画像形成ステップにより形成された周辺平均輝度画像と元画像とに基づいて元画像のサイズより小さい画像サイズの縮小レティネックス画像を形成する縮小レティネックス画像形成ステップと、
その縮小レティネックス画像形成ステップにより形成された縮小レティネックス画像を拡大する拡大処理ステップと、
その拡大処理ステップにより拡大された画像情報と、元画像とに基づいて出力画像を形成する出力画像形成ステップとを備えていることを特徴とする画像処理プログラム。
In an image processing program for executing Retinex processing by a computer,
A peripheral average luminance image forming step for forming a peripheral average luminance image of the original image;
A reduced Retinex image forming step for forming a reduced Retinex image having an image size smaller than the size of the original image based on the peripheral average luminance image formed by the peripheral average luminance image forming step and the original image;
An enlargement processing step of enlarging the reduced Retinex image formed by the reduced Retinex image forming step;
An image processing program comprising: an output image forming step for forming an output image based on the image information enlarged by the enlargement processing step and the original image.
前記周辺平均輝度画像形成ステップは、元画像より画像サイズが小さい縮小画像を形成し、その縮小画像の周辺平均輝度画像を形成する縮小周辺平均輝度画像形成ステップを備え、
前記縮小レティネックス画像形成ステップは、前記縮小周辺平均輝度画像形成ステップにより形成された縮小周辺平均輝度画像と縮小画像とに基づいて縮小レティネックス画像を形成することを特徴とする請求項1記載の画像処理プログラム。
The peripheral average luminance image forming step includes a reduced peripheral average luminance image forming step of forming a reduced image having an image size smaller than the original image and forming a peripheral average luminance image of the reduced image,
2. The reduced Retinex image forming step forms a reduced Retinex image based on the reduced peripheral average luminance image and the reduced image formed by the reduced peripheral average luminance image forming step. Image processing program.
前記縮小周辺平均輝度画像形成ステップは、元画像から縮小画像を形成するために最近傍(Nearest Neighbor)法により画素を抽出するサンプリングステップと、そのサンプリングステップにより抽出された画素の値とフィルタ係数との畳み込み演算を行う演算ステップとを備えていることを特徴とする請求項2記載の画像処理プログラム。   The reduced peripheral average luminance image forming step includes a sampling step of extracting pixels by a nearest neighbor method to form a reduced image from the original image, a pixel value extracted by the sampling step, and a filter coefficient, The image processing program according to claim 2, further comprising an operation step for performing a convolution operation. 前記縮小周辺平均輝度画像形成ステップは、元画像を平均画素法により縮小する画像縮小ステップと、その縮小ステップにより縮小された画像の画素とフィルタ係数との畳み込み演算を行う演算ステップとを備えていることを特徴とする請求項2記載の画像処理プログラム。   The reduced peripheral average luminance image forming step includes an image reduction step for reducing the original image by an average pixel method, and a calculation step for performing a convolution operation between the pixels of the image reduced by the reduction step and a filter coefficient. The image processing program according to claim 2, wherein: 前記周辺平均輝度画像形成ステップは、元画像を構成する全画素について周辺平均輝度を求めるフィルタ処理ステップと、そのフィルタ処理ステップにより求められた周辺平均輝度により形成される画像を縮小する縮小ステップとを備えていることを特徴とする請求項1記載の画像処理プログラム。   The peripheral average luminance image forming step includes a filter processing step for obtaining the peripheral average luminance for all the pixels constituting the original image, and a reduction step for reducing the image formed by the peripheral average luminance obtained by the filter processing step. The image processing program according to claim 1, further comprising: 前記拡大処理ステップは、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素の位置の周囲に存在する縮小レティネックス画像の画素の値に基づいて値を取得することを特徴とする請求項1から5のいずれかに記載の画像処理プログラム。   In the case where there is no pixel of the reduced Retinex image corresponding to the pixel constituting the enlarged image, the enlargement processing step is a value based on the value of the pixel of the reduced Retinex image existing around the pixel position. The image processing program according to claim 1, wherein the image processing program is acquired. 前記拡大処理ステップは、前記画素の位置の周囲に存在する縮小レティネックス画像の複数の画素の値に基づいて補間演算により値を求める補間演算ステップを備えていることを特徴とする請求項6記載の画像処理プログラム。   7. The enlargement processing step includes an interpolation calculation step of obtaining values by interpolation calculation based on values of a plurality of pixels of a reduced Retinex image existing around the pixel position. Image processing program. 前記補間演算ステップは、値を求める画素の位置の周囲に存在する縮小レティネックス画像の画素の値と、値を求める画素に対応する元画像の画素の値と前記周囲に存在する画素に対応する元画像の値との差により重み付けを行って補間演算を行うことを特徴とする請求項7記載の画像処理プログラム。   The interpolation calculation step corresponds to the pixel value of the reduced Retinex image existing around the position of the pixel whose value is to be determined, the value of the pixel of the original image corresponding to the pixel whose value is to be determined, and the pixel existing around the pixel. 8. The image processing program according to claim 7, wherein the interpolation calculation is performed by weighting the difference from the value of the original image. 前記拡大処理ステップは、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素に対応する元画像の画素の値に近い値を有し、その画素の周囲に存在する元画像の画素に対応する縮小レティネックス画像の画素の値に基づいて値を取得することを特徴とする請求項1から5のいずれかに記載の画像処理プログラム。   The enlargement processing step has a value close to the value of the pixel of the original image corresponding to the pixel when the pixel of the reduced Retinex image corresponding to the pixel constituting the enlarged image does not exist. 6. The image processing program according to claim 1, wherein a value is acquired based on a value of a pixel of a reduced Retinex image corresponding to a pixel of an original image existing around. 前記拡大処理ステップは、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素に対応する元画像の画素の値と、その元画像の画素の近傍の画素の値との平均値に近い値を有し、その画素の周囲に存在する元画像の画素に対応する縮小レティネックス画像の画素の値に基づいて値を取得することを特徴とする請求項1から5のいずれかに記載の画像処理プログラム。   In the enlargement processing step, when there is no pixel of the reduced Retinex image corresponding to the pixel constituting the enlarged image, the value of the pixel of the original image corresponding to the pixel and the vicinity of the pixel of the original image The value is obtained based on a pixel value of a reduced Retinex image corresponding to a pixel of an original image existing around the pixel and having a value close to an average value of the pixel value. The image processing program according to any one of 1 to 5. レティネックス処理をコンピュータにより実行させる画像処理装置において、
元画像の周辺平均輝度画像を形成する周辺平均輝度画像形成手段と、
その周辺平均輝度画像形成手段により形成された周辺平均輝度画像と元画像とに基づいて元画像のサイズより小さい画像サイズの縮小レティネックス画像を形成する縮小レティネックス画像形成手段と、
その縮小レティネックス画像形成手段により形成された縮小レティネックス画像を拡大する拡大処理手段と、
その拡大処理手段により拡大された画像情報と、元画像とに基づいて出力画像を形成する出力画像形成手段とを備えていることを特徴とする画像処理装置。
In an image processing apparatus that executes Retinex processing by a computer,
A peripheral average luminance image forming means for forming a peripheral average luminance image of the original image;
A reduced Retinex image forming means for forming a reduced Retinex image having an image size smaller than the size of the original image based on the peripheral average brightness image formed by the peripheral average brightness image forming means and the original image;
Enlargement processing means for enlarging the reduced Retinex image formed by the reduced Retinex image forming means,
An image processing apparatus comprising: output image forming means for forming an output image based on image information enlarged by the enlargement processing means and an original image.
前記周辺平均輝度画像形成手段は、元画像より画像サイズが小さい縮小画像を形成し、その縮小画像の周辺平均輝度画像を形成する縮小周辺平均輝度画像形成手段を備え、
前記縮小レティネックス画像形成手段は、前記縮小周辺平均輝度画像形成手段により形成された縮小周辺平均輝度画像と縮小画像とに基づいて縮小レティネックス画像を形成することを特徴とする請求項11記載の画像処理装置。
The peripheral average luminance image forming unit includes a reduced peripheral average luminance image forming unit that forms a reduced image having a smaller image size than the original image and forms a peripheral average luminance image of the reduced image,
12. The reduced Retinex image forming unit forms a reduced Retinex image based on the reduced peripheral average luminance image and the reduced image formed by the reduced peripheral average luminance image forming unit. Image processing device.
前記縮小周辺平均輝度画像形成手段は、元画像から縮小画像を形成するために最近傍法により画素を抽出するサンプリング手段と、そのサンプリング手段により抽出された画素の値とフィルタ係数との畳み込み演算を行う演算手段とを備えていることを特徴とする請求項12記載の画像処理装置。   The reduced peripheral average luminance image forming means is a sampling means for extracting pixels by a nearest neighbor method to form a reduced image from the original image, and a convolution operation between the pixel value extracted by the sampling means and the filter coefficient. The image processing apparatus according to claim 12, further comprising a calculation unit that performs the calculation. 前記縮小周辺平均輝度画像形成手段は、元画像を平均画素法により縮小する画像縮小手段と、その縮小手段により縮小された画像の画素とフィルタ係数との畳み込み演算を行う演算手段とを備えていることを特徴とする請求項12記載の画像処理装置。   The reduced peripheral average luminance image forming means includes an image reducing means for reducing the original image by the average pixel method, and an arithmetic means for performing a convolution operation between the pixels of the image reduced by the reducing means and the filter coefficient. The image processing apparatus according to claim 12. 前記周辺平均輝度画像形成手段は、元画像を構成する全画素について周辺平均輝度を求めるフィルタ処理手段と、そのフィルタ処理手段により求められた周辺平均輝度により形成される画像を縮小する縮小手段とを備えていることを特徴とする請求項11記載の画像処理装置。   The peripheral average brightness image forming means includes a filter processing means for obtaining the peripheral average brightness for all pixels constituting the original image, and a reduction means for reducing an image formed by the peripheral average brightness obtained by the filter processing means. The image processing apparatus according to claim 11, further comprising: 前記拡大処理手段は、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素の位置の周囲に存在する縮小レティネックス画像の画素の値に基づいて値を取得することを特徴とする請求項11から15のいずれかに記載の画像処理装置。   If there is no pixel of the reduced Retinex image corresponding to the pixel constituting the enlarged image, the enlargement processing unit determines a value based on the value of the pixel of the reduced Retinex image existing around the pixel position. The image processing apparatus according to claim 11, further comprising: 前記拡大処理手段は、前記画素の位置の周囲に存在する縮小レティネックス画像の複数の画素の値に基づいて補間演算により値を求める補間演算手段を備えていることを特徴とする請求項16記載の画像処理装置。   17. The enlargement processing means includes interpolation calculation means for obtaining values by interpolation calculation based on values of a plurality of pixels of a reduced Retinex image existing around the pixel position. Image processing apparatus. 前記補間演算手段は、値を求める画素の位置の周囲に存在する縮小レティネックス画像の画素の値と、値を求める画素に対応する元画像の画素の値と前記周囲に存在する画素に対応する元画像の値との差により重み付けを行って補間演算を行うことを特徴とする請求項17記載の画像処理装置。   The interpolation calculation means corresponds to the pixel value of the reduced Retinex image existing around the position of the pixel whose value is to be determined, the value of the pixel of the original image corresponding to the pixel whose value is to be determined, and the pixel existing around the pixel. 18. The image processing apparatus according to claim 17, wherein interpolation is performed by weighting the difference from the value of the original image. 前記拡大処理手段は、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素に対応する元画像の画素の値に近い値を有し、その画素の周囲に存在する元画像の画素に対応する縮小レティネックス画像の画素の値に基づいて値を取得することを特徴とする請求項11から15のいずれかに記載の画像処理装置。   The enlargement processing unit has a value close to the value of the pixel of the original image corresponding to the pixel when the pixel of the reduced Retinex image corresponding to the pixel constituting the enlarged image does not exist, The image processing apparatus according to claim 11, wherein a value is acquired based on a value of a pixel of a reduced Retinex image corresponding to a pixel of an original image existing around. 前記拡大処理手段は、拡大された画像を構成する画素に対応する縮小レティネックス画像の画素が存在しない場合は、その画素に対応する元画像の画素の値と、その元画像の画素の近傍の画素の値との平均値に近い値を有し、その画素の周囲に存在する元画像の画素に対応する縮小レティネックス画像の画素の値に基づいて値を取得することを特徴とする請求項11から15のいずれかに記載の画像処理装置。   If there is no pixel in the reduced Retinex image corresponding to the pixel constituting the enlarged image, the enlargement processing unit determines the value of the pixel in the original image corresponding to the pixel and the vicinity of the pixel in the original image. The value is obtained based on a pixel value of a reduced Retinex image corresponding to a pixel of an original image existing around the pixel and having a value close to an average value of the pixel value. The image processing device according to any one of 11 to 15.
JP2007056555A 2006-03-07 2007-03-07 Image processing program and image processing apparatus Expired - Fee Related JP4687667B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007056555A JP4687667B2 (en) 2006-03-07 2007-03-07 Image processing program and image processing apparatus

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP2006060617 2006-03-07
JP2006060617 2006-03-07
JP2007056555A JP4687667B2 (en) 2006-03-07 2007-03-07 Image processing program and image processing apparatus

Publications (2)

Publication Number Publication Date
JP2007272878A true JP2007272878A (en) 2007-10-18
JP4687667B2 JP4687667B2 (en) 2011-05-25

Family

ID=38675574

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007056555A Expired - Fee Related JP4687667B2 (en) 2006-03-07 2007-03-07 Image processing program and image processing apparatus

Country Status (1)

Country Link
JP (1) JP4687667B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2050800A1 (en) 2007-10-19 2009-04-22 Nitto Denko Corporation Adhesive unit for emblem, method of producing the same, jig for adhering emblem and emblem for adhesion
JP2015192203A (en) * 2014-03-27 2015-11-02 日立マクセル株式会社 Video processing apparatus and projector using the same
JP2021022263A (en) * 2019-07-30 2021-02-18 富士通株式会社 Image processing program, image processing device, image processing system, and image processing method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06326869A (en) * 1993-05-12 1994-11-25 Konica Corp Picture processing unit
JP2004165840A (en) * 2002-11-11 2004-06-10 Minolta Co Ltd Image processing program
JP2005210418A (en) * 2004-01-22 2005-08-04 Sanyo Electric Co Ltd Image processing device, method, and program
JP2005227479A (en) * 2004-02-12 2005-08-25 Seiko Epson Corp Image processor, image processing method, and program having image processing method executed by computer
JP2005308934A (en) * 2004-04-20 2005-11-04 Victor Co Of Japan Ltd Image processing method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06326869A (en) * 1993-05-12 1994-11-25 Konica Corp Picture processing unit
JP2004165840A (en) * 2002-11-11 2004-06-10 Minolta Co Ltd Image processing program
JP2005210418A (en) * 2004-01-22 2005-08-04 Sanyo Electric Co Ltd Image processing device, method, and program
JP2005227479A (en) * 2004-02-12 2005-08-25 Seiko Epson Corp Image processor, image processing method, and program having image processing method executed by computer
JP2005308934A (en) * 2004-04-20 2005-11-04 Victor Co Of Japan Ltd Image processing method

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2050800A1 (en) 2007-10-19 2009-04-22 Nitto Denko Corporation Adhesive unit for emblem, method of producing the same, jig for adhering emblem and emblem for adhesion
JP2015192203A (en) * 2014-03-27 2015-11-02 日立マクセル株式会社 Video processing apparatus and projector using the same
JP2021022263A (en) * 2019-07-30 2021-02-18 富士通株式会社 Image processing program, image processing device, image processing system, and image processing method
JP7445109B2 (en) 2019-07-30 2024-03-07 富士通株式会社 Image processing program, image processing device, image processing system, and image processing method

Also Published As

Publication number Publication date
JP4687667B2 (en) 2011-05-25

Similar Documents

Publication Publication Date Title
JP4118749B2 (en) Image processing apparatus, image processing program, and storage medium
JP4867529B2 (en) Image processing program and image processing apparatus
JP4350778B2 (en) Image processing apparatus, image processing program, and recording medium
JP2010278708A (en) Image processing apparatus and method, and computer program
JP2008059287A (en) Image processor and image processing program
JP5653104B2 (en) Image processing apparatus, image processing method, and program
US20080298723A1 (en) Image processing device
JP4997846B2 (en) Image processing program and image processing apparatus
US20080044099A1 (en) Image processing device that quickly performs retinex process
JP4862554B2 (en) Image processing program and image processing apparatus
JP4687667B2 (en) Image processing program and image processing apparatus
JP4353233B2 (en) Image processing program and image processing apparatus
US8031973B2 (en) Data processing device capable of executing retinex processing at high speed
JP4345027B2 (en) Image processing program and image processing apparatus
JP4661754B2 (en) Image processing apparatus and image processing program
JP4353234B2 (en) Image processing program and image processing apparatus
JP4793166B2 (en) Image processing program and image processing apparatus
JP2004240732A (en) Image compositing method, image compositing device, image compositing program and image recording device
JP4793175B2 (en) Image processing program and image processing apparatus
JP2007233433A (en) Image processing program and image processor
JP2008059307A (en) Image processor and image processing program
US20080056587A1 (en) Image processing device
JP5414384B2 (en) Image processing apparatus, image processing method, and program
JP4710761B2 (en) Image processing program and image processing apparatus
US8649058B2 (en) Method to enhance detailed information

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20071113

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20091105

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20100928

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20101019

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20101220

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20110118

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20110131

R150 Certificate of patent or registration of utility model

Ref document number: 4687667

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140225

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees