JP2005269451A - Image processing apparatus, image processing method and program - Google Patents

Image processing apparatus, image processing method and program Download PDF

Info

Publication number
JP2005269451A
JP2005269451A JP2004081649A JP2004081649A JP2005269451A JP 2005269451 A JP2005269451 A JP 2005269451A JP 2004081649 A JP2004081649 A JP 2004081649A JP 2004081649 A JP2004081649 A JP 2004081649A JP 2005269451 A JP2005269451 A JP 2005269451A
Authority
JP
Japan
Prior art keywords
luminance
block
value
image processing
shading correction
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
JP2004081649A
Other languages
Japanese (ja)
Other versions
JP2005269451A5 (en
JP4375069B2 (en
Inventor
Keiichi Sakurai
敬一 櫻井
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.)
Casio Computer Co Ltd
Original Assignee
Casio Computer Co 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 Casio Computer Co Ltd filed Critical Casio Computer Co Ltd
Priority to JP2004081649A priority Critical patent/JP4375069B2/en
Publication of JP2005269451A publication Critical patent/JP2005269451A/en
Publication of JP2005269451A5 publication Critical patent/JP2005269451A5/ja
Application granted granted Critical
Publication of JP4375069B2 publication Critical patent/JP4375069B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide an image processing apparatus capable of properly correcting an image (especially, shading correction), and to provide an image processing method and a computer. <P>SOLUTION: A digital camera 1 performs projective transformation for an original document image obtained by photographing an original 2, and segments the original document image. The digital camera 1 divides segmented original document image into a plurality of blocks, and acquires the maximum luminance for each block. The paper of the document 2 usually has a bright color, and its maximum luminance corresponds to the luminance of the paper of the document 2. If the difference between the maximum luminance and the minimum luminance of a block is not less than a predetermined value, the digital camera 1 judges that the luminance value of the block is a proper value, obtains a shading correction value of each block on the basis of the acquired maximum luminance value of each block, and performs shading correction of each pixel of each block on the basis of the obtained shading correction value. <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

本発明は、画像処理装置、画像処理方法及びプログラムに関するものである。   The present invention relates to an image processing apparatus, an image processing method, and a program.

デジタルカメラの発達と蓄積型メモリの低価格化に伴い、デジタルカメラを単なる風景や人の撮影だけに用いるのではなく、紙面文書や名刺などの書類、また、会議での筆記された黒板等に表示されたものを撮影し、これらの画像をパーソナルコンピュータ等にデジタル的に保存し、管理をおこなう応用が考えられつつある。   With the development of digital cameras and the low price of storage-type memory, digital cameras are not only used for taking pictures of landscapes and people, but are also used for paper documents, business cards, and blackboards written at meetings. An application is being considered in which what is displayed is photographed, and these images are digitally stored in a personal computer or the like for management.

このように書類や黒板の撮影を行う場合、その撮影対象物を正面かつ垂直に撮影することが望ましい。しかし、机上におかれた書類の撮影を正面かつ垂直に撮影することは困難である。また、黒板を撮影する場合も、撮影者の位置によって、黒板を正面から撮影することが難しい場合もある。また、正面から撮影できたとしても、ライトの映り込みなどの理由で正面から撮影するのを避けた方が好ましい場合もある。このように書類などの対象物を斜め方向から撮影した場合、文字等が斜め、または台形に歪む。もちろん、これらの文字の判読は可能である。しかし、判読できたとしても、読むには非常に疲れやすいものである。またこれらの画像は歪みをもっているので、この画像を再利用することも難しい。   When photographing a document or a blackboard in this way, it is desirable to photograph the photographing object in front and vertically. However, it is difficult to shoot a document placed on the desk vertically and vertically. Also, when shooting a blackboard, it may be difficult to photograph the blackboard from the front depending on the position of the photographer. Even if the image can be taken from the front, it may be preferable to avoid taking the image from the front for reasons such as reflection of light. Thus, when an object such as a document is photographed from an oblique direction, characters and the like are distorted obliquely or trapezoidally. Of course, these characters can be interpreted. However, even if it can be read, it is very tiring to read. Moreover, since these images have distortion, it is difficult to reuse these images.

このような不具合を解消するものとして、例えば、2つの視差のある画像を用いて画像の歪みを補正するようにした画像処理装置がある(例えば、特許文献1参照)。   In order to solve such a problem, for example, there is an image processing apparatus that corrects image distortion by using two parallax images (see, for example, Patent Document 1).

この画像処理装置は、2枚以上の画像に対して視差がなくなるように画像変換を行って貼り合わせることによって合成した補正画像を作成する。   This image processing apparatus creates a corrected image that is synthesized by performing image conversion and combining two or more images so as to eliminate parallax.

このような画像処理装置には、シェーディング(輝度むら)を補正するものがあり、入力画像のシェーディング補正については、p×qの画像をi×iのブロックに分割し、各ブロックの画素値平均を求め、求めた平均値に基づいて各画素の補正量を求め、入力画素値に補正量を乗算するものがある(例えば、特許文献2参照)。   Some of such image processing apparatuses correct shading (brightness unevenness). For shading correction of an input image, a p × q image is divided into i × i blocks, and pixel values of each block are averaged. Is calculated, the correction amount of each pixel is calculated based on the calculated average value, and the input pixel value is multiplied by the correction amount (for example, see Patent Document 2).

また、シェーディング補正を行う画像処理装置として、入力画像を分割した各ブロックの空間周波数または分散値に応じて各ブロック毎にフィルタ係数を切り替えるようにしたものがある(例えば、特許文献3参照)。
特開2001−134751号公報(第5頁、図1) 特開2003−153132号公報(第2−7頁、図1) 特開2003−116048号公報(第2−6頁、図2)
As an image processing apparatus that performs shading correction, there is an apparatus that switches a filter coefficient for each block in accordance with the spatial frequency or dispersion value of each block obtained by dividing an input image (see, for example, Patent Document 3).
JP 2001-134751 (5th page, FIG. 1) JP 2003-153132 A (page 2-7, FIG. 1) JP 2003-1116048 (page 2-6, FIG. 2)

しかし、特許文献2のものでは、各ブロックの画素値平均に基づいて各画素の補正量を求めているため、撮影される原稿にixi以上の大きな領域で図形や絵などが挿入されている場合、その領域においては、正しくシェーディング補正を行うことができない。   However, in Patent Document 2, since the correction amount of each pixel is obtained based on the pixel value average of each block, a figure, a picture, or the like is inserted in a large area greater than or equal to ixi in the photographed document In that region, the shading correction cannot be performed correctly.

また、特許文献3のものでは、各ブロック毎にフィルタ係数を切り替えているため、原稿全体がコントラスト不足のような場合には、良好にシェーディング補正を行うことができない。   Further, in Patent Document 3, since the filter coefficient is switched for each block, shading correction cannot be performed satisfactorily when the entire document has insufficient contrast.

本発明は、このような従来の問題点に鑑みてなされたもので、画像の補正を正しく行うことが可能な画像処理装置、画像処理方法及びコンピュータを提供することを目的とする。   SUMMARY An advantage of some aspects of the invention is that it provides an image processing apparatus, an image processing method, and a computer that can correct an image correctly.

この目的を達成するため、本発明の第1の観点に係る画像処理装置は、
原稿を撮影することによって得られた原稿画像に画像処理を施す画像処理装置において、
前記原稿画像を複数のブロックに分割するブロック分割部と、
前記ブロック分割部が分割した各ブロック内の各画素の輝度値を調べ、ブロック毎に前記原稿の用紙に対応する輝度値を取得するブロック輝度取得部と、
前記ブロック輝度取得部が取得したブロック輝度値に基づいて各ブロックのシェーディング補正値を求め、求めたシェーディング補正値に基づいて各ブロックの各画素に対するシェーディング補正を行うシェーディング補正部と、を備えたことを特徴とする。
In order to achieve this object, an image processing apparatus according to the first aspect of the present invention provides:
In an image processing apparatus that performs image processing on a document image obtained by photographing a document,
A block dividing unit for dividing the document image into a plurality of blocks;
A block luminance obtaining unit that examines the luminance value of each pixel in each block divided by the block dividing unit and obtains a luminance value corresponding to the original paper for each block;
A shading correction unit that calculates a shading correction value for each block based on the block luminance value acquired by the block luminance acquisition unit, and performs shading correction for each pixel of each block based on the calculated shading correction value; It is characterized by.

前記ブロック輝度取得部は、前記原稿の用紙に対応する輝度値として最大輝度値を取得するようにしてもよい。   The block luminance acquisition unit may acquire a maximum luminance value as a luminance value corresponding to the original sheet.

前記ブロック分割部が分割した各ブロックの各画素の輝度値を調べ、ブロック毎に各画素の輝度値のうちの最小輝度値を取得して、前記ブロック輝度取得部が取得した各ブロックの最大輝度値と取得した最小輝度値との差をそれぞれのブロックの輝度範囲として取得する輝度範囲取得部を備え、
前記シェーディング補正部は、前記輝度範囲取得部が取得した各ブロックの前記輝度範囲と適正輝度範囲を判別するために予め設定された設定値とを比較して、前記輝度範囲が前記設定値を越えている場合に、前記ブロック輝度取得部が取得した各ブロックの最大輝度値が、すべてのブロックで目標とされる輝度目標値となるように、各ブロックのシェーディング補正値を求めるようにしてもよい。
The luminance value of each pixel of each block divided by the block dividing unit is examined, the minimum luminance value of the luminance values of each pixel is obtained for each block, and the maximum luminance of each block acquired by the block luminance acquiring unit A luminance range acquisition unit that acquires a difference between the value and the acquired minimum luminance value as a luminance range of each block;
The shading correction unit compares the luminance range of each block acquired by the luminance range acquisition unit with a setting value set in advance to determine an appropriate luminance range, and the luminance range exceeds the setting value. The shading correction value of each block may be obtained so that the maximum luminance value of each block acquired by the block luminance acquisition unit becomes a target luminance target value for all blocks. .

前記シェーディング補正部は、前記輝度範囲取得部が取得した前記輝度範囲が前記設定値以下の場合には、前記ブロック輝度取得部が取得した周辺ブロックの最大輝度値に基づいて、該当するブロックの輝度補間値を求め、求めた輝度補間値が前記輝度目標値となるように、前記輝度範囲が前記設定値以下となるブロックのシェーディング補正値を求めるようにしてもよい。   When the luminance range acquired by the luminance range acquisition unit is equal to or less than the set value, the shading correction unit determines the luminance of the corresponding block based on the maximum luminance value of the peripheral block acquired by the block luminance acquisition unit. An interpolation value may be obtained, and a shading correction value for a block in which the luminance range is equal to or less than the set value may be obtained so that the obtained luminance interpolation value becomes the luminance target value.

前記ブロック輝度取得部と前記輝度範囲取得部とは、ブロック毎に輝度ヒストグラムを生成し、生成した輝度ヒストグラムから、前記最大輝度値、最小輝度値を取得するようにしてもよい。   The block luminance acquisition unit and the luminance range acquisition unit may generate a luminance histogram for each block, and acquire the maximum luminance value and the minimum luminance value from the generated luminance histogram.

前記シェーディング補正部は、ブロック毎に、前記輝度範囲取得部が取得したブロックの輝度範囲と前記輝度範囲に対して予め設定されたシェーディング補正の下限値とを比較し、前記輝度範囲が前記下限値未満であるブロックについては、前記シェーディング補正を停止するようにしてもよい。   The shading correction unit compares, for each block, the luminance range of the block acquired by the luminance range acquisition unit with a lower limit value of shading correction preset for the luminance range, and the luminance range is the lower limit value. The shading correction may be stopped for blocks that are less than the number.

前記ブロック分割部が分割した各ブロックの各画素の輝度値を調べ、ブロック毎に各ブロック内の平均輝度値を取得し、前記ブロック輝度取得部が取得した各ブロックの最大輝度値と前記取得した平均輝度値との差分をそれぞれのブロックについて取得する平均輝度差取得部を備え、
前記シェーディング補正部は、ブロック毎に、前記平均輝度差取得部が取得した前記差分と前記差分に対して予め設定されたシェーディング補正の上限値とを比較し、前記差分が前記上限値を越えたブロックについては、求めたシェーディング補正値を低減するようにしてもよい。
The luminance value of each pixel of each block divided by the block dividing unit is examined, the average luminance value in each block is acquired for each block, and the maximum luminance value of each block acquired by the block luminance acquiring unit and the acquired An average luminance difference acquisition unit that acquires a difference from the average luminance value for each block,
The shading correction unit compares, for each block, the difference acquired by the average luminance difference acquisition unit and an upper limit value of shading correction set in advance for the difference, and the difference exceeds the upper limit value. For the block, the obtained shading correction value may be reduced.

前記シェーディング補正部が各ブロックの各画素に対してシェーディング補正を行った画像に対して、前記シェーディング補正に用いたパラメータを取得して輝度補正を行う輝度補正部を備えてもよい。   You may provide the brightness correction part which acquires the parameter used for the said shading correction, and performs brightness correction with respect to the image which the said shading correction part performed the shading correction with respect to each pixel of each block.

前記輝度補正部は、指定された輝度値の範囲を、取得したパラメータに基づいて、予め設定された範囲に引き伸ばすようにしてもよい。   The luminance correction unit may extend the specified luminance value range to a preset range based on the acquired parameter.

本発明の第2の観点に係る画像処理方法は、
原稿の画像を複数のブロックに分割するステップと、
前記分割した各ブロック内の各画素の輝度値を調べ、ブロック毎に前記原稿の用紙に対応する輝度値を取得するステップと、
前記取得したブロック輝度値に基づいて各ブロックのシェーディング補正値を求め、求めたシェーディング補正値に基づいて各ブロックの各画素に対するシェーディング補正を行うステップと、を備えたことを備えたことを特徴とする。
An image processing method according to a second aspect of the present invention includes:
Dividing the document image into a plurality of blocks;
Examining the luminance value of each pixel in each of the divided blocks, and obtaining the luminance value corresponding to the original paper for each block;
Obtaining a shading correction value for each block based on the acquired block luminance value, and performing a shading correction for each pixel of each block based on the obtained shading correction value. To do.

本発明の第3の観点に係るプログラムは、
コンピュータに、
原稿の画像を複数のブロックに分割する手順、
前記分割した各ブロック内の各画素の輝度値を調べ、ブロック毎に前記原稿の用紙に対応する輝度値を取得する手順、
前記取得したブロック輝度値に基づいて各ブロックのシェーディング補正値を求め、求めたシェーディング補正値に基づいて各ブロックの各画素に対するシェーディング補正を行う手順、
を実行させるためのものである。
The program according to the third aspect of the present invention is:
On the computer,
The procedure to divide the original image into multiple blocks,
A procedure for examining the luminance value of each pixel in each of the divided blocks and obtaining the luminance value corresponding to the original paper for each block;
A procedure for obtaining a shading correction value for each block based on the acquired block luminance value, and performing a shading correction for each pixel of each block based on the obtained shading correction value;
Is to execute.

本発明によれば、画像の補正を正しく行うことができる。   According to the present invention, it is possible to correct an image correctly.

以下、本発明の実施形態に係る画像処理装置を図面を参照して説明する。
尚、本実施形態では、画像処理装置をデジタルカメラに適用した場合について説明する。
Hereinafter, an image processing apparatus according to an embodiment of the present invention will be described with reference to the drawings.
In the present embodiment, a case where the image processing apparatus is applied to a digital camera will be described.

本実施形態に係るデジタルカメラ1の構成を図1に示す。
本実施形態に係るデジタルカメラ1は、目的とする撮影対象として、文字、図、写真等の原稿2を撮影し、撮影によって得られた原稿画像から、あたかも正面から撮影したような画像を生成するものである。デジタルカメラ1は、撮影レンズ部11と、液晶モニタ12と、シャッタボタン13と、を備える。
A configuration of a digital camera 1 according to the present embodiment is shown in FIG.
The digital camera 1 according to the present embodiment shoots a document 2 such as a character, a figure, and a photograph as a target shooting target, and generates an image as if it was shot from the front from a document image obtained by shooting. Is. The digital camera 1 includes a photographic lens unit 11, a liquid crystal monitor 12, and a shutter button 13.

撮影レンズ部11は、光を集光するレンズ等を備え、原稿2からの光を集光するものである。   The photographing lens unit 11 includes a lens that collects light and the like, and collects light from the document 2.

液晶モニタ12は、撮影レンズ部11を介して内部に取り込まれた画像を映し出すためのものである。
シャッタボタン13は、撮影対象を撮影するときに押下するものである。
The liquid crystal monitor 12 is for projecting an image taken in through the photographing lens unit 11.
The shutter button 13 is pressed when shooting a shooting target.

このデジタルカメラ1は、図2に示すように、光学レンズ装置21と、イメージセンサ22と、メモリ23と、表示装置24と、画像処理装置25と、操作部26と、コンピュータインタフェース部27と、外部記憶IO装置28と、プログラムコード記憶装置29と、を備えて構成される。   As shown in FIG. 2, the digital camera 1 includes an optical lens device 21, an image sensor 22, a memory 23, a display device 24, an image processing device 25, an operation unit 26, a computer interface unit 27, An external storage IO device 28 and a program code storage device 29 are provided.

光学レンズ装置21は、撮影レンズ部11とその駆動部とを備えたものであり、イメージセンサ22上に、原稿2の文字、図、写真等からの光を集光させて像を結像させる。   The optical lens device 21 includes a photographic lens unit 11 and a driving unit thereof, and forms an image on the image sensor 22 by condensing light from characters, drawings, photographs, and the like of the document 2. .

イメージセンサ22は、結像した画像を、デジタル化した画像データとして取り込むためのものであり、CCD等によって構成される。イメージセンサ22は、CPU30によって制御され、シャッタボタン13が押下されなければ、プレビュー用の解像度の低いデジタルの画像データを生成し、この画像データを秒30枚程度の間隔で、定期的にメモリ23に送出する。また、イメージセンサ22は、シャッタボタン13が押下されると、解像度の高い画像データを生成し、生成した画像データをメモリ23に送出する。   The image sensor 22 is for capturing a formed image as digitized image data, and is constituted by a CCD or the like. If the image sensor 22 is controlled by the CPU 30 and the shutter button 13 is not pressed, digital image data having a low preview resolution is generated, and the image data is periodically stored in the memory 23 at intervals of about 30 sheets per second. To send. Further, when the shutter button 13 is pressed, the image sensor 22 generates image data with high resolution and sends the generated image data to the memory 23.

メモリ23は、イメージセンサ22からの低解像度のプレビュー画像、高解像度の画像データ又は画像処理装置25が画像処理する元画像のデータ、処理後の画像データを一時記憶するものである。メモリ23は、一時記憶した画像データを表示装置24又は画像処理装置25に送り出す。尚、メモリ23は、画像処理装置25、CPU30が処理を実行するのに必要なデータ、各種閾値を記憶する。   The memory 23 temporarily stores low-resolution preview images from the image sensor 22, high-resolution image data, original image data processed by the image processing device 25, and processed image data. The memory 23 sends the temporarily stored image data to the display device 24 or the image processing device 25. The memory 23 stores data necessary for the image processing device 25 and the CPU 30 to execute processing and various threshold values.

表示装置24は、液晶モニタ12を備え、液晶モニタ12に画像を表示させるためのものである。表示装置24は、メモリ23が一時記憶した低解像度のプレビュー画像又は解像度の高い画像を液晶モニタ12に表示する。   The display device 24 includes the liquid crystal monitor 12 and displays the image on the liquid crystal monitor 12. The display device 24 displays a low-resolution preview image or a high-resolution image temporarily stored in the memory 23 on the liquid crystal monitor 12.

画像処理装置25は、メモリ23に一時記憶された画像データに対して、画像データの圧縮、画像の歪み補正、画像効果処理等の画像処理を行うためのものである。   The image processing device 25 is for performing image processing such as image data compression, image distortion correction, and image effect processing on the image data temporarily stored in the memory 23.

デジタルカメラ1が、図3(a)にそれぞれ示すように、原稿2に向かって斜め左方向、右方向から撮影すると、液晶モニタ12には、それぞれ、図3(b),(c)に示すように、原稿画像が歪んで表示される。画像処理装置25は、CPU30に制御されて、この図3(b),(c)に示すような台形画像(原稿画像)の画像歪みを補正するため、歪んだ画像から四角形を切り取る。そして、画像処理装置25は、切り取った四角形に撮影画像を射影変換することによって、図3(d)に示すような、あたかも正面から撮影したような画像を生成する。   As shown in FIG. 3A, when the digital camera 1 shoots from the left direction and the right direction toward the document 2, the liquid crystal monitor 12 displays the images shown in FIGS. 3B and 3C, respectively. As described above, the original image is displayed in a distorted manner. The image processing device 25 is controlled by the CPU 30 to cut out a quadrangle from the distorted image in order to correct the image distortion of the trapezoidal image (original image) as shown in FIGS. Then, the image processing device 25 performs projective transformation of the photographed image into the cut rectangle, thereby generating an image as if photographed from the front as shown in FIG.

さらに、画像処理装置25は、射影変換後の原稿画像を切り出し、シェーディング補正、画像効果処理を行い、図3(e)に示すような、鮮明化した原稿画像を生成する。尚、シェーディング補正、画像効果処理については、後述する。   Further, the image processing device 25 cuts out the document image after the projective conversion, performs shading correction and image effect processing, and generates a sharpened document image as shown in FIG. Shading correction and image effect processing will be described later.

操作部26は、書画投影の機能を制御するためのスイッチ、キーを備えたものである。操作部26は、ユーザが、これらのスイッチ、キーを押下すると、応答してこのときの操作情報をCPU30に送信する。   The operation unit 26 includes switches and keys for controlling the document projection function. When the user presses these switches and keys, the operation unit 26 responds and transmits the operation information at this time to the CPU 30.

また、操作部26は、射影変換キー、撮影キー、再生キー、カーソルキー、コントロールキー等(図示せず)を備える。射影変換キーは、射影変換として、画像の上下左右の縮小、回転を指示するためのキーである。   The operation unit 26 includes a projective conversion key, a photographing key, a reproduction key, a cursor key, a control key, and the like (not shown). The projective conversion key is a key for instructing the vertical and horizontal reduction and rotation of the image as the projective conversion.

撮影キーは、撮影対象を撮影するときの撮影モードを選択するためのキーである。再生キーは、撮影によって得られた撮影対象画像を再生するときの再生モードを選択するためのキーである。コントロールキーは、操作を確定させるYESキー、操作をキャンセルするためのNOキー、編集を行うための編集キー等の機能を有するキーである。   The shooting key is a key for selecting a shooting mode when shooting a shooting target. The reproduction key is a key for selecting a reproduction mode for reproducing an image to be photographed obtained by photographing. The control key is a key having functions such as a YES key for confirming the operation, a NO key for canceling the operation, and an editing key for performing editing.

コンピュータインタフェース部27は、デジタルカメラ1がコンピュータ(図示せず)に接続されたときに、USBのストアレジクラスドライバとして動作するものである。これにより、コンピュータは、デジタルカメラ1に接続されると、メモリカード31をコンピュータの外部記憶装置として取り扱う。   The computer interface unit 27 operates as a USB store registration class driver when the digital camera 1 is connected to a computer (not shown). Thus, when the computer is connected to the digital camera 1, the computer handles the memory card 31 as an external storage device of the computer.

外部記憶IO装置28は、メモリカード31との間で、画像データ等の入出力を行うものである。メモリカード31は、外部記憶IO装置28から供給された画像データ等を記憶するものである。   The external storage IO device 28 inputs and outputs image data and the like with the memory card 31. The memory card 31 stores image data and the like supplied from the external storage IO device 28.

プログラムコード記憶装置29は、CPU30が実行するプログラムを記憶するためのものであり、ROM等によって構成される。   The program code storage device 29 is for storing a program executed by the CPU 30, and is configured by a ROM or the like.

CPU30は、プログラムコード記憶装置29に格納されているプログラムに従って、システム全体を制御するものである。尚、メモリ23は、CPU30の作業メモリとしても用いられる。   The CPU 30 controls the entire system according to a program stored in the program code storage device 29. The memory 23 is also used as a work memory for the CPU 30.

操作部26のスイッチ、キーが押下されることにより、操作部26から操作情報が送信されると、CPU30は、この操作情報に基づいて、イメージセンサ22、メモリ23、表示装置24,画像処理装置25等を制御する。   When operation information is transmitted from the operation unit 26 by pressing a switch or key of the operation unit 26, the CPU 30 performs image sensor 22, memory 23, display device 24, image processing device based on the operation information. 25 etc. are controlled.

具体的には、CPU30は、操作部26から、撮影キーが押下された旨の操作情報が送信されると、各部を撮影モードに設定する。CPU30は、撮影モードに設定した状態で、シャッタボタン13が押下されなければ、イメージセンサ22をプレビューモードに設定し、シャッタボタン13が押下されれば、解像度の高い撮影対象画像を読み込む高解像度モードに設定する。また、CPU30は、再生キーが押下された旨の操作情報が送信されると、各部を再生モードに設定する。   Specifically, when the operation information indicating that the photographing key is pressed is transmitted from the operation unit 26, the CPU 30 sets each unit to the photographing mode. The CPU 30 sets the image sensor 22 to the preview mode if the shutter button 13 is not pressed in the state set to the shooting mode, and reads the high-resolution shooting target image if the shutter button 13 is pressed. Set to. Further, when the operation information indicating that the reproduction key is pressed is transmitted, the CPU 30 sets each unit to the reproduction mode.

また、CPU30は、操作部26から、射影変換キー、回転補正キーが押下された旨の操作情報が送信されると、これらの操作情報を画像処理装置25に送信して、画像処理装置25を制御する。   Further, when the operation information indicating that the projection conversion key and the rotation correction key are pressed is transmitted from the operation unit 26, the CPU 30 transmits the operation information to the image processing device 25, and causes the image processing device 25 to operate. Control.

CPU30は、メモリ23に画像データを一時記憶する際、プレビュー画像、高解像度の画像データを異なる記憶領域に記録する。   When the image data is temporarily stored in the memory 23, the CPU 30 records the preview image and the high-resolution image data in different storage areas.

また、CPU30は、外部記憶IO装置28を介してメモリカード31に、プレビュー画像、高解像度の画像のデータを記録したり、メモリカード31から、記録された画像データを読み出したりする。CPU30は、このため、メモリカード31に、画像データを格納する画像ファイルを作成する。   Further, the CPU 30 records preview image and high-resolution image data on the memory card 31 via the external storage IO device 28, and reads the recorded image data from the memory card 31. For this reason, the CPU 30 creates an image file for storing image data in the memory card 31.

そして、CPU30は、例えば、JPEGフォーマットで圧縮した補正後の画像データを画像ファイルに分けて記録する。さらに、CPU30は、各画像ファイルに、画像ファイルのヘッダ情報記憶領域を作成し、画像データを記録する際、画像処理装置25が求めた射影パラメータ、画像効果処理補正用パラメータといった画像データに関するヘッダ情報を、このヘッダ情報記憶領域に記録する。   Then, for example, the CPU 30 records the corrected image data compressed in the JPEG format into image files. Further, the CPU 30 creates a header information storage area of the image file for each image file and records the image data, such as the projection parameters and image effect processing correction parameters obtained by the image processing device 25 when the image data is recorded. Is recorded in this header information storage area.

次に実施形態に係るデジタルカメラ1の動作を説明する。
ユーザがデジタルカメラ1の電源をオン(投入)すると、CPU30はプログラムコード記憶装置29に記憶されているプログラムのデータを取得する。ユーザがモードスイッチによりモードを撮影モードにして、シャッタボタン13を押下すると、操作部26は、この操作情報をCPU30に送信する。CPU30はこの操作情報を受信し、CPU30、画像処理装置25等は、図4に示すフローチャートに従って撮影処理を実行する。
Next, the operation of the digital camera 1 according to the embodiment will be described.
When the user turns on (turns on) the digital camera 1, the CPU 30 acquires program data stored in the program code storage device 29. When the user switches the mode to the shooting mode with the mode switch and presses the shutter button 13, the operation unit 26 transmits this operation information to the CPU 30. The CPU 30 receives this operation information, and the CPU 30, the image processing device 25, etc. execute a photographing process according to the flowchart shown in FIG.

CPU30は、イメージセンサ22をプレビューモードに設定する(ステップS11)。
CPU30は、操作部26から送信された操作情報に基づいてシャッタボタン13が押下されたか否かを判定する(ステップS12)。
The CPU 30 sets the image sensor 22 to the preview mode (step S11).
The CPU 30 determines whether or not the shutter button 13 has been pressed based on the operation information transmitted from the operation unit 26 (step S12).

シャッタボタン13が押下されたと判定した場合(ステップS12においてYes)、CPU30は、プレビューモードから高解像度モードに切り替えてイメージセンサ22を制御する(ステップS13)。   When it is determined that the shutter button 13 has been pressed (Yes in Step S12), the CPU 30 controls the image sensor 22 by switching from the preview mode to the high resolution mode (Step S13).

CPU30は、イメージセンサ22が生成した高解像度の撮影対象画像のデータを、メモリ23上のプレビュー画像とは異なる記憶領域に記録する(ステップS14)。   The CPU 30 records the high-resolution photographic target image data generated by the image sensor 22 in a storage area different from the preview image on the memory 23 (step S14).

CPU30は画像データの読み込みが終了したか否かを判定する(ステップS15)。
読み込みが終了していないと判定した場合(ステップS15においてNo)、CPU30は、引き続き、画像データの読み込みを行うようにイメージセンサ22を制御する。
The CPU 30 determines whether the reading of the image data has been completed (step S15).
If it is determined that the reading has not been completed (No in step S15), the CPU 30 continues to control the image sensor 22 to read the image data.

画像データをすべて読み込んで画像送信も終了したと判定した場合(ステップS15においてYes)、CPU30は、この撮影画像(高解像度画像)から、低解像度のプレビュー画像を生成し、メモリ23のプレビュー画像用の記憶領域上に、プレビュー画像のデータを書き込む(ステップS16)。   When it is determined that all the image data has been read and the image transmission has been completed (Yes in step S15), the CPU 30 generates a low-resolution preview image from the captured image (high-resolution image), and uses the preview image in the memory 23 for the preview image. The preview image data is written in the storage area (step S16).

画像処理装置25は、CPU30の制御の下、撮影画像から、撮影対象である原稿画像の輪郭を取得し、取得した撮影対象の輪郭に基づいて射影変換画像を作成する(ステップS17)。   Under the control of the CPU 30, the image processing device 25 acquires the outline of the document image that is the shooting target from the shot image, and creates a projective conversion image based on the acquired outline of the shooting target (step S17).

画像処理装置25は、射影変換後の原稿画像の切り出しを行う(ステップS18)。
画像処理装置25は、切り出した原稿画像の画像効果処理を行う(ステップS19)。この詳細については後述する。
The image processing device 25 cuts out the document image after projective conversion (step S18).
The image processing device 25 performs image effect processing on the clipped document image (step S19). Details of this will be described later.

画像処理装置25は、画像効果処理が行われた画像データに対して、圧縮処理を行い、変換画像の圧縮データを作成する(ステップS20)。   The image processing device 25 performs compression processing on the image data on which the image effect processing has been performed, and creates compressed data of the converted image (step S20).

画像処理装置25は、作成された変換画像の圧縮データをメモリカード31に記録する(ステップS21)。   The image processing device 25 records the created compressed data of the converted image on the memory card 31 (step S21).

次に、画像処理装置25が行う画像効果処理(図4のステップS19の処理)について説明する。
画像処理装置25は、以下のような画像効果処理を実行する。
(1)原稿画像の切り出し
(2)画像効果補正用パラメータの抽出
(3)シェーディング補正
(4)輝度補正
(5)色補正
この処理の内容について説明する。
(1)原稿画像の切り出し
画像処理装置25は、図3(d)に示すような画像から、原稿画像を切り出す。撮影対象の画像には、写真、図形、文字等の実体的な画像だけでなく、原稿2の面上の影等のように、撮影対象物の内容に無関係の画像も写っている場合がある。
Next, the image effect process (the process of step S19 in FIG. 4) performed by the image processing apparatus 25 will be described.
The image processing device 25 performs the following image effect processing.
(1) Document image cutout (2) Image effect correction parameter extraction (3) Shading correction (4) Brightness correction (5) Color correction The contents of this processing will be described.
(1) Cutout of Document Image The image processing device 25 cuts out a document image from an image as shown in FIG. The image to be photographed may include not only a substantial image such as a photograph, a figure, a character, but also an image irrelevant to the content of the object to be photographed, such as a shadow on the surface of the document 2. .

撮影対象物の周辺部の画像も含めてヒストグラムを生成すると、ヒストグラムの引き伸ばしなどが有効に機能しない場合がある。このため、画像処理装置25は、画像効果補正用パラメータを取り出すときにのみ、実対象部の画像を切り出す。   If a histogram is generated including an image of the periphery of the object to be photographed, stretching of the histogram may not function effectively. For this reason, the image processing device 25 cuts out the image of the actual target portion only when extracting the image effect correction parameters.

(2)画像効果補正用パラメータの抽出
画像効果補正用パラメータは、輝度ヒストグラムの最大値、最小値、ピーク値、色差ヒストグラムのピーク値、平均値といった画像効果処理に必要な変数である。
(2) Extraction of image effect correction parameters The image effect correction parameters are variables necessary for image effect processing, such as a maximum value, a minimum value, a peak value of a luminance histogram, and a peak value and an average value of a color difference histogram.

輝度ヒストグラムは、画像に存在する輝度値(Y)の分布を示すものであり、輝度値毎に画素の数を計数することにより生成される。図5に輝度ヒストグラムの一例を示す。図5において、横軸は、輝度値(Y)を示し、縦軸は、画素数を示す。画像効果を補正するのに、輝度ヒストグラムパラメータである最大値(Ymax)、最小値(Ymin)、ピーク値(Ypeak)を利用することは有効である。画像処理装置25は、この輝度ヒストグラムを生成し、この輝度ヒストグラムから、これらの画像効果補正用パラメータを抽出する。   The luminance histogram indicates the distribution of luminance values (Y) existing in the image, and is generated by counting the number of pixels for each luminance value. FIG. 5 shows an example of the luminance histogram. In FIG. 5, the horizontal axis indicates the luminance value (Y), and the vertical axis indicates the number of pixels. In order to correct the image effect, it is effective to use the maximum value (Ymax), minimum value (Ymin), and peak value (Ypeak) which are luminance histogram parameters. The image processing device 25 generates this luminance histogram, and extracts these image effect correction parameters from this luminance histogram.

(3)シェーディング補正
シェーディング補正は、照明条件により、撮影された資料に生じた輝度むらを補正する処理である。資料の白色の背景をいかに白くするかということが画像の鮮明化に大きな影響を与える。シェーディング(輝度むら)を含んだ画像の輝度を一様に引き伸ばした場合、原稿2の白い下地色でも、輝度引き伸ばし処理によって灰色になってしまい、不快な画像になる場合がある。また、コントラスト不足の画像の場合には、原稿2の下地が黒くなってしまい、見ずらい画像になる場合がある。このため、照明効果を除去することが必要になる。
(3) Shading correction Shading correction is a process of correcting luminance unevenness that has occurred in a photographed material according to illumination conditions. How to make the white background of the material white has a great effect on the sharpness of the image. When the brightness of an image including shading (brightness unevenness) is uniformly stretched, even the white background color of the document 2 may become gray due to the brightness stretching process, resulting in an unpleasant image. Also, in the case of an image with insufficient contrast, the background of the document 2 may become black, and the image may be difficult to see. For this reason, it is necessary to remove the lighting effect.

本実施形態では、より効果的に鮮明化された画像を取得するため、予め輝度のシェーディング補正を行ってから輝度補正を行うものとする。   In the present embodiment, in order to acquire a sharpened image more effectively, the luminance correction is performed after the luminance shading correction is performed in advance.

また、本実施形態では、p×qの画像をI×Jのブロックに分割し、各ブロックごとにシェーディング補正を行うものとする。一例として、図6に画像を5×5のサブブロックに分割したものを示す。尚、図6において、I,Jは、分割されたブロックのインデックスを示す。各横軸でI番、縦軸でJ番目のブロックの輝度最大値、最小値、ピーク値を、それぞれ、Ymax(I,J),Ymin(I,J),Ypeak(I,J)とする。   In this embodiment, it is assumed that a p × q image is divided into I × J blocks, and shading correction is performed for each block. As an example, FIG. 6 shows an image divided into 5 × 5 sub-blocks. In FIG. 6, I and J indicate the indexes of the divided blocks. Ymax (I, J), Ymin (I, J), and Ypeak (I, J) are the luminance maximum value, minimum value, and peak value of the I-th block on each horizontal axis and the J-th block on the vertical axis. .

シェーディング補正を行う場合、輝度平均値は下地の輝度と、原稿2に書かれた文字やグラフ上の輝度との影響を受けるので好ましくない。撮影対象である原稿2の画像に対する照明は、資料の各領域の輝度の最大値に反映されていると予想される。従って、本実施形態では、輝度の最大値のみを資料の下地の輝度情報として取得する。   In the case of performing shading correction, the average luminance value is not preferable because it is affected by the luminance of the background and the luminance on characters and graphs written on the document 2. It is expected that the illumination on the image of the document 2 to be photographed is reflected in the maximum luminance value of each area of the material. Therefore, in the present embodiment, only the maximum luminance value is acquired as the luminance information of the background of the material.

次に、各ブロックの最大値によって、シェーディングを予想した場合において、分割されたブロック領域において、そのブロック内が図や写真しかなく、まったく下地がない場合には、そのブロックの輝度の最大値は下地の輝度を示すことにはならない。下地の輝度を示さなければ、輝度の最大値は、シェーディング補正に悪影響を与える。これを回避するためには、輝度の最大値と最小値との差を利用する。この差が他のブロックと比較して小さい場合には、このブロックは図や写真でのみから構成されていると判断して、該当ブロックの輝度情報をシェーディング補正に用いないようにするのが好ましい。   Next, when shading is predicted according to the maximum value of each block, in the divided block area, if the block contains only figures and photographs and there is no background, the maximum value of the luminance of the block is It does not indicate the brightness of the groundwork. If the luminance of the background is not indicated, the maximum luminance value adversely affects the shading correction. In order to avoid this, the difference between the maximum value and the minimum value of luminance is used. If this difference is small compared to other blocks, it is preferable to determine that this block is composed only of figures and photographs and not use the luminance information of the corresponding block for shading correction. .

シェーディング補正を行うためには、まず、各ブロックのシェーディング補正量を計算する必要がある。このシェーディング補正量の計算について説明する。
シェーディング補正量を計算するには、まず、各ブロックの輝度範囲Yrangeを計算する。輝度範囲Yrangeは、次の数1によって表される。

Figure 2005269451
In order to perform shading correction, it is first necessary to calculate the shading correction amount of each block. The calculation of the shading correction amount will be described.
To calculate the shading correction amount, first, the luminance range Yrange of each block is calculated. The luminance range Yrange is expressed by the following formula 1.
Figure 2005269451

輝度範囲Yrangeが小さいブロックが多い場合は、原稿2がないか、あるいはほとんど原稿2に文字等が記載されていない用紙と判断される。この場合、シェーディング補正を行わない方がよい。   If there are many blocks with a small luminance range Yrange, it is determined that the document 2 is not present, or the sheet 2 has almost no characters or the like written on it. In this case, it is better not to perform shading correction.

画像処理装置25は、輝度範囲Yrangeが小さければ、Yrangeを0に書き換えて、Yrangeを0のブロック数をカウントし、そのカウント数をSmallDispertionCountとする。画像処理装置25は、Yrangeが小さいブロックが多いか否かを判定するため、ブロックの輝度範囲Yrangeと予め設定された閾値Y_RANGE_MINとを比較する。画像処理装置25は、輝度範囲Yrangeが閾値Y_RANGE_MIN以下であれば、輝度範囲Yrangeが小さいと判定する。メモリ23は、カウント数SmallDispertionCountと閾値Y_RANGE_MINとを記憶する。   If the luminance range Yrange is small, the image processing device 25 rewrites Yrange to 0, counts the number of blocks where Yrange is 0, and sets the count to SmallDispertionCount. The image processing device 25 compares the luminance range Yrange of the block with a preset threshold Y_RANGE_MIN in order to determine whether there are many blocks with a small Yrange. The image processing device 25 determines that the luminance range Yrange is small if the luminance range Yrange is less than or equal to the threshold Y_RANGE_MIN. The memory 23 stores a count number SmallDispertionCount and a threshold value Y_RANGE_MIN.

また、画像処理装置25は、輝度範囲Yrangeが小さいブロックが多いか否かを判定するため、カウント数SmallDispertionCountと予め設定された閾値MIN_SMALL_DISPERTION_COUNTとを比較する。閾値MIN_SMALL_DISPERTION_COUNTは、この判定を行うために予め設定された値であり、メモリ23は、閾値MIN_SMALL_DISPERTION_COUNTを予め記憶する。   Further, the image processing device 25 compares the count number SmallDispertionCount with a preset threshold value MIN_SMALL_DISPERTION_COUNT in order to determine whether there are many blocks with a small luminance range Yrange. The threshold value MIN_SMALL_DISPERTION_COUNT is a value set in advance for performing this determination, and the memory 23 stores the threshold value MIN_SMALL_DISPERTION_COUNT in advance.

そして、画像処理装置25は、カウント数SmallDispertionCountがMIN_SMALL_DISPERTION_COUNTより多いと判定した場合には、原稿2がないか、あるいはほとんど原稿2に文字等が記載されていない用紙と判定して、シェーディング補正を行わないものとする。   If the image processing apparatus 25 determines that the count number SmallDispertionCount is greater than MIN_SMALL_DISPERTION_COUNT, the image processing apparatus 25 determines that the document 2 is not present or has almost no characters on the document 2 and performs shading correction. Make it not exist.

次に、シェーディング補正により、用紙全体を均一の明るさにするためには、各ブロックの最大輝度値Ymax(I,J)がほぼ同じ目標値になるようにすることが望ましい。用紙全体が均一の明るさになれば、シェーディング補正の目的は達成される。
このため、最大輝度値をYmax(I,J)として、本実施形態では、ブロックの最大輝度値Ymax(I,J)がYmaxmaxになるようにする。
Next, in order to make the entire sheet uniform brightness by shading correction, it is desirable that the maximum luminance value Ymax (I, J) of each block be substantially the same target value. If the entire sheet has a uniform brightness, the object of shading correction is achieved.
For this reason, the maximum luminance value is set to Ymax (I, J), and in this embodiment, the maximum luminance value Ymax (I, J) of the block is set to Ymaxmax.

本実施形態では、ブロックのシェーディング補正量をYcv(I,J)として、ブロックのシェーディング補正量Ycv(I,J)を次の手順で求める。   In this embodiment, the block shading correction amount is Ycv (I, J), and the block shading correction amount Ycv (I, J) is obtained by the following procedure.

まず、得られた最大輝度値Ymax(I,J)が各ブロックの用紙の背景輝度が適切に用紙のブロックの明るさを表しているかの評価を行う。   First, it is evaluated whether the obtained maximum luminance value Ymax (I, J) appropriately represents the brightness of the paper block in each block.

次に、最大輝度値Ymax(I,J)の平均値Ymeanmaxを求め、最大輝度値Ymax(I,J)と平均値Ymeanmaxとの差分Ydを求める。差分Ydは、次の数2によって表される。

Figure 2005269451
Next, an average value Ymeanmax of the maximum luminance value Ymax (I, J) is obtained, and a difference Yd between the maximum luminance value Ymax (I, J) and the average value Ymeanmax is obtained. The difference Yd is expressed by the following equation 2.
Figure 2005269451

この差分Ydが予め設定された閾値YDIF_UNDER以下であって、かつ該当ブロックの輝度範囲Yrange(I,J)が0でないかを調べる。尚、メモリ23は、この閾値YDIF_UNDERを予め記憶する。   It is checked whether the difference Yd is equal to or smaller than a preset threshold YDIF_UNDER and the luminance range Yrange (I, J) of the corresponding block is not zero. Note that the memory 23 stores the threshold value YDIF_UNDER in advance.

この差分Ydが所定値YDIF_UNDER以下であって、かつ該当ブロックの輝度範囲Yrange(I,J)が0であれば、該当ブロックの最大輝度Ymax(I,J)は、背景色をサンプルしていない可能性が高い。この場合、周辺の最大輝度値Ymax(I-1,J),Ymax(I+1,J),Ymax(I,J-1),Ymax(I,J+1)を用いて、該当ブロックの輝度補正量の平均値を求める。この際、周辺のブロックに最大輝度Yrangeが0である点があれば、平均値の計算対象にはしないようにする。新しい最大輝度Ymax(I,J)は次の数3によって表される。

Figure 2005269451
If the difference Yd is less than or equal to the predetermined value YDIF_UNDER and the luminance range Yrange (I, J) of the block is 0, the maximum luminance Ymax (I, J) of the block does not sample the background color. Probability is high. In this case, the peripheral maximum luminance values Ymax (I-1, J), Ymax (I + 1, J), Ymax (I, J-1), Ymax (I, J + 1) are used to determine the corresponding block. An average value of luminance correction amounts is obtained. At this time, if there is a point where the maximum luminance Yrange is 0 in the surrounding blocks, the average value is not calculated. The new maximum brightness Ymax (I, J) is expressed by the following equation (3).
Figure 2005269451

また、差分Ydが大きい場合、そのブロックはスポットライトなどにより著しく明るくなっていることが予想される。この場合、リニア補間を行うと、スポットライトの周辺が、暗くなってしまい、原稿2に不自然さが生じるため、シェーディング補正量を抑圧する必要がある。   When the difference Yd is large, the block is expected to be significantly brighter due to spotlight or the like. In this case, if linear interpolation is performed, the periphery of the spotlight becomes dark and unnaturalness occurs in the document 2, so that it is necessary to suppress the shading correction amount.

このため、画像処理装置25は、差分Ydと予め設定された閾値YDIF_UPPERとを比較し、差分Ydが閾値YDIF_UPPERを越えている場合は、そのブロックは著しく明るくなっていると判定して、シェーディング補正量を抑圧する。メモリ23は、この閾値YDIF_UPPERを予め記憶する。シェーディング補正量の抑圧量は、次の数4によって表される。

Figure 2005269451
最後に、各ブロックの輝度シェーディング補正量は次の数5によって求められる。
Figure 2005269451
For this reason, the image processing device 25 compares the difference Yd with a preset threshold value YDIF_UPPER. If the difference Yd exceeds the threshold value YDIF_UPPER, the image processing apparatus 25 determines that the block is significantly brighter, and performs shading correction. Suppress the amount. The memory 23 stores this threshold value YDIF_UPPER in advance. The amount of suppression of the shading correction amount is expressed by the following equation (4).
Figure 2005269451
Finally, the luminance shading correction amount of each block is obtained by the following equation (5).
Figure 2005269451

次に、このようにして求められたブロックのシェーディング補正量に基づいて各画素のシェーディング補正を行う。その方法について説明する。前述の方法で求めた各ブロックのシェーディング補正量は、そのブロックの中心点の輝度補正量(シェーディング補正量)を表しているものとする。中心点以外の画素の輝度補正量は、前述した輝度補正量から近傍の4点から線形補間を行うことにより求められる。   Next, shading correction of each pixel is performed based on the shading correction amount of the block obtained in this way. The method will be described. It is assumed that the shading correction amount of each block obtained by the above method represents the luminance correction amount (shading correction amount) at the center point of the block. The luminance correction amount of the pixels other than the center point can be obtained by performing linear interpolation from the four neighboring points from the luminance correction amount described above.

具体的には、M×N画素の入力画像をK×Lのブロックに分割して各ブロックのシェーディング補正量を計算する。尚、シェーディング補正量を求めようとしている画素の座標を(x,y)として、その補正量をYpcv(x,y)とすると、

Figure 2005269451
Specifically, the input image of M × N pixels is divided into K × L blocks, and the shading correction amount of each block is calculated. If the coordinates of the pixel for which the shading correction amount is to be obtained are (x, y) and the correction amount is Ypcv (x, y),
Figure 2005269451

数6に従って求められたi,jが0より小さい場合、あるいは、I=K−1,J=L−1等の場合には、近傍に4点のデータがない。このため、もっとも近い4点を用いて線形補間を行う。線形補間は、次の数7に従って行われる。

Figure 2005269451
When i, j obtained according to Equation 6 is smaller than 0, or when I = K−1, J = L−1, etc., there is no 4-point data in the vicinity. For this reason, linear interpolation is performed using the nearest four points. Linear interpolation is performed according to the following equation (7).
Figure 2005269451

このようにして各画素(x,y)から、図7に示すような2次元的な座標(i,j)が求められる。尚、(i,j)は、各ブロックの各画素位置を示す。図7において、太線の四角に囲まれた領域が、その領域内の画素(x,y)の近傍4点のブロック輝度補正量Ycv(I,J),Ycv(I+1,J),Ycv(I,J+1),Ycv(I+1,J+1)になる。これらの4点からこの画素のシェーディング補正量Ypcv(x,y)は、次の数8によって表される。

Figure 2005269451
このようにして各画素の輝度Y(x,y)は、次の数9に示すシェーディング補正によって新しい輝度Y'(x,y)に書き換えられる。
Figure 2005269451
In this way, two-dimensional coordinates (i, j) as shown in FIG. 7 are obtained from each pixel (x, y). Note that (i, j) indicates each pixel position of each block. In FIG. 7, the area surrounded by the bold square is the block luminance correction amounts Ycv (I, J), Ycv (I + 1, J), Ycv at the four points near the pixel (x, y) in the area. (I, J + 1), Ycv (I + 1, J + 1). From these four points, the shading correction amount Ypcv (x, y) of this pixel is expressed by the following equation (8).
Figure 2005269451
In this way, the luminance Y (x, y) of each pixel is rewritten to a new luminance Y ′ (x, y) by the shading correction shown in the following equation (9).
Figure 2005269451

(4)輝度補正
次に、輝度引き伸ばし補正を行う必要がある。輝度引き伸ばし補正を行うには、まず補正画像を入力し、画像から、図5に示すような輝度ヒストグラムを作成し、最大値、最小値を取得する。ここで、最大値とは、ヒストグラムにおいてある一定以上の画素数を持つY値のうち最大のものであり、最小値とは、ある一定以上の画素数を持つ最小のY値である。これらの値より、図5に示すように輝度の最小値で輝度値が0になり、輝度の最大値で255になるように、最小値以下と最大値以上をカットして1つの直線式によって引き伸ばしを行う。
(4) Luminance correction Next, it is necessary to perform luminance enlargement correction. In order to perform luminance enlargement correction, first, a corrected image is input, a luminance histogram as shown in FIG. 5 is created from the image, and a maximum value and a minimum value are acquired. Here, the maximum value is the maximum Y value having a certain number of pixels in the histogram, and the minimum value is the minimum Y value having a certain number of pixels. From these values, as shown in FIG. 5, the luminance value is 0 at the minimum luminance value and is 255 at the maximum luminance value. Perform enlargement.

本実施形態では、シェーディングブロックにおいてブロックヒストグラムをすでに生成しているため、このヒストグラムを利用するのが良い。前述のシェーディング補正によって、結果としてブロックの輝度最大値はYmaxmaxに均一化される。従って、ヒストグラムの最大値はYmaxmaxである。また、各ブロックの輝度最小値はYmin(I,J)も、およそ、そのブロックの輝度補正値Ycv(I,J)で補正されたと考えられるので、各ブロックの輝度最小値Ymin(I,J)を下記の式で書き換える。

Figure 2005269451
In the present embodiment, since a block histogram is already generated in the shading block, it is preferable to use this histogram. As a result of the above-described shading correction, the maximum luminance value of the block is made uniform to Ymaxmax. Therefore, the maximum value of the histogram is Ymaxmax. Further, since the minimum luminance value Ymin (I, J) of each block is considered to have been corrected by the luminance correction value Ycv (I, J) of that block, the minimum luminance value Ymin (I, J) of each block. ) With the following formula.
Figure 2005269451

これらのブロック輝度最小値からもっとも小さい最小値をYminminを探し出す。
結果として本実施形態では、図5において最大値をYmaxmax,最小値をYminminとして背景の輝度(Y)に応じて出力(Y')を行う図8に示すような変換テーブルを作成する。テーブル作成後、各画素を入力データとして、この変換テーブルに従って、順次、出力データに変換し、各画素の輝度値を、新しい輝度値に書き換えることによって画像効果処理が施される。このように画像効果処理が行われた画像では、明るい画素はより明るく、暗い画素はより暗くなるので、輝度のばらつきが広くなり視認性に優れた画像が生成される。
Yminmin is searched for the smallest minimum value from these block luminance minimum values.
As a result, in the present embodiment, a conversion table as shown in FIG. 8 is generated that outputs (Y ′) according to the luminance (Y) of the background with the maximum value Ymaxmax and the minimum value Yminmin in FIG. After creating the table, each pixel is converted into output data according to this conversion table as input data, and image effect processing is performed by rewriting the luminance value of each pixel to a new luminance value. In an image on which image effect processing has been performed in this manner, bright pixels are brighter and dark pixels are darker, so that variations in luminance are widened and an image with excellent visibility is generated.

(4)色補正
次に、色補正について説明する。撮影画像によっては、デジタルカメラのホワイトバランスの調整がうまくいかず全体が黄色等に色が変わってしまう場合がある。この色の変化は、輝度ヒストグラムの画像効果処理を行うだけでは、修正できない。このため、色差ヒストグラムを作成してカラー調整をおこなう。
(4) Color Correction Next, color correction will be described. Depending on the photographed image, the white balance of the digital camera may not be adjusted properly, and the whole color may change to yellow or the like. This color change cannot be corrected only by performing image effect processing of the luminance histogram. Therefore, color adjustment is performed by creating a color difference histogram.

色差ヒストグラムは、原稿画像の輪郭を除く実原稿部に存在する色差(U,V)の分布を示すものであり、色差毎に実原稿部の画素の数を計数することにより生成される。図9に、色差ヒストグラムの一例を示す。図9において、横軸は、色差を示し、縦軸は、画素数を示す。色差ヒストグラムの場合も、画素の計数値が最大となる色差のピーク値(Upeak,Vpeak)が現れる。このピーク値も原稿4の背景色の色差を示すものと考えられる。   The color difference histogram shows the distribution of color differences (U, V) existing in the actual document portion excluding the contour of the document image, and is generated by counting the number of pixels in the actual document portion for each color difference. FIG. 9 shows an example of the color difference histogram. In FIG. 9, the horizontal axis indicates the color difference, and the vertical axis indicates the number of pixels. Also in the case of the color difference histogram, a peak value (Upeak, Vpeak) of the color difference where the count value of the pixel becomes maximum appears. This peak value is also considered to indicate the color difference of the background color of the document 4.

色差UとVの値がともに0である場合、色は無彩色となるため、ピーク値(Upeak,Vpeak)が0になるようにカラー調整を行う。図10にカラー調整を行うためのカラー調整変換グラフの一例を示す。即ち、カラーの変換線は2つの線分によって表される。入力値U,Vに対する出力値U'、V’は次の数11で与えられる。

Figure 2005269451
When the values of the color differences U and V are both 0, the color is an achromatic color, and color adjustment is performed so that the peak values (Upeak, Vpeak) are 0. FIG. 10 shows an example of a color adjustment conversion graph for performing color adjustment. That is, the color conversion line is represented by two line segments. The output values U ′ and V ′ for the input values U and V are given by the following equation (11).
Figure 2005269451

ただしU>127のときはU=127とし, U>−128のときはU=−128とする。色差Vについても同様である。本実施形態ではこのときに輝度補正で引き伸ばしをおこなった分、色差もゲインを調整したほうがより自然な画像になる。したがって実際の変換式は数12に示すものになる。

Figure 2005269451
However, U = 127 when U> 127, and U = −128 when U> −128. The same applies to the color difference V. In the present embodiment, the image is more natural when the gain is adjusted for the color difference because the enlargement is performed by the luminance correction. Therefore, the actual conversion formula is as shown in Equation 12.
Figure 2005269451

本実施形態では、輝度変換と同様にこの数12によって表される関係に従って、入力色差(U)を出力(U')に変換する変換テーブルを作成する。テーブル作成後、各画素色差Uを入力データとして、この変換テーブルに従って、順次、出力データに変換し、各画素の色差を、新しい色差U'に書き換えることにより、画像効果処理が施される。色差Vについても同様である。   In the present embodiment, a conversion table for converting the input color difference (U) into the output (U ′) is created according to the relationship represented by Equation 12 as in the luminance conversion. After creating the table, each pixel color difference U is used as input data, and sequentially converted into output data according to this conversion table, and the image effect processing is performed by rewriting the color difference of each pixel to a new color difference U ′. The same applies to the color difference V.

画像処理装置25は、このような考え方に基づき、図11に示すフローチャートに従って、この画像効果処理を実行する。
画像処理装置25は、まず切り出しが行われた画像を複数(K×L)のサブブロックに分割する(ステップS31)。
Based on such a concept, the image processing device 25 executes the image effect processing according to the flowchart shown in FIG.
First, the image processing device 25 divides the cut image into a plurality of (K × L) sub-blocks (step S31).

画像処理装置25は、各サブブロックにおいて輝度ヒストグラムを作成し、画像効果補正用パラメータを取得する(ステップS32)。
画像処理装置25は、各サブブロックのシェーディング補正量を求める(ステップS33)。
The image processing device 25 creates a luminance histogram in each sub-block and obtains an image effect correction parameter (step S32).
The image processing device 25 obtains a shading correction amount for each sub-block (step S33).

画像処理装置25は、図12及び図13に示すフローチャートに従って、シェーディング補正量の計算処理を実行する。
即ち、画像処理装置25は、SmallDispertionCountのカウント値を0にセットする(ステップS41)。
画像処理装置25は、数1に従って、ブロックの輝度範囲Yrangeを求める(ステップS42)。
The image processing device 25 executes shading correction amount calculation processing according to the flowcharts shown in FIGS. 12 and 13.
That is, the image processing device 25 sets the count value of SmallDispertionCount to 0 (step S41).
The image processing device 25 obtains the luminance range Yrange of the block according to Equation 1 (step S42).

画像処理装置25は、求めた輝度範囲Yrangeと閾値Y_RANGE_MINとを比較し、輝度範囲Yrangeが閾値Y_RANGE_MIN以下か否かを判定する(ステップS43)。
輝度範囲Yrangeが閾値Y_RANGE_MIN以下と判定した場合(ステップS43においてYes)、画像処理装置25は、輝度範囲Yrangeを0に書き換える(ステップS44)。
画像処理装置25は、カウントSmallDispertionCountのカウント値をインクリメントする(ステップS45)。
The image processing device 25 compares the obtained luminance range Yrange and the threshold value Y_RANGE_MIN, and determines whether or not the luminance range Yrange is less than or equal to the threshold value Y_RANGE_MIN (step S43).
When it is determined that the luminance range Yrange is equal to or smaller than the threshold Y_RANGE_MIN (Yes in step S43), the image processing device 25 rewrites the luminance range Yrange to 0 (step S44).
The image processing device 25 increments the count value of the count SmallDispertionCount (step S45).

一方、輝度範囲Yrangeが閾値Y_RANGE_MINを越えていると判定した場合(ステップS43においてNo)、画像処理装置25は、輝度範囲Yrange、カウントSmallDispertionCountのカウント値をそのままにしておく。   On the other hand, when it is determined that the luminance range Yrange exceeds the threshold Y_RANGE_MIN (No in step S43), the image processing apparatus 25 keeps the count values of the luminance range Yrange and the count SmallDispertionCount.

画像処理装置25は、すべてのブロックについて輝度範囲Yrangeの計算が終了したか否かを判定する(ステップS46)。
すべてのブロックについて処理が終了していないと判定した場合(ステップS46においてNo)、画像処理装置25は、ステップS42〜45の処理を、再度、実行する。
The image processing device 25 determines whether or not the calculation of the luminance range Yrange has been completed for all the blocks (step S46).
If it is determined that the processing has not been completed for all the blocks (No in step S46), the image processing apparatus 25 executes the processes in steps S42 to S45 again.

すべてのブロックについて処理が終了したと判定した場合(ステップS46においてYES)、画像処理装置25は、カウントSmallDispertionCountのカウント値を閾値MIN_SMALL_DIPERTION_COUNTと比較して、カウントSmallDispertionCountの値が閾値MIN_SMALL_DIPERTION_COUNTを超えているか否かを判定する(ステップS47)。   If it is determined that the processing has been completed for all blocks (YES in step S46), the image processing apparatus 25 compares the count value of the count SmallDispertionCount with the threshold value MIN_SMALL_DIPERTION_COUNT, and determines whether the value of the count SmallDispertionCount exceeds the threshold value MIN_SMALL_DIPERTION_COUNT. Is determined (step S47).

カウントSmallDispertionCountの値が閾値MIN_SMALL_DIPERTION_COUNTを超えていると判定した場合(ステップS47においてYes)、画像処理装置25は、フラグStopFlattenBrightのフラグ値を1にセットして(ステップS48)、この処理を終了させる。   When it is determined that the value of the count SmallDispertionCount exceeds the threshold value MIN_SMALL_DIPERTION_COUNT (Yes in step S47), the image processing device 25 sets the flag value of the flag StopFlattenBright to 1 (step S48), and ends this process.

一方、カウントSmallDispertionCountの値が閾値MIN_SMALL_DIPERTION_COUNT以下と判定した場合(ステップS48においてNo)、画像処理装置25は、ブロック輝度Ymax(I,J)の最大値Ymaxmaxと、その平均値Ymeanmaxとを求める(ステップS49)。   On the other hand, when it is determined that the value of the count SmallDispertionCount is equal to or smaller than the threshold MIN_SMALL_DIPERTION_COUNT (No in step S48), the image processing device 25 obtains the maximum value Ymaxmax of the block luminance Ymax (I, J) and the average value Ymeanmax (step). S49).

画像処理装置25は、数2に従って最大輝度値Ymax(I,J)と平均値Ymeanmaxとの差分値Ydを求める(ステップS50)。   The image processing device 25 obtains a difference value Yd between the maximum luminance value Ymax (I, J) and the average value Ymeanmax according to Equation 2 (step S50).

画像処理装置25は、求めた差分値Ydと所定値YDIF_UNDERとを比較して、差分値Ydが所定値YDIF_UNDER以下か否かを判定する(ステップS51)。
差分値Ydが所定値YDIF_UNDER以下と判定した場合(ステップS51においてYes)、画像処理装置25は、該当ブロックの輝度範囲Yrange(I,J)が0であるか否かを判定する(ステップS52)。
The image processing device 25 compares the obtained difference value Yd with the predetermined value YDIF_UNDER and determines whether or not the difference value Yd is equal to or smaller than the predetermined value YDIF_UNDER (step S51).
When it is determined that the difference value Yd is equal to or smaller than the predetermined value YDIF_UNDER (Yes in Step S51), the image processing device 25 determines whether or not the luminance range Yrange (I, J) of the corresponding block is 0 (Step S52). .

該当ブロックの輝度範囲Yrange(I,J)が0であると判定した場合(ステップS52においてYes)、画像処理装置25は、該当ブロックの最大輝度Ymax(I,J)が背景色をサンプルしていない可能性が高いと判定する。この場合、画像処理装置25は、周辺ブロックに輝度範囲Yrange(I,J)が0のものがあるか否かを判定する(ステップS53)。   If it is determined that the luminance range Yrange (I, J) of the block is 0 (Yes in step S52), the image processing device 25 samples the background color for the maximum luminance Ymax (I, J) of the block. It is determined that there is a high possibility that there is not. In this case, the image processing apparatus 25 determines whether there is a peripheral block having a luminance range Yrange (I, J) of 0 (step S53).

周辺ブロックに輝度範囲Yrange(I,J)が0のものがないと判定した場合(ステップS53においてNo)、画像処理装置25は、周辺のブロック最大輝度値Ymax(I-1,J),Ymax(I+1,J),Ymax(I,J-1),Ymax(I,J+1)を用い、数3に従って該当ブロックの最大輝度値を周辺のブロックの平均値に書き換える(ステップS54)。   When it is determined that the peripheral block has no luminance range Yrange (I, J) of 0 (No in step S53), the image processing device 25 determines that the peripheral block maximum luminance values Ymax (I-1, J), Ymax Using (I + 1, J), Ymax (I, J-1), Ymax (I, J + 1), the maximum luminance value of the corresponding block is rewritten to the average value of the surrounding blocks according to Equation 3 (step S54). .

周辺ブロックに輝度範囲Yrange(I,J)が0のものがあると判定した場合(ステップS53においてYes)、画像処理装置25は、輝度範囲Yrange(I,J)が0のブロックを除外して、該当ブロックの最大輝度値を周辺の最大輝度値から求める(ステップS55)。   When it is determined that there is a peripheral block having a luminance range Yrange (I, J) of 0 (Yes in step S53), the image processing apparatus 25 excludes blocks whose luminance range Yrange (I, J) is 0. The maximum luminance value of the corresponding block is obtained from the peripheral maximum luminance value (step S55).

画像処理装置25は、各ブロックのシェーディング補正量を、数5に従って求める(ステップS56)。   The image processing device 25 calculates the shading correction amount of each block according to Equation 5 (step S56).

一方、差分値Ydが所定値YDIF_UNDERを越えていると判定した場合(ステップS51においてNo)、画像処理装置25は、差分値Ydと所定値YDIF_UPPERとを比較し、差分値Ydが所定値YDIF_UPPERを越えているか否かを判定する(ステップS57)。   On the other hand, when it is determined that the difference value Yd exceeds the predetermined value YDIF_UNDER (No in step S51), the image processing device 25 compares the difference value Yd with the predetermined value YDIF_UPPER, and the difference value Yd is equal to the predetermined value YDIF_UPPER. It is determined whether or not it exceeds (step S57).

差分値Ydが所定値YDIF_UPPERを越えていると判定した場合(ステップS57においてYes)、画像処理装置25は、数4に従って、補正量を抑圧した最大輝度値Ymaxを求める(ステップS58)。そして、画像処理装置25は、各ブロックのシェーディング補正量を、数5に従って求める(ステップS56)。   When it is determined that the difference value Yd exceeds the predetermined value YDIF_UPPER (Yes in step S57), the image processing device 25 obtains the maximum luminance value Ymax in which the correction amount is suppressed according to Equation 4 (step S58). Then, the image processing device 25 obtains the shading correction amount of each block according to Equation 5 (step S56).

画像処理装置25は、フラグStopFlattenBrightのフラグ値に基づいてシーディングを行うべき原稿か否かを判定する(図11のステップS34)。フラグStopFlattenBrightのフラグ値が0にリセットされていれば、画像処理装置25は、原稿2がシーディングを行うべきものであると判定する(ステップS34においてYes)。この場合、画像処理装置25は、数6〜数9に従って各ブロックの各画素のシェーディング補正量Ypcv(x,y)を求め、シェーディング補正を行う(ステップS35)。   The image processing device 25 determines whether the document is to be seeded based on the flag value of the flag StopFlattenBright (step S34 in FIG. 11). If the flag value of the flag StopFlattenBright is reset to 0, the image processing apparatus 25 determines that the document 2 should be seeded (Yes in step S34). In this case, the image processing device 25 obtains the shading correction amount Ypcv (x, y) of each pixel of each block according to the equations 6 to 9, and performs the shading correction (step S35).

一方、フラグStopFlattenBrightのフラグ値が1にセットされていれば、画像処理装置25は、原稿2がシーディングを行うべきものではないと判定する(ステップS34においてNo)。この場合、画像処理装置25は、シェーディング補正を行わないようにする。   On the other hand, if the flag value of the flag StopFlattenBright is set to 1, the image processing device 25 determines that the document 2 should not be seeded (No in step S34). In this case, the image processing device 25 does not perform shading correction.

画像処理装置25は、数9に従って、各ブロックの輝度最小値Ymin(I,J)を書き換えることにより、あるいは、図8に示す変換テーブルを用いて輝度補正を行う(ステップS36)。   The image processing device 25 performs luminance correction by rewriting the minimum luminance value Ymin (I, J) of each block according to Equation 9 or using the conversion table shown in FIG. 8 (step S36).

画像処理装置25は、数10、数11に従って、色差の変換を行うことにより、あるいは図10に示すような変換テーブルを用いて色補正を行い(ステップS37)、この画像効果処理を終了させる。   The image processing device 25 performs color correction by performing color difference conversion according to Equations 10 and 11 or using a conversion table as shown in FIG. 10 (Step S37), and ends the image effect processing.

以上説明したように、本実施形態によれば、画像を複数のサブブロックに分割し、各ブロックの最大輝度値が同じになるようにシェーディング補正を行うようにした。
従って、デジタルカメラ1で撮影された原稿2の用紙の影やライトによる影響で生じたシェーディングを補正するにあたって、用紙に輝度が著しく違ったブロックを含んでいたとしても、適正なシェーディング補正を行うことができる。
As described above, according to the present embodiment, an image is divided into a plurality of sub-blocks, and shading correction is performed so that the maximum luminance value of each block becomes the same.
Accordingly, when correcting shading caused by the shadow or light of the paper of the document 2 photographed by the digital camera 1, even if the paper contains blocks with significantly different brightness, appropriate shading correction should be performed. Can do.

また、各ブロックの輝度範囲が小さい場合には、シェーディング補正を行わないようにしたので、原稿が写っていない場合、あるいはほとんど白紙の原稿4の場合には、不要なシェーディング補正を抑制することができる。   In addition, since shading correction is not performed when the luminance range of each block is small, unnecessary shading correction can be suppressed when the original is not shown or when the original 4 is almost blank. it can.

また、スポットライト等により著しく明るいブロックがある場合には、シェーディング補正量を抑圧するようにしたので、このような明るいブロックによる不適当なシェーディング補正を防止することができる。   Further, when there is a remarkably bright block due to spotlight or the like, the shading correction amount is suppressed, so that inappropriate shading correction due to such a bright block can be prevented.

また、シェーディング補正を行った後に、シェーディング補正に用いたパラメータを利用して輝度補正を行うようにしたので、演算数を低減することができ、シェーディング補正に要する処理時間を短縮することができ、また、効果的な画像鮮明化処理を行うことができる。   In addition, after performing shading correction, luminance correction is performed using the parameters used for shading correction, so the number of operations can be reduced, and the processing time required for shading correction can be shortened. Further, effective image sharpening processing can be performed.

尚、本発明を実施するにあたっては、種々の形態が考えられ、上記実施形態に限られるものではない。
例えば、上記実施形態では、画像処理装置は、原稿2の用紙が明るい色のものとして説明した。しかし、例えば、黒い用紙に白抜きの文字が記述されているような原稿の場合、原稿2の用紙が必ずしも最大輝度値になるとは限らないものの、この場合は、画像の輝度値を反転させれば、同じように上記実施形態を適用することができる。
In carrying out the present invention, various forms are conceivable and the present invention is not limited to the above embodiment.
For example, in the above embodiment, the image processing apparatus has been described on the assumption that the paper of the document 2 has a bright color. However, for example, in the case of a manuscript in which white characters are described on black paper, the paper of manuscript 2 does not necessarily have the maximum luminance value, but in this case, the luminance value of the image can be inverted. In the same manner, the above embodiment can be applied.

上記実施形態では、画像補正をデジタルカメラ1で行うようにした。しかし、画像補正をコンピュータで行うことも可能である。この場合、コンピュータをコンピュータインタフェース部27に接続し、コンピュータが図4に示すフローチャートに従って撮影処理を実行する。コンピュータがこのような画像の編集処理を行えば、デジタルカメラ1に比べ、コンピュータのマウス等により操作情報の入力も容易になるので、操作性が向上する。また、コンピュータの表示装置は、デジタルカメラ1の液晶モニタ12よりも大きいのが一般的であるので、画像を詳細に視認して、画像補正を精度良く行うことが可能になる。   In the above embodiment, image correction is performed by the digital camera 1. However, image correction can also be performed by a computer. In this case, a computer is connected to the computer interface unit 27, and the computer executes photographing processing according to the flowchart shown in FIG. If the computer performs such image editing processing, it becomes easier to input operation information using a computer mouse or the like, compared to the digital camera 1, so that operability is improved. Further, since the display device of the computer is generally larger than the liquid crystal monitor 12 of the digital camera 1, the image can be visually confirmed in detail and image correction can be performed with high accuracy.

上記実施形態では、プログラムが、それぞれメモリ等に予め記憶されているものとして説明した。しかし、コンピュータを、装置の全部又は一部として動作させ、あるいは、上述の処理を実行させるためのプログラムを、フレキシブルディスク、CD−ROM(Compact Disk Read-Only Memory)、DVD(Digital Versatile Disk)、MO(Magneto Optical disk)などのコンピュータ読み取り可能な記録媒体に格納して配布し、これを別のコンピュータにインストールし、上述の手段として動作させ、あるいは、上述の工程を実行させてもよい。   In the above-described embodiment, the program is described as being stored in advance in a memory or the like. However, a program for causing a computer to operate as the whole or a part of the apparatus or to execute the above-described processing is a flexible disk, a CD-ROM (Compact Disk Read-Only Memory), a DVD (Digital Versatile Disk), The information may be stored in a computer-readable recording medium such as an MO (Magneto Optical disk) and distributed, installed in another computer, operated as the above-described means, or the above-described steps may be executed.

さらに、インターネット上のサーバ装置が有するディスク装置等にプログラムを格納しておき、例えば、搬送波に重畳させて、コンピュータにダウンロード等するものとしてもよい。   Furthermore, the program may be stored in a disk device or the like included in a server device on the Internet, and may be downloaded onto a computer by being superimposed on a carrier wave, for example.

本発明の本実施形態に係るデジタルカメラの構成を示す説明図である。It is explanatory drawing which shows the structure of the digital camera which concerns on this embodiment of this invention. 図1に示すデジタルカメラの構成を示すブロック図である。It is a block diagram which shows the structure of the digital camera shown in FIG. 図2に示す画像処理装置の機能の説明図である。It is explanatory drawing of the function of the image processing apparatus shown in FIG. デジタルカメラが実行する撮影処理の内容を示すフローチャートである。It is a flowchart which shows the content of the imaging | photography process which a digital camera performs. 図2に示す画像処理装置が生成した輝度ヒストグラムを示す説明図である。It is explanatory drawing which shows the brightness | luminance histogram which the image processing apparatus shown in FIG. 2 produced | generated. 原稿画像を分割したブロックの一例として、5×5のブロックの説明図である。FIG. 5 is an explanatory diagram of a 5 × 5 block as an example of a block obtained by dividing a document image. 図2に示す画像処理装置が各画素から求めた2次元のシェーディング補正値を示す説明図である。It is explanatory drawing which shows the two-dimensional shading correction value which the image processing apparatus shown in FIG. 2 calculated | required from each pixel. 図2に示す画像処理装置が輝度補正に用いる変換テーブルの一例を示す説明図である。It is explanatory drawing which shows an example of the conversion table which the image processing apparatus shown in FIG. 2 uses for brightness correction. 図2に示す画像処理装置が生成した色差ヒストグラムを示す説明図である。It is explanatory drawing which shows the color difference histogram which the image processing apparatus shown in FIG. 2 produced | generated. 図2に示す画像処理装置が色差の補正に用いる変換テーブルの一例を示す説明図である。FIG. 3 is an explanatory diagram illustrating an example of a conversion table used for color difference correction by the image processing apparatus illustrated in FIG. 2. 図2に示す画像処理装置が実行する画像効果処理の内容を示すフローチャートである。It is a flowchart which shows the content of the image effect process which the image processing apparatus shown in FIG. 2 performs. 図2に示す画像処理装置が実行するシェーディング補正量の計算処理の内容(1)を示すフローチャートである。It is a flowchart which shows the content (1) of the calculation process of the shading correction amount which the image processing apparatus shown in FIG. 2 performs. 図2に示す画像処理装置が実行するシェーディング補正量の計算処理の内容(2)を示すフローチャートである。It is a flowchart which shows the content (2) of the calculation process of the shading correction amount which the image processing apparatus shown in FIG. 2 performs.

符号の説明Explanation of symbols

1・・・デジタルカメラ、2・・・原稿、11・・・撮影レンズ部、12・・・液晶モニタ、13・・・シャッタボタン、21・・・光学レンズ装置、22・・・イメージセンサ、23・・・メモリ、24・・・表示装置、25・・・画像処理装置、30・・・CPU、31・・・メモリカード   DESCRIPTION OF SYMBOLS 1 ... Digital camera, 2 ... Original, 11 ... Shooting lens part, 12 ... Liquid crystal monitor, 13 ... Shutter button, 21 ... Optical lens apparatus, 22 ... Image sensor, 23 ... Memory, 24 ... Display device, 25 ... Image processing device, 30 ... CPU, 31 ... Memory card

Claims (11)

原稿を撮影することによって得られた原稿画像に画像処理を施す画像処理装置において、
前記原稿画像を複数のブロックに分割するブロック分割部と、
前記ブロック分割部が分割した各ブロック内の各画素の輝度値を調べ、ブロック毎に前記原稿の用紙に対応する輝度値を取得するブロック輝度取得部と、
前記ブロック輝度取得部が取得したブロック輝度値に基づいて各ブロックのシェーディング補正値を求め、求めたシェーディング補正値に基づいて各ブロックの各画素に対するシェーディング補正を行うシェーディング補正部と、を備えた、
ことを特徴とする画像処理装置。
In an image processing apparatus that performs image processing on a document image obtained by photographing a document,
A block dividing unit for dividing the document image into a plurality of blocks;
A block luminance obtaining unit that examines the luminance value of each pixel in each block divided by the block dividing unit and obtains a luminance value corresponding to the original paper for each block;
A shading correction unit that obtains a shading correction value for each block based on the block luminance value acquired by the block luminance acquisition unit, and performs shading correction for each pixel of each block based on the obtained shading correction value;
An image processing apparatus.
前記ブロック輝度取得部は、前記原稿の用紙に対応する輝度値として最大輝度値を取得する、
ことを特徴とする請求項1に記載の画像処理装置。
The block luminance acquisition unit acquires a maximum luminance value as a luminance value corresponding to the original paper;
The image processing apparatus according to claim 1.
前記ブロック分割部が分割した各ブロックの各画素の輝度値を調べ、ブロック毎に各画素の輝度値のうちの最小輝度値を取得して、前記ブロック輝度取得部が取得した各ブロックの最大輝度値と取得した最小輝度値との差をそれぞれのブロックの輝度範囲として取得する輝度範囲取得部を備え、
前記シェーディング補正部は、前記輝度範囲取得部が取得した各ブロックの前記輝度範囲と適正輝度範囲を判別するために予め設定された設定値とを比較して、前記輝度範囲が前記設定値を越えている場合に、前記ブロック輝度取得部が取得した各ブロックの最大輝度値が、すべてのブロックで目標とされる輝度目標値となるように、各ブロックのシェーディング補正値を求める、
ことを特徴とする請求項2に記載の画像処理装置。
The luminance value of each pixel of each block divided by the block dividing unit is examined, the minimum luminance value of the luminance values of each pixel is obtained for each block, and the maximum luminance of each block acquired by the block luminance acquiring unit A luminance range acquisition unit that acquires a difference between the value and the acquired minimum luminance value as a luminance range of each block;
The shading correction unit compares the luminance range of each block acquired by the luminance range acquisition unit with a setting value set in advance to determine an appropriate luminance range, and the luminance range exceeds the setting value. The block luminance acquisition unit obtains the shading correction value of each block so that the maximum luminance value of each block acquired by the block luminance acquisition unit becomes a luminance target value targeted by all the blocks.
The image processing apparatus according to claim 2.
前記シェーディング補正部は、前記輝度範囲取得部が取得した前記輝度範囲が前記設定値以下の場合には、前記ブロック輝度取得部が取得した周辺ブロックの最大輝度値に基づいて、該当するブロックの輝度補間値を求め、求めた輝度補間値が前記輝度目標値となるように、前記輝度範囲が前記設定値以下となるブロックのシェーディング補正値を求める、
ことを特徴とする請求項3に記載の画像処理装置。
When the luminance range acquired by the luminance range acquisition unit is equal to or less than the set value, the shading correction unit determines the luminance of the corresponding block based on the maximum luminance value of the peripheral block acquired by the block luminance acquisition unit. An interpolation value is obtained, and a shading correction value of a block whose luminance range is equal to or less than the set value is obtained so that the obtained luminance interpolation value becomes the luminance target value.
The image processing apparatus according to claim 3.
前記ブロック輝度取得部と前記輝度範囲取得部とは、ブロック毎に輝度ヒストグラムを生成し、生成した輝度ヒストグラムから、前記最大輝度値、最小輝度値を取得する、
ことを特徴とする請求項3又は4に記載の画像処理装置。
The block luminance acquisition unit and the luminance range acquisition unit generate a luminance histogram for each block, and acquire the maximum luminance value and the minimum luminance value from the generated luminance histogram.
The image processing apparatus according to claim 3, wherein the image processing apparatus is an image processing apparatus.
前記シェーディング補正部は、ブロック毎に、前記輝度範囲取得部が取得したブロックの輝度範囲と前記輝度範囲に対して予め設定されたシェーディング補正の下限値とを比較し、前記輝度範囲が前記下限値未満であるブロックについては、前記シェーディング補正を停止する、
ことを特徴とする請求項3乃至5のいずれか1項に記載の画像処理装置。
The shading correction unit compares, for each block, the luminance range of the block acquired by the luminance range acquisition unit with a lower limit value of shading correction preset for the luminance range, and the luminance range is the lower limit value. For blocks that are less than, stop the shading correction,
The image processing apparatus according to claim 3, wherein the image processing apparatus is an image processing apparatus.
前記ブロック分割部が分割した各ブロックの各画素の輝度値を調べ、ブロック毎に各ブロック内の平均輝度値を取得し、前記ブロック輝度取得部が取得した各ブロックの最大輝度値と前記取得した平均輝度値との差分をそれぞれのブロックについて取得する平均輝度差取得部を備え、
前記シェーディング補正部は、ブロック毎に、前記平均輝度差取得部が取得した前記差分と前記差分に対して予め設定されたシェーディング補正の上限値とを比較し、前記差分が前記上限値を越えたブロックについては、求めたシェーディング補正値を低減する、
ことを特徴とする請求項2乃至6のいずれか1項に記載の画像処理装置。
The luminance value of each pixel of each block divided by the block dividing unit is examined, the average luminance value in each block is acquired for each block, and the maximum luminance value of each block acquired by the block luminance acquiring unit and the acquired An average luminance difference acquisition unit that acquires a difference from the average luminance value for each block,
The shading correction unit compares, for each block, the difference acquired by the average luminance difference acquisition unit and an upper limit value of shading correction set in advance for the difference, and the difference exceeds the upper limit value. For blocks, reduce the calculated shading correction value,
The image processing apparatus according to claim 2, wherein the image processing apparatus is an image processing apparatus.
前記シェーディング補正部が各ブロックの各画素に対してシェーディング補正を行った画像に対して、前記シェーディング補正に用いたパラメータを取得して輝度補正を行う輝度補正部を備えた、
ことを特徴とする請求項1乃至7のいずれか1項に記載の画像処理装置。
The image obtained by performing shading correction on each pixel of each block by the shading correction unit is provided with a luminance correction unit that acquires the parameters used for the shading correction and performs luminance correction.
The image processing apparatus according to claim 1, wherein the image processing apparatus is an image processing apparatus.
前記輝度補正部は、指定された輝度値の範囲を、取得したパラメータに基づいて、予め設定された範囲に引き伸ばす、
ことを特徴とする請求項8に記載の画像処理装置。
The brightness correction unit extends a specified brightness value range to a preset range based on the acquired parameter;
The image processing apparatus according to claim 8.
原稿の画像を複数のブロックに分割するステップと、
前記分割した各ブロック内の各画素の輝度値を調べ、ブロック毎に前記原稿の用紙に対応する輝度値を取得するステップと、
前記取得したブロック輝度値に基づいて各ブロックのシェーディング補正値を求め、求めたシェーディング補正値に基づいて各ブロックの各画素に対するシェーディング補正を行うステップと、を備えた、
ことを備えたことを特徴とする画像処理方法。
Dividing the document image into a plurality of blocks;
Examining the luminance value of each pixel in each of the divided blocks, and obtaining the luminance value corresponding to the original paper for each block;
Obtaining a shading correction value for each block based on the acquired block luminance value, and performing shading correction for each pixel of each block based on the obtained shading correction value,
An image processing method comprising:
コンピュータに、
原稿の画像を複数のブロックに分割する手順、
前記分割した各ブロック内の各画素の輝度値を調べ、ブロック毎に前記原稿の用紙に対応する輝度値を取得する手順、
前記取得したブロック輝度値に基づいて各ブロックのシェーディング補正値を求め、求めたシェーディング補正値に基づいて各ブロックの各画素に対するシェーディング補正を行う手順、
を実行させるためのプログラム。
On the computer,
The procedure to divide the original image into multiple blocks,
A procedure for examining the luminance value of each pixel in each of the divided blocks and obtaining the luminance value corresponding to the original paper for each block;
A procedure for obtaining a shading correction value for each block based on the acquired block luminance value, and performing a shading correction for each pixel of each block based on the obtained shading correction value;
A program for running
JP2004081649A 2004-03-19 2004-03-19 Image processing apparatus, image processing method, and program Expired - Fee Related JP4375069B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004081649A JP4375069B2 (en) 2004-03-19 2004-03-19 Image processing apparatus, image processing method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004081649A JP4375069B2 (en) 2004-03-19 2004-03-19 Image processing apparatus, image processing method, and program

Publications (3)

Publication Number Publication Date
JP2005269451A true JP2005269451A (en) 2005-09-29
JP2005269451A5 JP2005269451A5 (en) 2007-02-08
JP4375069B2 JP4375069B2 (en) 2009-12-02

Family

ID=35093484

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004081649A Expired - Fee Related JP4375069B2 (en) 2004-03-19 2004-03-19 Image processing apparatus, image processing method, and program

Country Status (1)

Country Link
JP (1) JP4375069B2 (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009005887A1 (en) * 2007-06-28 2009-01-08 Motorola, Inc. Method and apparatus for robust image processing
DE102008035650A1 (en) 2007-12-11 2009-07-23 Pfu Ltd., Kahoku Image processor and image processing method
JP2010086270A (en) * 2008-09-30 2010-04-15 Casio Computer Co Ltd Image correction apparatus, image correction method, and image correction program
JP2010147816A (en) * 2008-12-18 2010-07-01 Canon Inc Imaging apparatus and control method thereof
JP2010191952A (en) * 2009-01-22 2010-09-02 Canon Inc Apparatus and method for performing shading correction
JP2012212425A (en) * 2011-03-30 2012-11-01 Seiko Epson Corp Input image analyzing method, input image analyzing device and computer readable medium
JP2014045396A (en) * 2012-08-28 2014-03-13 Hitachi Omron Terminal Solutions Corp Image processing unit, image processing method, and stand-type scanner
JP2014072667A (en) * 2012-09-28 2014-04-21 Brother Ind Ltd Image processing device and program
CN106331473A (en) * 2015-06-30 2017-01-11 卡西欧计算机株式会社 Image processing apparatus, image processing system, and image processing method
JP2017147765A (en) * 2017-05-23 2017-08-24 カシオ計算機株式会社 Image processing apparatus, image processing system, image processing method and program
JP2017192116A (en) * 2016-04-15 2017-10-19 京セラドキュメントソリューションズ株式会社 Image reader, image reading method and image reading program

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8730342B2 (en) 2007-06-28 2014-05-20 Motorola Mobility Llc Method and apparatus for robust image processing
US8243155B2 (en) 2007-06-28 2012-08-14 Motorola Mobility Llc Method and apparatus for robust image processing
WO2009005887A1 (en) * 2007-06-28 2009-01-08 Motorola, Inc. Method and apparatus for robust image processing
DE102008035650A1 (en) 2007-12-11 2009-07-23 Pfu Ltd., Kahoku Image processor and image processing method
US7893973B2 (en) 2007-12-11 2011-02-22 Pfu Limited Image processor and image processing method using luminance value rate change
JP4479845B2 (en) * 2008-09-30 2010-06-09 カシオ計算機株式会社 Image correction apparatus, image correction method, and image correction program
US8106962B2 (en) 2008-09-30 2012-01-31 Casio Computer Co., Ltd. Image correction apparatus, image correction method and storage medium for image correction program
JP2010086270A (en) * 2008-09-30 2010-04-15 Casio Computer Co Ltd Image correction apparatus, image correction method, and image correction program
JP2010147816A (en) * 2008-12-18 2010-07-01 Canon Inc Imaging apparatus and control method thereof
JP2010191952A (en) * 2009-01-22 2010-09-02 Canon Inc Apparatus and method for performing shading correction
JP2012212425A (en) * 2011-03-30 2012-11-01 Seiko Epson Corp Input image analyzing method, input image analyzing device and computer readable medium
JP2014045396A (en) * 2012-08-28 2014-03-13 Hitachi Omron Terminal Solutions Corp Image processing unit, image processing method, and stand-type scanner
JP2014072667A (en) * 2012-09-28 2014-04-21 Brother Ind Ltd Image processing device and program
CN106331473A (en) * 2015-06-30 2017-01-11 卡西欧计算机株式会社 Image processing apparatus, image processing system, and image processing method
US9889697B2 (en) 2015-06-30 2018-02-13 Casio Computer Co., Ltd. Image processing apparatus, image processing system, image processing method, and recording medium
JP2017192116A (en) * 2016-04-15 2017-10-19 京セラドキュメントソリューションズ株式会社 Image reader, image reading method and image reading program
JP2017147765A (en) * 2017-05-23 2017-08-24 カシオ計算機株式会社 Image processing apparatus, image processing system, image processing method and program

Also Published As

Publication number Publication date
JP4375069B2 (en) 2009-12-02

Similar Documents

Publication Publication Date Title
TWI268096B (en) Image processing apparatus for correcting distortion of image, image shooting apparatus for correcting distortion of shot image and recordable medium
US7760962B2 (en) Image capture apparatus which synthesizes a plurality of images obtained by shooting a subject from different directions, to produce an image in which the influence of glare from a light is reduced
JP4363151B2 (en) Imaging apparatus, image processing method thereof, and program
JP4556813B2 (en) Image processing apparatus and program
JP2011248479A (en) Image processing device, image processing method and program
JP4375069B2 (en) Image processing apparatus, image processing method, and program
JP2016063263A (en) Image processing apparatus, and image processing method
JP4507948B2 (en) Imaging apparatus, image processing method and program for captured image
JP2018107593A (en) Image processing apparatus, image processing method, and program
JP3913604B2 (en) How to create ID photo
JP2007188126A (en) Image brightness calculation device, method, and program
JP6907047B2 (en) Information processing equipment, its control method and program
JP2005260657A (en) Photographing apparatus, image processing method and program therefor
JP2005275447A (en) Image processing device, image processing method and program
JP2017143354A (en) Image processing apparatus and image processing method
JP2014123881A (en) Information processing device, information processing method, and computer program
JP2005269449A (en) Image processor, image processing method and program
JP4636786B2 (en) Captured image projection device, image processing method and program for captured image projection device
JP4363154B2 (en) Imaging apparatus, image processing method thereof, and program
JP2015087870A (en) Image processing apparatus, image processing method, and program
JP4595660B2 (en) Imaging apparatus, captured image processing method, and program
JP4779883B2 (en) Electronic camera
JP4363153B2 (en) Imaging apparatus, image processing method thereof, and program
CN113259539A (en) Document scanning method and device
JP2008147714A (en) Image processor and image processing method

Legal Events

Date Code Title Description
A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20061215

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20061215

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20080918

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20080924

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20081118

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: 20090818

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: 20090831

R150 Certificate of patent or registration of utility model

Ref document number: 4375069

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: 20120918

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20130918

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees