JP2005275447A - Image processing device, image processing method and program - Google Patents

Image processing device, image processing method and program Download PDF

Info

Publication number
JP2005275447A
JP2005275447A JP2004083338A JP2004083338A JP2005275447A JP 2005275447 A JP2005275447 A JP 2005275447A JP 2004083338 A JP2004083338 A JP 2004083338A JP 2004083338 A JP2004083338 A JP 2004083338A JP 2005275447 A JP2005275447 A JP 2005275447A
Authority
JP
Japan
Prior art keywords
image
pixel
image processing
target
processing device
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.)
Abandoned
Application number
JP2004083338A
Other languages
Japanese (ja)
Other versions
JP2005275447A5 (en
Inventor
Yoshihiro Tejima
義裕 手島
Keiichi Sakurai
敬一 櫻井
Tetsuji Makino
哲司 牧野
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 JP2004083338A priority Critical patent/JP2005275447A/en
Publication of JP2005275447A publication Critical patent/JP2005275447A/en
Publication of JP2005275447A5 publication Critical patent/JP2005275447A5/ja
Abandoned legal-status Critical Current

Links

Abstract

<P>PROBLEM TO BE SOLVED: To acquire an image looking like being picked up as the front view by suitably correcting the image to be picked up. <P>SOLUTION: A digital camera 1 comprises a CPU and an image processing device. The image processing device creates a reduced binarized image from a picked up image of a white plate 2 as an imaging object. The image processing device performs labeling process for the reduced binarized image and changes the pixel value of the image into a pixel value of a background pixel with using an image with maximum area as a subject image and an image in other region as an image including an image reflected by a fluorescent lamp. The image processing device acquires a subject image from the reduced binarized image and the border and performs projection conversion by seeking a projection parameter. <P>COPYRIGHT: (C)2006,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参照)。   As a solution to such a problem, for example, there is one in which image distortion is corrected using an image having two parallaxes (see, for example, Patent Document 1).

この画像処理部は、2枚以上の画像に対して視差がなくなるように画像変換を行って貼り合わせることによって合成した補正画像を作成する。そして、画像合成部が、作成された補正画像を画像メモリに記憶させる。
特開2001−134751号公報(第5頁、図1)
This image processing unit creates a corrected image that is synthesized by performing image conversion so that parallax is eliminated with respect to two or more images and combining them. Then, the image composition unit stores the created corrected image in the image memory.
JP 2001-134751 (5th page, FIG. 1)

しかし、かかる従来の装置では、もう一度、画像編集を行う場合、画像メモリに記憶した補正画像を編集すれば、画像は劣化する。また、補正前の元画像を再度、補正しようとすれば、元画像と補正画像とを画像メモリに記憶する必要があるし、元画像に対して同じような画像処理を繰り返す必要がある。   However, in such a conventional apparatus, when image editing is performed again, the image deteriorates if the corrected image stored in the image memory is edited. If the original image before correction is to be corrected again, it is necessary to store the original image and the corrected image in the image memory, and it is necessary to repeat similar image processing on the original image.

そこで、撮影装置に、撮影対象のエッジ画像をもとにして輪郭を検出し、被写体の画像を切り出すことによって撮影対象物の画像を補正する画像処理の機能を備えることが考えられる。   Therefore, it is conceivable that the photographing apparatus has an image processing function for correcting the image of the photographing object by detecting the contour based on the edge image of the photographing object and cutting out the image of the subject.

しかし、このような撮影装置を用いても、撮影の際に撮影対象を画角いっぱいに取り込むことができないため、例えば、プロジェクタ等によってスクリーン上に投影された画像を撮影するような場合、スクリーンの投影部以外に蛍光灯等の反射像や蛍光灯そのものが同時に写り込んでしまう。このような画像は切り出し対象以外の明るい部分を同時に含むため、前述したエッジ画像に四角形の被写体以外のエッジが表れ、それが輪郭として誤検出される場合がある。   However, even when using such a photographing device, the photographing object cannot be captured to the full angle of view at the time of photographing. For example, when photographing an image projected on the screen by a projector or the like, In addition to the projection unit, a reflected image of the fluorescent lamp or the fluorescent lamp itself is reflected at the same time. Since such an image includes a bright part other than the object to be cut out at the same time, an edge other than a quadrangular subject appears in the above-described edge image, and this may be erroneously detected as a contour.

本発明は、このような従来の問題点に鑑みてなされたもので、撮影対象の画像を正しく取得することが可能な画像処理装置、画像処理方法及びプログラムを提供することを目的とする。   SUMMARY An advantage of some aspects of the invention is that it provides an image processing apparatus, an image processing method, and a program that can correctly acquire an image to be captured.

上記目的を達成するため、本発明の第1の観点に係る画像処理装置は、
撮影によって得られた撮影画像から、目的とする撮影対象の画像を取得して画像処理を行う画像処理装置において、
前記撮影対象画像の画素値に対応する画素値を有する画素が連続する領域を求め、求めた複数の領域のうち、面積が最大となる領域の画像を前記撮影対象画像として取得する画像取得部と、
前記画像取得部が取得した前記撮影対象画像の画像処理を行う画像処理部と、を備えたことを特徴とする。
In order to achieve the above object, an image processing apparatus according to the first aspect of the present invention provides:
In an image processing apparatus that acquires an image of a target shooting target from a shot image obtained by shooting and performs image processing,
An image acquisition unit that obtains an area in which pixels having pixel values corresponding to pixel values of the image to be photographed are continuous, and obtains an image of an area having the maximum area among the obtained areas as the image to be photographed; ,
An image processing unit that performs image processing on the image to be captured acquired by the image acquisition unit.

前記画像取得部は、前記撮影画像の各画素を走査して前記撮影対象画像の画素値に対応する画素値を有する画素を対象画素として取得し、取得した対象画素と前記対象画素に隣接する画素の画素値との対応関係に基づいて前記領域を判別するものであることが好ましい。   The image acquisition unit scans each pixel of the captured image, acquires a pixel having a pixel value corresponding to a pixel value of the captured image as a target pixel, and acquires the acquired target pixel and a pixel adjacent to the target pixel It is preferable that the region is determined based on a correspondence relationship with the pixel value.

前記画像取得部は、前記連続した画素によって形成された領域のうち、前記撮影対象画像の領域よりも小さな領域の画像を前記撮影対象とともに撮影された撮影対象外の画像と判別し、前記撮影対象外の画像の画素値を予め設定された背景画素の画素値に変更して、前記撮影対象画像を取得するものであることが好ましい。   The image acquisition unit determines that an image of an area smaller than the area of the image to be imaged among areas formed by the continuous pixels is an image outside the object to be imaged taken together with the object to be imaged, and It is preferable that the pixel value of an outside image is changed to a pixel value of a background pixel set in advance to acquire the image to be captured.

前記撮影画像の各画素の画素値を所定の閾値と比較し、比較結果に基づいて前記撮影画像の二値化画像を作成する二値化画像作成部を備え、
前記画像取得部は、前記二値化画像作成部が作成した二値化画像から、前記撮影対象画像に対応する画素値を有する画素を取得するものであることが好ましい。
Comparing a pixel value of each pixel of the photographed image with a predetermined threshold, and a binarized image creating unit that creates a binarized image of the photographed image based on a comparison result,
It is preferable that the image acquisition unit acquires a pixel having a pixel value corresponding to the shooting target image from the binarized image created by the binarized image creation unit.

前記画像取得部は、前記撮影画像の各画素を走査して前記対象画素を取得したときに、取得した対象画素に隣接する画素の画素値を参照し、既に走査された隣接画素が予め設定された背景画素の画素値を有する場合には、前記対象画素に新たに固有の値を付し、前記隣接画素に既に固有の値が付されたものがある場合には、前記対象画素に前記隣接画素と同じ値を付すことにより、前記対象画素と前記対象画素に隣接する画素の画素値との対応関係を求め、前記撮影画像の全画素を走査したときに、各画素に付された固有の値を参照して前記領域を判別するものであることが好ましい。   When the image acquisition unit scans each pixel of the captured image to acquire the target pixel, the image acquisition unit refers to the pixel value of the pixel adjacent to the acquired target pixel, and the already scanned adjacent pixel is preset. If the pixel value of the background pixel has a unique value, the target pixel is newly assigned a unique value, and if the adjacent pixel already has a unique value, the neighbor pixel is adjacent to the target pixel. By assigning the same value as the pixel, the correspondence relationship between the target pixel and the pixel value of the pixel adjacent to the target pixel is obtained, and when all the pixels of the photographed image are scanned, each pixel is assigned a unique value. It is preferable that the area is discriminated with reference to a value.

前記画像処理部は、
前記画像取得部が取得した前記撮影対象画像の輪郭を取得して、前記画像の形状を取得する形状取得部と、
前記形状取得部が取得した前記撮影対象画像の形状と前記撮影対象の形状とを対応させて、前記撮影対象と前記撮影対象画像との関係を示す射影パラメータを求める射影パラメータ取得部と、
前記射影パラメータ取得部が求めた射影パラメータを用いて前記撮影対象画像の画像変換を行う画像変換部と、を備えたものであることが好ましい。
The image processing unit
A shape acquisition unit that acquires the contour of the image to be captured acquired by the image acquisition unit and acquires the shape of the image;
A projection parameter acquisition unit that obtains a projection parameter indicating a relationship between the imaging target and the imaging target image by associating the shape of the imaging target image acquired by the shape acquisition unit with the shape of the imaging target;
It is preferable to include an image conversion unit that performs image conversion of the image to be captured using the projection parameter obtained by the projection parameter acquisition unit.

上記目的を達成するため、本発明の第2の観点に係る画像処理方法は、
撮影対象を撮影する撮影装置の画像処理方法であって、
撮影によって得られた撮影画像から、目的とする撮影対象の画像の画素値に対応する画素値を有する画素が連続する領域を求めるステップと、
求めた領域が複数の場合、面積が最大となる領域の画像を前記撮影対象画像として取得するステップと、
前記取得した前記撮影対象の画像の画像処理を行うステップと、を備えたことを特徴とする。
In order to achieve the above object, an image processing method according to a second aspect of the present invention includes:
An image processing method of a photographing apparatus for photographing a photographing object,
Obtaining a region in which pixels having pixel values corresponding to pixel values of a target image to be photographed are continuous from a photographed image obtained by photographing;
When there are a plurality of obtained regions, obtaining an image of the region having the largest area as the image to be captured;
And performing image processing on the acquired image to be photographed.

上記目的を達成するため、本発明の第3の観点に係るプログラムは、
コンピュータに、
撮影によって得られた撮影画像から、目的とする撮影対象の画像の画素値に対応する画素値を有する画素が連続する領域を求める手順、
求めた領域が複数の場合、面積が最大となる領域の画像を前記撮影対象画像として取得する手順、
前記取得した前記撮影対象の画像の画像処理を行う手順、
を実行させるためのものである。
In order to achieve the above object, a program according to the third aspect of the present invention provides:
On the computer,
A procedure for obtaining a region in which pixels having pixel values corresponding to pixel values of a target image to be photographed are continuous from a photographed image obtained by photographing,
In the case where there are a plurality of obtained areas, a procedure for acquiring an image of an area with the largest area as the image to be captured,
A procedure for performing image processing of the acquired image to be imaged;
Is to execute.

本発明によれば、容易に撮影対象物の画像を補正することができる。   According to the present invention, it is possible to easily correct an image of a photographing object.

以下、本発明の実施形態に係る撮影装置を図面を参照して説明する。
尚、実施形態では、撮影装置をデジタルカメラとして説明する。
Hereinafter, an imaging device according to an embodiment of the present invention will be described with reference to the drawings.
In the embodiment, the photographing apparatus is described as a digital camera.

本実施形態に係るデジタルカメラ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 characters, drawings, photographs, and the like such as the white board 2 as a target shooting target, detects and corrects image distortion from an image obtained by shooting, as if An image as if taken from the front is generated. The digital camera 1 includes a photographic lens unit 11, a liquid crystal monitor 12, and a shutter button 13.

撮影レンズ部11は、光を集光するレンズ等を備え、白板2等の文字、図、写真等からの光を集光するものである。   The photographic lens unit 11 includes a lens that collects light and the like, and collects light from characters such as the white plate 2, drawings, and photographs.

液晶モニタ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 on the white plate 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に送り出す。   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.

表示装置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)に示すように、白板2と文字、図、写真等の画像が歪んで表示される。画像処理装置25は、この図3(b),(c)に示すような画像に対して画像処理を施すことにより、図3(d)に示すような、正面から撮影したような画像を生成する。   As shown in FIG. 3A, when the digital camera 1 shoots characters on the white plate 2 from the left direction and the right direction, the liquid crystal monitor 12 displays the characters shown in FIGS. 3B and 3C. As shown, the white plate 2 and images such as letters, diagrams, and photographs are distorted and displayed. The image processing device 25 performs image processing on the images as shown in FIGS. 3B and 3C to generate an image taken from the front as shown in FIG. 3D. To do.

画像処理装置25は、画像歪みを補正するため、歪んだ画像から四角形を切り取り、切り取った四角形に撮影画像を射影変換する。   In order to correct image distortion, the image processing device 25 cuts a square from the distorted image, and performs projective transformation of the captured image into the cut quadrangle.

さらに具体的には、画像処理装置25は、CPU30に制御されて、主に、以下の処理等を行う。
(1)撮影画像からのアフィンパラメータ抽出
(2)抽出したアフィンパラメータによる画像変換
(3)画像変換の調整処理
(4)輝度あるいは色差等に関する画像効果補正用パラメータの抽出及び画像効果処理
尚、これらの処理内容については、後述する。
More specifically, the image processing device 25 is controlled by the CPU 30 and mainly performs the following processing.
(1) Extraction of affine parameters from photographed image (2) Image conversion using extracted affine parameters (3) Adjustment processing of image conversion (4) Extraction of image effect correction parameters relating to luminance or color difference and image effect processing The processing contents of 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は、図4に示すように、上縮小キー111と、下縮小キー112と、右縮小キー113と、左縮小キー114と、右回転キー115と、左回転キー116と、を備える。   As shown in FIG. 4, the operation unit 26 includes an upper reduction key 111, a lower reduction key 112, a right reduction key 113, a left reduction key 114, a right rotation key 115, and a left rotation key 116. .

上縮小キー111と、下縮小キー112と、右縮小キー113と、左縮小キー114とは、射影変換を行なうための射影変換キーである。上縮小キー111は、X軸を中心に画像の上部と下部とを比較し、上部が大きい場合に、上部を紙面に向かって下方向に回転させるときに押下するキーである。   The upper reduction key 111, the lower reduction key 112, the right reduction key 113, and the left reduction key 114 are projective conversion keys for performing projective conversion. The upper reduction key 111 is a key that is pressed when the upper part of the image is compared with the lower part around the X axis and the upper part is large and the upper part is rotated downward toward the paper surface.

下縮小キー112は、X軸を中心に画像の上部と下部を比較し、下部が大きい場合に、下部を紙面に向かって下方向に回転させるときに押下するキーである。   The lower reduction key 112 is a key that is pressed when the upper part and the lower part of the image are compared around the X axis, and the lower part is rotated downward toward the paper surface when the lower part is large.

右縮小キー113と左縮小キー114とは、Y軸側を中心に左右のひずみを調整するときに押下するキーであり、右縮小キー113は、右が大きいときに押下するキーであり、左縮小キー114は、左が大きいときに押下するキーである。   The right reduction key 113 and the left reduction key 114 are keys that are pressed when adjusting left and right distortion around the Y-axis side, and the right reduction key 113 is a key that is pressed when the right is large, and left The reduction key 114 is a key that is pressed when the left side is large.

右回転キー115と左回転キー116とは、画像の回転を調整するための回転補正キーである。右回転キー115は、画像を右に回転するときに押下するキーであり、左回転キー116は、画像を左に回転するときに押下するキーである。   The right rotation key 115 and the left rotation key 116 are rotation correction keys for adjusting the rotation of the image. The right rotation key 115 is a key that is pressed when the image is rotated to the right, and the left rotation key 116 is a key that is pressed when the image is rotated to the left.

また、操作部26は、この他に、撮影キー、再生キー、カーソルキー、コントロールキー等(図示せず)を備える。撮影キーは、撮影対象を撮影するときの撮影モードを選択するためのキーである。再生キーは、撮影によって得られた撮影対象画像を再生するときの再生モードを選択するためのキーである。コントロールキーは、操作を確定させるYESキー、操作をキャンセルするためのNOキー、編集を行うための編集キー等の機能を有するキーである。   In addition, the operation unit 26 includes a photographing key, a reproduction key, a cursor key, a control key, and the like (not shown). 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. This header information will be described later.

次に本実施形態に係るデジタルカメラ1の動作を説明する。
ユーザがデジタルカメラ1の電源をオン(投入)すると、CPU30はプログラムコード記憶装置29に記憶されているプログラムのデータを取得する。ユーザが撮影ボタンを押下すると、操作部26は、この操作情報をCPU30に送信する。CPU30はこの操作情報を受信し、CPU30、画像処理装置25等は、図5に示すフローチャートに従って撮影処理を実行する。
Next, the operation of the digital camera 1 according to this 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 presses the shooting button, 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 the 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に対して、プレビューモードから高解像度モードに切り替えてイメージセンサ22を制御する(ステップS13)。   If 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 the image sensor 22 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)。   If it is determined that all the image data has been read and the image transfer 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 for the preview image in the memory 23. The preview image data is written in the storage area (step S16).

CPU30は、圧縮データを作成するように画像処理装置25を制御し、画像処理装置25は、圧縮データを作成する(ステップS17)。
CPU30は、この圧縮データを、外部記憶IO装置28を介してメモリカード31に記録し、画像処理装置25が作成した圧縮データを保存する(ステップS18)。
The CPU 30 controls the image processing device 25 so as to create compressed data, and the image processing device 25 creates compressed data (step S17).
The CPU 30 records this compressed data on the memory card 31 via the external storage IO device 28, and stores the compressed data created by the image processing device 25 (step S18).

次に、画像処理装置25は、CPU30の制御の下、撮影画像から正面画像を作るための射影パラメータを抽出する(ステップS19)。   Next, the image processing device 25 extracts projection parameters for creating a front image from the captured image under the control of the CPU 30 (step S19).

CPU30、画像処理装置25は、射影パラメータを抽出できたか否かを判定する(ステップS20)。
抽出できたと判定した場合(ステップS20においてYes)、画像処理装置25は、抽出した射影パラメータに基づいて射影変換画像を作成する(ステップS21)。
The CPU 30 and the image processing device 25 determine whether or not the projection parameters have been extracted (step S20).
If it is determined that the extraction has been completed (Yes in step S20), the image processing device 25 creates a projected transformation image based on the extracted projection parameters (step S21).

操作部26の射影変換キー、回転補正キーが押下されると、操作部26は、この操作情報をCPU30に送信する。CPU30は、操作部26からの操作情報を画像処理装置25に送信し、画像処理装置25は、送信された操作情報に従って、画像変換の調整処理を行う(ステップS22)。   When the projection conversion key and the rotation correction key of the operation unit 26 are pressed, the operation unit 26 transmits this operation information to the CPU 30. The CPU 30 transmits operation information from the operation unit 26 to the image processing device 25, and the image processing device 25 performs image conversion adjustment processing in accordance with the transmitted operation information (step S22).

画像処理装置25は、画像効果補正用パラメータを抽出し(ステップS23)、画像効果処理を行う(ステップS24)。   The image processing device 25 extracts image effect correction parameters (step S23) and performs image effect processing (step S24).

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

画像処理装置25は、作成した圧縮データをメモリカード31の画像ファイルに記録する(ステップS26)。また、CPU30は、射影変換に用いた射影パラメータ、画像効果処理に用いた画像効果補正用パラメータをメモリカード31の画像ファイルに記憶する。   The image processing device 25 records the created compressed data in the image file of the memory card 31 (step S26). Further, the CPU 30 stores the projection parameters used for the projective conversion and the image effect correction parameters used for the image effect processing in the image file of the memory card 31.

一方、射影パラメータを抽出することができなかったと判定した場合(ステップS20においてNo)、CPU30は、警告処理を行う(ステップS27)。   On the other hand, when it is determined that the projection parameters could not be extracted (No in step S20), the CPU 30 performs a warning process (step S27).

CPU30等は、このようにして撮影処理を終了させる。尚、ユーザがキーを操作しない限り、CPU30等は、この撮影処理を繰り返し実行する。   The CPU 30 and the like end the photographing process in this way. Note that the CPU 30 or the like repeatedly executes this photographing process unless the user operates the key.

次に、画像処理装置25が行う画像処理について説明する。
まず、画像処理装置25が画像処理に用いるアフィン変換についての基本的な考え方(実現方法)を説明する。
Next, image processing performed by the image processing device 25 will be described.
First, the basic concept (implementation method) of affine transformation used by the image processing apparatus 25 for image processing will be described.

画像の空間変換にアフィン変換が幅広く応用されている。本実施形態では、3次元のカメラパラメータを用いずに2次元アフィン変換を用いて射影変換を行う。これは、変換前の座標(u,v)の点が、移動、拡大縮小、回転などの変換によって、変換後の座標(x,y)が次の数1、数2によって関係付けられることになる。射影変換もこのアフィン変換により行われることができる。
最終的な座標(x,y)は、次の数2によって算出される。
数2は、射影変換するための式であり、座標x、yは、z’の値に従い、0に向かって縮退する。即ち、z’に含まれるパラメータが射影に影響を及ぼすことになる。このパラメータはa13,a23,a33である。また、他のパラメータは、パラメータa33で正規化されることができるので、a33を1としてもよい。
Affine transformation is widely applied to image spatial transformation. In this embodiment, projective transformation is performed using two-dimensional affine transformation without using three-dimensional camera parameters. This is because the coordinates (u, v) before conversion are related by the transformation such as movement, enlargement / reduction, and rotation, and the coordinates (x, y) after conversion are related by the following equations (1) and (2). Become. Projective transformation can also be performed by this affine transformation.
The final coordinates (x, y) are calculated by the following formula 2.
Expression 2 is an expression for projective transformation, and the coordinates x and y are reduced toward 0 according to the value of z ′. That is, the parameter included in z ′ affects the projection. This parameter is a13, a23, a33. Since other parameters can be normalized by the parameter a33, a33 may be 1.

図6は、四角形の撮影画像の各頂点の座標を示したものである。デジタルカメラ1で撮影された四角形と実際の撮影対象(白板2)との関係について、図7に基づいて説明する。   FIG. 6 shows the coordinates of each vertex of a rectangular captured image. The relationship between the quadrangle photographed with the digital camera 1 and the actual photographing object (white plate 2) will be described with reference to FIG.

この図7において、U−V−W座標系は、デジタルカメラ1で撮影して得られた画像の3次元座標系である。A(Au,Av,Aw)ベクトルとB(Bu,Bv,Bw)ベクトルとは、3次元座標系U−V−Wにおいて、撮影対象をベクトルで表したものである。
また、S(Su,Sv,Sw)ベクトルは、3次元座標系U−V−Wの原点と撮影対象との距離を示す。
In FIG. 7, the UVW coordinate system is a three-dimensional coordinate system of an image obtained by photographing with the digital camera 1. The A (Au, Av, Aw) vector and the B (Bu, Bv, Bw) vector represent the object to be imaged in the three-dimensional coordinate system UV-W.
The S (Su, Sv, Sw) vector indicates the distance between the origin of the three-dimensional coordinate system UV-W and the object to be imaged.

図7に示す投影スクリーンは、撮影対象の画像の射影を行うためのものである。
投影スクリーン上の座標系をx,yとすると、この投影スクリーン上に投影される画像がデジタルカメラ1に撮影される画像と考えればよい。投影スクリーンは、W軸上から距離fだけ離れて垂直に位置するものとする。撮影対象の任意の点P(u,v,w)と原点とを直線で結び、その直線と投影スクリーンと交差する点があるものとして、その交点のX−Y座標をp(x,y)とする。このとき、座標pは、射影変換より次の数3によって表される。
数3より、図7に示すように点P0,P1,P2,P3と投影スクリーンへの投影点p0,p1,p2,p3との関係から、次の数4に示す関係が求められる。
このとき、射影係数α、βは次の数5によって表される。
The projection screen shown in FIG. 7 is for projecting an image to be photographed.
If the coordinate system on the projection screen is x, y, the image projected on the projection screen may be considered as the image photographed by the digital camera 1. It is assumed that the projection screen is positioned vertically at a distance f from the W axis. An arbitrary point P (u, v, w) to be photographed is connected to the origin by a straight line, and there is a point where the straight line intersects the projection screen, and the XY coordinate of the intersection is p (x, y). And At this time, the coordinate p is expressed by the following equation 3 by projective transformation.
From Equation 3, the relationship shown in the following Equation 4 is obtained from the relationship between the points P0, P1, P2, P3 and the projection points p0, p1, p2, p3 on the projection screen as shown in FIG.
At this time, the projection coefficients α and β are expressed by the following equation (5).

次に、射影変換について説明する。
撮影対象上の任意の点Pは、S,A,Bベクトルを用いて、次の数6によって表される。
この数6に、数4の関係式を代入すると、座標xとyとは、次の数7によって表される。
Next, projective transformation will be described.
An arbitrary point P on the object to be imaged is expressed by the following equation 6 using S, A, and B vectors.
When the relational expression of Expression 4 is substituted into Expression 6, the coordinates x and y are expressed by the following Expression 7.

この関係を、アフィン変換の式に当てはめると、座標(x',y',z')は、次の数8によって表される。
When this relationship is applied to the affine transformation formula, the coordinates (x ′, y ′, z ′) are expressed by the following equation (8).

この数8にm,nを代入することにより、撮影画像の対応点(x,y)が求められる。対応点(x,y)は、整数値とは限らないので、画像補間法などを用いて画素の値を求めればよい。   By substituting m and n into Equation 8, the corresponding point (x, y) of the captured image is obtained. Since the corresponding point (x, y) is not necessarily an integer value, the pixel value may be obtained using an image interpolation method or the like.

上記m,nは、予め補正画像p(u,v)を出力する画像サイズ(0≦u<umax, 0≦v<vmax)を与えて、その画像サイズに合わせて画像を調整する方法が考えられる。この方法によれば、m,nは次の数9によって表される。
しかし、作成される補正画像の縦横比と撮影対象の縦横比とは一致しない。ここで、補正画像p(u,v)とm、nの値との関係は、数3、数4、数5から、次の数10によって表される。
For m and n, an image size (0 ≦ u <umax, 0 ≦ v <vmax) for outputting the corrected image p (u, v) is given in advance, and a method of adjusting the image according to the image size is considered. It is done. According to this method, m and n are expressed by the following equation (9).
However, the aspect ratio of the corrected image to be created does not match the aspect ratio of the shooting target. Here, the relationship between the corrected image p (u, v) and the values of m and n is expressed by the following Expression 10 from Expression 3, Expression 4, and Expression 5.

カメラパラメータであるレンズの焦点距離fが既知であれば、数10に従って、縦横比kを求めることができる。従って、補正画像p(u,v)の画像サイズを(0≦u<umax, 0≦v<vmax)であるとすると、次の数11に従ってm、nを求めることにより、撮影対象と同じ縦横比kを得ることができる。
尚、カメラが固定焦点である場合、レンズの焦点距離fの値を、予め得ることができる。ズームレンズ等が存在する場合には、レンズの焦点距離fの値は、レンズのズーム倍率によって変化するので、そのズーム倍率とレンズの焦点距離fとの関係をを示すテーブルを予め作成して記憶し、ズーム倍率に基づいて焦点距離fを読み出し、数10,数11に従って、射影変換を行うことができる。
If the focal length f of the lens, which is a camera parameter, is known, the aspect ratio k can be obtained according to Equation 10. Therefore, if the image size of the corrected image p (u, v) is (0 ≦ u <umax, 0 ≦ v <vmax), m and n are obtained according to the following equation 11 to obtain the same vertical and horizontal as the object to be imaged. The ratio k can be obtained.
If the camera has a fixed focus, the value of the focal length f of the lens can be obtained in advance. When a zoom lens or the like is present, the value of the focal length f of the lens changes depending on the zoom magnification of the lens. Therefore, a table indicating the relationship between the zoom magnification and the focal length f of the lens is created and stored in advance. Then, the focal length f can be read based on the zoom magnification, and projective transformation can be performed according to Equations 10 and 11.

画像処理装置25は、このようなアフィン変換を行うため、まず、撮影した撮影対象の画像から射影パラメータを抽出する(図5のステップS19)。
画像処理装置25が実行する射影パラメータの抽出処理を図8に示すフローチャートに基づいて説明する。
In order to perform such affine transformation, the image processing device 25 first extracts projection parameters from the captured image to be captured (step S19 in FIG. 5).
Projection parameter extraction processing executed by the image processing device 25 will be described with reference to the flowchart shown in FIG.

画像処理装置25は、撮影した撮影対象の画像から、この撮影対象の画像の四隅の座標点(四角形輪郭)を抽出する(ステップS31)。画像処理装置25は、図9に示すフローチャートに従って四角形の輪郭を抽出する。   The image processing device 25 extracts coordinate points (rectangular outlines) at the four corners of the captured image from the captured image (step S31). The image processing device 25 extracts a rectangular outline according to the flowchart shown in FIG.

即ち、画像処理装置25は、画像処理の演算数を減らすため、入力画像から縮小画像を作成する。そして、作成した縮小画像に対して、所定の閾値をもとに二値化処理をおこない、縮小二値化画像を作成する(ステップS41)。尚、縮小画像として、ステップS16で生成したプレビュー画像を用いてもよい。   That is, the image processing device 25 creates a reduced image from the input image in order to reduce the number of operations for image processing. Then, binarization processing is performed on the created reduced image based on a predetermined threshold value to create a reduced binary image (step S41). Note that the preview image generated in step S16 may be used as the reduced image.

ここで、二値化の閾値は、以下のように求める。
画像処理装置25は、画像の中央部に四角形の切り出し対象があると仮定し、画像中央部のヒストグラムを作成する。前述の仮定により、作成したヒストグラムのピーク値は切り出し対象の輝度値となるため、画像処理装置25は、このピーク値から一定値を差し引いた値を、二値化の閾値とする。
Here, the threshold for binarization is obtained as follows.
The image processing device 25 assumes that there is a quadrilateral extraction target at the center of the image, and creates a histogram at the center of the image. Based on the above assumption, the peak value of the created histogram is the luminance value to be cut out, so the image processing apparatus 25 sets a value obtained by subtracting a certain value from this peak value as the threshold for binarization.

この縮小二値化画像には、撮影対象画像だけでなく、撮影対象外の蛍光灯の反射画像等そのものも含まれている場合があるため、画像処理装置25は、まず、この縮小二値化画像に対してラベリング処理をおこない最大連結領域を抽出する(ステップS42)。   Since this reduced binarized image may include not only the image to be photographed but also the reflected image of the fluorescent lamp that is not the object of photographing, etc., the image processing device 25 first performs this reduction binarization. A labeling process is performed on the image to extract the maximum connected area (step S42).

ラベリング処理は、画像中で連結成分(連結している画素群)に固有の値(ラベル)をつける処理である。この固有の値が付けられた連結成分には、蛍光灯の反射画像のような背景ではない撮影対象画像も含まれる。   The labeling process is a process of assigning a unique value (label) to a connected component (connected pixel group) in an image. The connected component to which the unique value is attached includes a photographing target image that is not a background such as a reflected image of a fluorescent lamp.

画像処理装置25は、さらにラベリング処理をおこなった後、同一ラベルを持つ最大の面積を持つ領域を撮影対象画像と判別し、最大の面積を持つラベル領域以外の画像は撮影対象画像と同時に写っている撮影対象外画像と判別して、縮小二値画像において、このラベル以外の画素を0にクリアする。このラベリング処理の詳細については、後述する。   The image processing device 25 further performs a labeling process, and then determines that the area having the same label and the largest area is the shooting target image, and images other than the label area having the largest area are captured at the same time as the shooting target image. It discriminate | determines from the imaging | photography outside image object, and clears pixels other than this label to 0 in a reduced binary image. Details of the labeling process will be described later.

画像処理装置25は、ラベリング処理によって最大連結領域の抽出をおこなった後の縮小二値化画像から、撮影対象のエッジ画像を作成する(ステップS43)。   The image processing device 25 creates an edge image to be imaged from the reduced binarized image after the maximum connected area is extracted by the labeling process (step S43).

画像処理装置25は、撮影対象のエッジ画像から、直線検出をおこなうためにラドン変換をおこなう(ステップS44)。ラドン変換の詳細は後述する。
ラドン変換で得られるデータを用いて、エッジ画像に含まれる直線パラメータを検出する(ステップS45)。直線検出の詳細は後述する。
画像処理装置25は、検出した直線パラメータから、撮影対象の輪郭を形成する候補となる四角形を作成する(ステップS46)。
The image processing device 25 performs radon conversion in order to perform straight line detection from the edge image to be imaged (step S44). Details of the Radon conversion will be described later.
Using the data obtained by the Radon transform, a straight line parameter included in the edge image is detected (step S45). Details of the straight line detection will be described later.
The image processing apparatus 25 creates a quadrangle that is a candidate for forming the contour of the imaging target from the detected straight line parameter (step S46).

説明を再び図8に戻す。画像処理装置25は、このように候補となる四角形を生成し、生成した各四角形に優先順位を付す(図8のステップS32)。
画像処理装置25は、優先順位に従って四角形を選択し、選択した四角形を抽出できたか否かを判定する(ステップS33)。
The description returns to FIG. 8 again. The image processing device 25 generates the candidate rectangles in this way, and assigns priorities to the generated rectangles (step S32 in FIG. 8).
The image processing device 25 selects a rectangle according to the priority order, and determines whether or not the selected rectangle has been extracted (step S33).

四角形を抽出できなかったと判定した場合(ステップS33においてNo)、CPU30は、この射影パラメータ抽出処理を終了させる。   If it is determined that the quadrangle could not be extracted (No in step S33), the CPU 30 ends the projection parameter extraction process.

一方、四角形を抽出できたと判定した場合(ステップS33においてYes)、CPU30は、画像処理装置25から、抽出した四角形を取得して、表示装置24に送り、液晶モニタ12に、四角形のプレビュー画像を表示させる(ステップS34)。   On the other hand, if it is determined that the quadrangle has been extracted (Yes in step S33), the CPU 30 acquires the extracted quadrangle from the image processing device 25, sends it to the display device 24, and displays the quadrangle preview image on the liquid crystal monitor 12. It is displayed (step S34).

CPU30は、操作部26から送信された操作情報に基づいてYESキー、NOキーのいずれが押下されたか否かを判定する(ステップS35)。   The CPU 30 determines whether the YES key or the NO key has been pressed based on the operation information transmitted from the operation unit 26 (step S35).

NOキーが押下されたとCPU30が判定した場合(ステップS35においてNo)、画像処理装置25は、次の候補の四角形を指定する(ステップS36)。   If the CPU 30 determines that the NO key has been pressed (No in step S35), the image processing device 25 designates the next candidate rectangle (step S36).

一方、YESキーが押下されたと判定した場合(ステップS35においてYes)、CPU30は、抽出した四角形の頂点から、アフィンパラメータを算出する(ステップS37)。   On the other hand, if it is determined that the YES key has been pressed (Yes in step S35), the CPU 30 calculates affine parameters from the extracted quadrangular vertices (step S37).

次に、この射影パラメータの抽出処理を、さらに具体的に説明する。
画像処理装置25がステップS41において生成した縮小二値化画像の一例を図10(a)に示す。
Next, the projection parameter extraction process will be described more specifically.
An example of the reduced binarized image generated by the image processing apparatus 25 in step S41 is shown in FIG.

画像処理装置25は、生成した縮小二値化画像に対して、ラベリング処理を用いて最大連結領域の抽出(ステップS42の処理)を行う。このラベリング処理の詳細について説明する。前述のように、この縮小二値化画像には、図10(b)に示すように、撮影対象画像だけでなく、撮影対象外の画像として、蛍光灯の反射画像も同時に含まれている場合がある。このため、画像処理装置25は、この縮小二値化画像に対してラベリング処理を行い、撮影対象画像を判別する。   The image processing device 25 extracts a maximum connected region (processing in step S42) using a labeling process for the generated reduced binary image. Details of the labeling process will be described. As described above, in this reduced binarized image, as shown in FIG. 10B, not only the image to be photographed but also the reflected image of the fluorescent lamp is included as an image outside the object to be photographed. There is. For this reason, the image processing device 25 performs a labeling process on the reduced binarized image, and determines an image to be captured.

あらかじめ、メモリ23に縮小画像の各画素に対応するラベルを記憶するための領域を確保しておく。また、この領域のデータをラベル画像と呼ぶことにする。また本実施形態ではラベリング処理によって付加されるラベル番号は1から254までであるとする。   In advance, an area for storing a label corresponding to each pixel of the reduced image is secured in the memory 23. The data in this area is called a label image. In the present embodiment, it is assumed that the label numbers added by the labeling process are 1 to 254.

画像処理装置25は、二値画像からラベル画像の初期化をおこなう。二値画像が0であるところをラベル画像では背景とし、ここに0を書き込む。他方、二値画像が1である場合は、ラベル画像では初期ラベル(255)を書き込む。   The image processing device 25 initializes the label image from the binary image. The place where the binary image is 0 is set as the background in the label image, and 0 is written here. On the other hand, when the binary image is 1, the initial label (255) is written in the label image.

画像処理装置25は、ラベル画像の画素を、ラベル画像の左上からx方向に右端まで走査する処理を、順次、y方向に行うものとする。画像処理装置25は、背景画素ではない各画素を対象画素として、その対象画素の上下及び左右に隣接する8つの画素の画素値を調べる。尚、背景画素とは、予め設定された背景色の画素値(=0)を有する画素である。   It is assumed that the image processing device 25 sequentially performs the process of scanning the pixels of the label image from the upper left of the label image to the right end in the x direction in the y direction. The image processing device 25 uses each pixel that is not a background pixel as a target pixel, and examines pixel values of eight pixels adjacent to the target pixel in the vertical and horizontal directions. The background pixel is a pixel having a preset background color pixel value (= 0).

画像処理装置25は、その対象画素の上下及び左右に隣接する8つの画素の値とラベルとに基づいて、このラベリング処理を行い、撮影対象画像に対応する画素値を有する画素が連続する領域を求める。画像処理装置25は、以下の条件に従ってラベリング処理を行う。   The image processing device 25 performs this labeling process based on the values and labels of eight pixels adjacent to the target pixel in the vertical and horizontal directions, and displays a region in which pixels having pixel values corresponding to the photographic target image are continuous. Ask. The image processing device 25 performs labeling processing according to the following conditions.

(1)条件1
図11(a)に示すように、対象画素が背景色ではなく、上及び左に隣接する4つの画素全てが背景画素であり、かつ、下及び右に隣接する4つの画素のうち、背景画素でない画素が含まれている場合、画像処理装置25は、対象画素に新しいラベルをつける。
(1) Condition 1
As shown in FIG. 11A, the target pixel is not a background color, all four pixels adjacent to the upper and left sides are background pixels, and among the four pixels adjacent to the lower and right sides, the background pixel If the pixel is not included, the image processing device 25 attaches a new label to the target pixel.

(2)条件2
図11(b)に示すように、対象画素が背景色ではなく、上及び左に隣接する4つの画素の中に背景画素でない画素があり、そのいずれかの画素に1種類のラベルがついている場合は、画像処理装置25は、対象画素に、この隣接画素と同じラベルを付ける。
(2) Condition 2
As shown in FIG. 11B, the target pixel is not a background color, and there are pixels that are not background pixels among the four pixels adjacent to the upper and left sides, and any one of the pixels has one type of label. In this case, the image processing device 25 attaches the same label as the adjacent pixel to the target pixel.

(3)条件3
図11(c)に示すように、対象画素が背景色ではなく、上及び左に隣接する4つの画素の中に背景画素でない画素があり、複数の画素に2種類以上のラベルがついている場合、画像処理装置25は、対象画素に、2種類以上のラベル番号の中で最も小さいラベル番号を付けるとともに、これらのラベルがつけられている画素が同じ連結成分であることを記憶する。尚、画像処理装置25は、最後まで走査したら、もう一度走査を行ない、記憶した同じ連結成分に対して同一のラベルを付け直す。
(3) Condition 3
As shown in FIG. 11C, the target pixel is not a background color, and there are pixels that are not background pixels among the four pixels adjacent to the top and left, and two or more types of labels are attached to a plurality of pixels. The image processing device 25 gives the target pixel the smallest label number of two or more types of label numbers, and stores that the pixels to which these labels are attached are the same connected component. When the image processing device 25 has scanned to the end, the image processing device 25 scans again and re-labels the same connected components stored.

(4)条件4
ラベリングの際のラベル数を減らすため、図11(d)に示すように、対象画素に隣接する画素が全て背景画素である場合、画像処理装置25は、孤立点としてその対象画素には、ラベルを付けずに初期値(=255)のまま保持する。
(4) Condition 4
In order to reduce the number of labels at the time of labeling, as shown in FIG. 11D, when all the pixels adjacent to the target pixel are background pixels, the image processing device 25 displays a label on the target pixel as an isolated point. The initial value (= 255) is held without attaching.

画像処理装置25は、このような条件1〜4に従って、すべての連結成分にラベルを付け、ラベル付けを終了すると、連結成分のうち、最大の面積を有する連結成分のラベルを検出する。画像処理装置25は、最大の面積を有する連結成分は撮影対象画像のものとして、このラベルがついた画素を保持し、他の画素を、蛍光灯の反射画像等によるものとして、その画素値を背景画素の画素値に変更する。   The image processing device 25 labels all connected components according to the conditions 1 to 4 described above. When the labeling is completed, the image processing device 25 detects the connected component label having the largest area among the connected components. The image processing device 25 holds the pixel with this label, assuming that the connected component having the largest area is that of the image to be photographed, and sets the pixel value of the other pixels as those based on the reflected image of the fluorescent lamp. Change to the pixel value of the background pixel.

このような内容に基づき、画像処理装置25は、図12に示すフローチャートに従ってラベリング処理を実行する。   Based on such contents, the image processing device 25 executes a labeling process according to the flowchart shown in FIG.

まず、画像処理装置25は、ラベル画像の全画素を二値画像データに基づいて初期化をおこなう。すなわち、二値画像が0である画素に対応するラベル画像では背景とし0を書き込む。他方、二値画像が1である場合は、ラベル画像では初期ラベルを書き込む(ステップS51)   First, the image processing device 25 initializes all the pixels of the label image based on the binary image data. That is, 0 is written as the background in the label image corresponding to the pixel whose binary image is 0. On the other hand, if the binary image is 1, the initial label is written in the label image (step S51).

つづいて、画像処理装置25は、ラベル画像の左上の画素(ピクセル)を対象画素として設定する(ステップS52)。   Subsequently, the image processing device 25 sets the upper left pixel (pixel) of the label image as a target pixel (step S52).

画像処理装置25は、対象画素が背景色(=0)であるか否かを判別する(ステップS53)。背景色であると判別すると(ステップS53:Yes)、ステップS61にジャンプをおこない後述するステップS61の処理に進む。他方、対象画素が背景色でないと判別すると(ステップS53:No)、画像処理装置25は、対象画素について、その周辺に隣接する8つの画素のうち、上側または左側に隣接する画素で、背景画素以外の画素値を有するものが存在するか否かを判別する(ステップS54)。   The image processing device 25 determines whether or not the target pixel is the background color (= 0) (step S53). If it is determined that the color is the background color (step S53: Yes), the process jumps to step S61 and proceeds to the process of step S61 described later. On the other hand, when it is determined that the target pixel is not the background color (step S53: No), the image processing device 25 is the pixel adjacent to the upper side or the left side of the eight pixels adjacent to the periphery of the target pixel. It is determined whether or not there is a pixel value other than (step S54).

背景画素以外の画素が上側又は左側に隣接していると判別すると(ステップS54:Yes)、画像処理装置25は、異なる種類のラベルがつけられている複数の隣接画素が存在するか否かを判別する(ステップS55)。複数種類のラベルのついた隣接画素が存在しないと判別すると(ステップS55:No)、ステップS58にジャンプして画像処理装置25は後述する処理をおこなう。   If it is determined that the pixels other than the background pixels are adjacent to the upper side or the left side (step S54: Yes), the image processing apparatus 25 determines whether there are a plurality of adjacent pixels with different types of labels. A determination is made (step S55). If it is determined that there are no adjacent pixels with a plurality of types of labels (step S55: No), the process jumps to step S58, and the image processing apparatus 25 performs the process described later.

複数種類のラベルの画素が上側又は左側に隣接していると判別すると(ステップS55:Yes)、画像処理装置25は複数種類のラベルのうち最小の番号のものを選択して、対象画素にラベルづけする(ステップS56)。また、画像処理装置25は、これらの検出された複数のラベルが同じ連結成分を示すものであることを、CPU30を介してメモリ23に記憶させ(ステップS57)、後述するステップS59の処理に進む。   If it is determined that the pixels of the plurality of types of labels are adjacent to the upper side or the left side (step S55: Yes), the image processing device 25 selects the label with the smallest number from the plurality of types of labels and labels the target pixel. (Step S56). Further, the image processing device 25 stores in the memory 23 via the CPU 30 that these detected labels indicate the same connected component (step S57), and proceeds to the processing of step S59 described later. .

一方、ステップS54において背景画素以外の画素値を有する画素が上側又は左側に隣接していないと判別すると(ステップS54:No)、画像処理装置25は背景画素以外の画素値を有する画素が下側又は右側に隣接しているか否かを判別する(ステップS58)。隣接していないと判別すると(ステップS58:No)、そのままステップS61にジャンプして後述する処理をおこなう。隣接していると判別すると(ステップS58:Yes)、画像処理装置25は対象画素に新規のラベルづけをおこなった後(ステップS59)、ステップS61に進んで後述する処理をおこなう。   On the other hand, if it is determined in step S54 that a pixel having a pixel value other than the background pixel is not adjacent to the upper side or the left side (step S54: No), the image processing apparatus 25 sets the pixel having a pixel value other than the background pixel to the lower side. Alternatively, it is determined whether or not it is adjacent to the right side (step S58). If it is determined that they are not adjacent to each other (step S58: No), the process jumps to step S61 as it is and performs the processing described later. If it is determined that they are adjacent (step S58: Yes), the image processing apparatus 25 performs new labeling on the target pixel (step S59), and then proceeds to step S61 to perform the process described later.

また、ステップS55において、対象画素の上側又は左側に複数種類のラベルのついた隣接画素が存在しない、すなわち一種類のラベルの隣接画素のみが存在すると判別すると(ステップS55:No)、画像処理装置25はその隣接画素と同じ種類のラベルを対象画素にラベルづけする(ステップS60)。   If it is determined in step S55 that there are no adjacent pixels with a plurality of types of labels on the upper or left side of the target pixel, that is, only adjacent pixels with one type of label exist (step S55: No), the image processing apparatus 25 labels the target pixel with the same type of label as the adjacent pixel (step S60).

画像処理装置25は、一通りの走査が終了したか否か、すなわち画像の左上から右下まで処理を行ったか否かを判別する(ステップS61)。走査が終了していないと判別すると(ステップS61:No)、画像処理装置25は新たなピクセルを対象画素として、現在の画素の右側の画素を選ぶ。対象画素がすでに一番右に位置する場合は、画像処理装置25は、ひとつ下のラインの一番左の画素を選ぶ(ステップS62)。画像処理装置25は、ステップS53に戻って一連の処理を繰り返す。   The image processing device 25 determines whether or not one scan has been completed, that is, whether or not processing has been performed from the upper left to the lower right of the image (step S61). If it is determined that the scanning has not ended (step S61: No), the image processing apparatus 25 selects a pixel on the right side of the current pixel with the new pixel as a target pixel. If the target pixel is already positioned on the rightmost side, the image processing device 25 selects the leftmost pixel on the next lower line (step S62). The image processing apparatus 25 returns to step S53 and repeats a series of processes.

画像処理装置25は再び画像の左上から右下まで走査をおこなって、今度はステップS57においてメモリ23に記憶させた連結成分の画素に対して同一のラベルづけをおこなう(ステップS63)。そして、画像処理装置25は、ラベルづけされた連結成分のうち、最大の面積を持つものを検出する(ステップS64)。   The image processing device 25 scans again from the upper left to the lower right of the image, and this time, the same labeling is performed on the connected component pixels stored in the memory 23 in step S57 (step S63). Then, the image processing apparatus 25 detects the labeled connected component having the largest area (step S64).

ここで検出された最大の面積を有するラベルをLabel_mとする。   The label having the maximum area detected here is defined as Label_m.

画像処理装置25は、走査対象を縮小二値画像に戻し、二値画像で1の画素を探し、その画素に対応するラベル画像の画素のラベルがLabel_mであるかを調べる。Label_mでない場合は、撮影対象でないとして、縮小二値画像のその画素を0に書き換える(ステップS65)。   The image processing device 25 returns the scan target to the reduced binary image, searches for a pixel of 1 in the binary image, and checks whether the label of the pixel of the label image corresponding to the pixel is Label_m. If it is not Label_m, the pixel of the reduced binary image is rewritten to 0, assuming that it is not a shooting target (step S65).

このラベリング処理をさらに具体的に説明する。
図13に示すように、撮影画像の左上からx方向に右端まで走査して画素p1を対象画素とした場合、画素p1は、条件1に該当する。この場合、画像処理装置25は、画素p1に新しいラベルとして、Label_1を付ける。
This labeling process will be described more specifically.
As illustrated in FIG. 13, when the pixel p1 is the target pixel by scanning from the upper left of the captured image to the right end in the x direction, the pixel p1 satisfies the condition 1. In this case, the image processing apparatus 25 attaches Label_1 to the pixel p1 as a new label.

画素p2を対象画素とした場合、画素p2は、条件2に該当する。また、画素p2の左に隣接する画素は、画素p1であり、画素p1のラベルは、Label_1である。この場合、画像処理装置25は、画素p2に画素p1と同じラベルとしてLabel_1を付ける。   When the pixel p2 is the target pixel, the pixel p2 satisfies the condition 2. The pixel adjacent to the left of the pixel p2 is the pixel p1, and the label of the pixel p1 is Label_1. In this case, the image processing apparatus 25 attaches Label_1 to the pixel p2 as the same label as the pixel p1.

次のラインの画素p3を対象画素とした場合、画素p3は、条件1に該当する。この場合、画像処理装置25は、画素p3に新しいラベルとして、Label_2を付ける。   When the pixel p3 in the next line is the target pixel, the pixel p3 satisfies the condition 1. In this case, the image processing device 25 attaches Label_2 as a new label to the pixel p3.

画素p4を対象画素とした場合、画素p4の上に隣接する画素p1のラベルはLabel_1であり、画素p4の左に隣接する画素のラベルはLabel_2である。このため、画素p4は、条件3に該当する。この場合、画像処理装置25は、画素p4には、2種類以上のラベル番号の中で最も小さいラベル番号としてLabel_1を付ける。そして、画像処理装置25は、Label_1が付けられている画素p1と画素p4の左に隣接する画素とは同じ連結成分として、記憶する。   When the pixel p4 is the target pixel, the label of the pixel p1 adjacent to the pixel p4 is Label_1, and the label of the pixel adjacent to the left of the pixel p4 is Label_2. For this reason, the pixel p4 corresponds to the condition 3. In this case, the image processing apparatus 25 attaches Label_1 to the pixel p4 as the smallest label number among two or more types of label numbers. Then, the image processing device 25 stores the pixel p1 to which Label_1 is attached and the pixel adjacent to the left of the pixel p4 as the same connected component.

画素p5を対象画素とした場合、画素p5に隣接する画素は全て背景画素であるため、画素p5は、条件4に該当する。このため、画像処理装置25は、画素p5を孤立点として画素p5には、ラベルを付けないようにする。   When the pixel p5 is the target pixel, the pixels adjacent to the pixel p5 are all background pixels, and therefore the pixel p5 satisfies the condition 4. For this reason, the image processing device 25 does not label the pixel p5 with the pixel p5 as an isolated point.

画像処理装置25は、背景画素ではない各画素を対象として、このような処理を実行し、処理がすべて終了すると、もう一度走査を行なう。再度、走査を行うと、画像処理装置25は、画素p1と画素p4の左に隣接する画素とは同じ連結成分として記憶しているので、画素p4の左に隣接する画素にLabel_1を付けなおす。   The image processing device 25 executes such a process for each pixel that is not a background pixel, and scans again when all the processes are completed. When scanning is performed again, the image processing device 25 stores the pixel p1 and the pixel adjacent to the left of the pixel p4 as the same connected component, and therefore re-labels the pixel adjacent to the left of the pixel p4.

このようにして、この領域の背景画素でない連結成分には、Label_1が付けられる。そして、図10(a)に示す縮小二値化画像の各連結成分には、図14に示すようなLabel_1〜Label_4が付けられる。   In this way, Label_1 is attached to a connected component that is not a background pixel in this region. Then, Label_1 to Label_4 as shown in FIG. 14 are attached to each connected component of the reduced binarized image shown in FIG.

このうち、最大の面積を有する連結成分はLabel_4が付けられている連結成分である。従って、画像処理装置25は、最大の面積を有する連結成分は撮影対象画像のものとして、このラベルがついた画素を保持し、他の画素を、蛍光灯の反射画像等によるものとして、背景画素とする。このようにして、ラベリング処理を用いて、最大連結領域部分の抽出をおこなった図15(a)に示すような縮小二値化画像が取得される。   Among these, the connected component having the largest area is the connected component to which Label_4 is attached. Accordingly, the image processing device 25 holds the pixel with this label, assuming that the connected component having the maximum area is that of the image to be captured, and sets the other pixels as the reflection image of the fluorescent lamp, etc. And In this way, a reduced binarized image as shown in FIG. 15A obtained by extracting the maximum connected region portion using the labeling process is acquired.

画像処理装置25は、このような最大連結領域の抽出をおこなった縮小二値化画像から、Robertsフィルタと呼ばれるエッジ検出用のフィルタを用いて図15(b)に示すようなエッジ画像を生成する(ステップS42)。このRobertsフィルタとは、2つの4近傍画素の重み付けを行って2つのフィルタΔ1、Δ2を取得して平均化することによって、画像のエッジを検出するフィルタである。   The image processing device 25 generates an edge image as shown in FIG. 15B from the reduced binarized image from which the maximum connected area has been extracted, using an edge detection filter called a Roberts filter. (Step S42). The Roberts filter is a filter that detects an edge of an image by weighting two 4-neighboring pixels, obtaining two filters Δ1 and Δ2, and averaging them.

図16(a)は、フィルタΔ1の係数を示し、図16(b)は、フィルタΔ2の係数を示す。この2つのフィルタΔ1,Δ2の係数を、ある着目した座標(x,y)の画素値f(x,y)に適用すると、変換後の画素値g(x,y)は、次の数12によって表される。
FIG. 16A shows the coefficients of the filter Δ1, and FIG. 16B shows the coefficients of the filter Δ2. When the coefficients of the two filters Δ1 and Δ2 are applied to the pixel value f (x, y) of a certain coordinate (x, y), the converted pixel value g (x, y) Represented by

図15(b)に示すエッジ画像には、直線パラメータが含まれている。画像処理装置25は、このエッジ画像から、ラドン変換を行って直線パラメータを検出する(ステップS43の処理)。   The edge image shown in FIG. 15B includes a straight line parameter. The image processing device 25 performs a Radon transform from this edge image to detect a straight line parameter (processing in step S43).

ラドン変換は、n次元のデータを、(n−1)次元の投影データに対応させる積分変換である。具体的には、図17(a),(b)に示すように、画像データをf(x,y)として、x−y座標系から角度θだけ回転したr−θ座標系を考える。θ方向の画像投影データp(r,θ)は、次の数13によって定義される。
The Radon transform is an integral transform that associates n-dimensional data with (n-1) -dimensional projection data. Specifically, as shown in FIGS. 17A and 17B, an r-θ coordinate system rotated by an angle θ from the xy coordinate system with image data f (x, y) is considered. Image projection data p (r, θ) in the θ direction is defined by the following equation (13).

この数13による変換がラドン変換と呼ばれるものである。
図17(a)に示すような画像データf(x,y)は、ラドン変換により、図17(b)に示すような画像投影データp(r,θ)に変換される。
This conversion by Equation 13 is called Radon conversion.
Image data f (x, y) as shown in FIG. 17A is converted into image projection data p (r, θ) as shown in FIG. 17B by Radon transformation.

このようなラドン変換によれば、図18(a)に示すようなx−y座標系の直線Lは、極座標系では、ρ=xcosα+ysinαで表される。この直線Lは、p(ρ,α)の点に全て投影されるので、p(r,θ)のピークを検出することで、直線の検出が可能になる。画像処理装置25は、この原理を用いて、エッジ画像から、ラドン変換によりデータp(r,θ)を生成する。   According to such a Radon transform, a straight line L in the xy coordinate system as shown in FIG. 18A is represented by ρ = x cos α + y sin α in the polar coordinate system. Since this straight line L is entirely projected on the point p (ρ, α), it is possible to detect the straight line by detecting the peak of p (r, θ). Using this principle, the image processing device 25 generates data p (r, θ) from the edge image by Radon transform.

次に、画像処理装置25は、生成したデータp(r,θ)から、そのピーク点を抽出する。このため、画像処理装置25は、図19に示すフローチャートに従って、このピーク点の抽出処理を実行する。   Next, the image processing device 25 extracts the peak point from the generated data p (r, θ). For this reason, the image processing apparatus 25 executes this peak point extraction processing according to the flowchart shown in FIG.

画像処理装置25は、P(r,θ)での最大値pmaxを探す(ステップS71)。
画像処理装置25は、閾値pth = pmax * k(kは0以上1までの定数値)を求める(ステップS72)。
The image processing device 25 searches for the maximum value pmax at P (r, θ) (step S71).
The image processing device 25 calculates a threshold value pth = pmax * k (k is a constant value between 0 and 1) (step S72).

画像処理装置25は、pthを閾値にしてP(r,θ)から二値画像B(r,θ)を生成する(ステップS73)。
画像処理装置25は、B(r,θ)の画像ラベリングを行う。このとき得られたラベル数をN1とする(ステップS74)。
The image processing device 25 generates a binary image B (r, θ) from P (r, θ) using pth as a threshold (step S73).
The image processing device 25 performs image labeling of B (r, θ). The number of labels obtained at this time is set to N1 (step S74).

画像処理装置25は、各ラベル領域内でP(r,θ)が最大値のところのr,θを調べる。そして、画像処理装置25は、この値を、それぞれri,θi (i=1〜Nl)として取得する(ステップS75)。これが直線のパラメータとなる。   The image processing device 25 examines r and θ where P (r, θ) has the maximum value in each label area. The image processing device 25 acquires these values as ri, θi (i = 1 to Nl), respectively (step S75). This is a straight line parameter.

次に、画像処理装置25は、検出した直線パラメータを用いて四角形候補を生成する場合(図9のステップS45の処理)、図20(a)に示すように、4本の直線が四角形を形成すれば、例えば、対向する直線a1,a3は、対向する直線a1,a3以外の2本の直線a2,a4と、それぞれ、交点p1,p4,p2,p3を有することになる。この場合、CPU30は、四角形を抽出できたと判定する(図8のステップS33においてYes)。   Next, when the image processing apparatus 25 generates a quadrangle candidate using the detected straight line parameter (the process of step S45 in FIG. 9), as shown in FIG. 20A, the four straight lines form a quadrangle. In this case, for example, the opposing straight lines a1 and a3 have two straight lines a2 and a4 other than the opposing straight lines a1 and a3 and intersections p1, p4, p2, and p3, respectively. In this case, the CPU 30 determines that the quadrangle has been extracted (Yes in step S33 in FIG. 8).

一方、図20(b),(c)に示すように、4つの交点がなければ、CPU30は、四角形を抽出できなかったと判定する(ステップS33においてNo)。   On the other hand, as shown in FIGS. 20B and 20C, if there are no four intersections, the CPU 30 determines that the quadrangle could not be extracted (No in step S33).

次に、画像処理装置25は、抽出した四角形の候補の中から、撮影対象の辺を表すものとして、最もふさわしい四角形を選択する。
この方法はいくつか考えられ、本実施形態では、撮影された四角形のうち、最外郭の四角形を選ぶものとする。最外郭の四角形とは、図6に示すように候補となる四角形をX,Y軸の平行線で囲んで長方形を形成し、そのうち、面積が最も大きいものをいう。
Next, the image processing device 25 selects the most suitable rectangle as the one representing the side to be imaged from the extracted rectangle candidates.
Several methods are conceivable. In the present embodiment, the outermost quadrangle is selected from the captured quadrangles. As shown in FIG. 6, the outermost quadrangle is a rectangle that is formed by surrounding a candidate quadrangle with parallel lines of the X and Y axes, and has the largest area.

長方形Riの4つの頂点の座標を、それぞれ、(x0,y0),(x1,y1),(x2,y2),(x3,y3)とすると、四角形の外郭面積Siは、次の数14によって表される。
If the coordinates of the four vertices of the rectangle Ri are (x0, y0), (x1, y1), (x2, y2), and (x3, y3), the outline area Si of the quadrangle is given by expressed.

画像処理装置25は、図21に示すフローチャートに従って、この四角形を選択する。
画像処理装置25は、候補数Nrの四角形のうちから、いずれかの四角形を選択する(ステップS81)。
画像処理装置25は、選択した四角形の面積Siを、数14に従って求める(ステップS82)。
The image processing device 25 selects this rectangle according to the flowchart shown in FIG.
The image processing device 25 selects one of the candidate number Nr of rectangles (step S81).
The image processing device 25 obtains the area Si of the selected square according to Equation 14 (step S82).

画像処理装置25は、候補数Nrをデクリメントする(ステップS83)。
画像処理装置25は、候補数Nrが0になったか否かを判定する(ステップS84)。
候補数Nrが0にはなっていないと判定した場合(ステップS84においてNo)、画像処理装置25は、ステップS81〜S83の処理を、再度、実行する。
The image processing device 25 decrements the number of candidates Nr (step S83).
The image processing apparatus 25 determines whether the number of candidates Nr has become 0 (step S84).
When it is determined that the number of candidates Nr is not 0 (No in step S84), the image processing device 25 executes the processes in steps S81 to S83 again.

このような処理を繰り返し行うことによって、候補数Nrが0になったと判定した場合(ステップS84においてYes)、画像処理装置25は、求めた面積Siの大きい順に、候補となる四角形のデータを並べ替える(ステップS85)。   When it is determined that the number of candidates Nr has become 0 by repeating such processing (Yes in step S84), the image processing device 25 arranges the candidate quadrilateral data in descending order of the obtained area Si. Change (step S85).

そして、画像処理装置25は、一番目の四角形を最優先の四角形の輪郭とする。このように複数の四角形の候補があっても常に最大外郭の四角形が優先的に選択される。このように最大外郭の四角形を優先的に選択するのは、通常、意識的に撮影対象が撮影画角内の最大になるように、ズーム調整や撮影位置の調整が行われ、最大外郭の四角形が撮影対象の輪郭と考えられるからである。   Then, the image processing apparatus 25 sets the first quadrangle as the highest priority quadrilateral outline. Thus, even if there are a plurality of quadrangle candidates, the quadrilateral with the maximum outline is always preferentially selected. In this way, the maximum outline rectangle is preferentially selected. Normally, zoom adjustment and adjustment of the shooting position are performed so that the subject is maximally within the shooting angle of view, and the maximum outline rectangle is selected. This is because the contour of the subject is considered.

従って、概ね、撮影対象の輪郭が自動的に抽出されることが期待される。また、誤って四角形が抽出されたとしても、ユーザは、一般には、最大外郭の四角形から順次、確認することになる。このため、撮影対象の輪郭を示す直線が抽出されていれば、真の撮影対象の四角形は、NOキーを順次押下することによって選択されることになる。   Therefore, in general, it is expected that the contour of the photographing target is automatically extracted. In addition, even if a quadrangle is extracted by mistake, the user generally confirms sequentially from the quadrangle of the maximum outline. For this reason, if a straight line indicating the outline of the imaging target has been extracted, the true imaging target rectangle is selected by sequentially pressing the NO key.

このようにして、選択された撮影対象の四角形の4点の頂点の座標(x0,y0),(x1,y1),(x2,y2),(x3,y3)を用いて、数5,数8に従って、数8に示す行列内の各要素であるアフィンパラメータを求めることができる。   In this way, using the coordinates (x0, y0), (x1, y1), (x2, y2), (x3, y3) of the four points of the selected quadrangle to be imaged, According to 8, affine parameters that are each element in the matrix shown in Equation 8 can be obtained.

(1)撮影対象画像からのアフィンパラメータ抽出
このような考え方に基づいて、画像処理装置25は、四角形の頂点からアフィンパラメータを取得する。この処理を、図22に示すフローチャートに基づいて説明する。
(1) Extraction of Affine Parameter from Image to be Captured Based on such a concept, the image processing device 25 acquires an affine parameter from a rectangular vertex. This process will be described based on the flowchart shown in FIG.

画像処理装置25は、四角形の4点の頂点座標(x0,y0),(x1,y1),(x2,y2),(x3,y3)から、数5に従って、射影係数α、βを算出する(ステップS91)。   The image processing device 25 calculates projection coefficients α and β according to Equation 5 from the vertex coordinates (x0, y0), (x1, y1), (x2, y2), and (x3, y3) of the four points of the rectangle. (Step S91).

画像処理装置25は、数10に従って撮影対象の縦横比kを算出する(ステップS92)。
画像処理装置25は、画像の中心点(uc,vc)を指定する(ステップS93)。
画像処理装置25は、最大画像サイズvmax/umaxと数10で表される縦横比kとを比較する(ステップS94)。
The image processing device 25 calculates the aspect ratio k of the subject to be photographed according to Equation 10 (step S92).
The image processing device 25 designates the center point (uc, vc) of the image (step S93).
The image processing device 25 compares the maximum image size vmax / umax with the aspect ratio k expressed by Equation 10 (step S94).

vmax/umax≦kの場合(ステップS94においてNo)、縦横比kを変えないものとして、画像処理装置25は、U軸側(横)の最大画像サイズumaxの方が撮影対象の画像サイズよりも大きいと判定する。そして、画像処理装置25は、V軸側の最大画像サイズと撮影対象の画像サイズとが一致するように、数11の条件(1)に従って、m,nの値を求める(ステップS95)。   When vmax / umax ≦ k (No in step S94), assuming that the aspect ratio k is not changed, the image processing apparatus 25 determines that the maximum image size umax on the U-axis side (horizontal) is larger than the image size to be captured. Judged to be large. Then, the image processing device 25 obtains the values of m and n in accordance with the condition (1) of Formula 11 so that the maximum image size on the V-axis side matches the image size of the subject (Step S95).

vmax/umax>kの場合(ステップS94においてYes)、縦横比kを変えないものとして、画像処理装置25は、V軸側(縦)の最大画像サイズvmaxの方が撮影対象の画像サイズよりも大きいと判定する。そして、画像処理装置25は、U軸側の最大画像サイズと撮影対象の画像サイズとが一致するように、数11の条件(2)に従ってm,nの値を求める(ステップS96)。   When vmax / umax> k (Yes in step S94), assuming that the aspect ratio k is not changed, the image processing apparatus 25 determines that the maximum image size vmax on the V-axis side (vertical) is larger than the image size to be captured. Judged to be large. Then, the image processing device 25 obtains the values of m and n according to the condition (2) of Equation 11 so that the maximum image size on the U-axis side matches the image size of the imaging target (step S96).

画像処理装置25は、算出したm、nと四角形の4点の頂点座標(x0,y0),(x1,y1),(x2,y2),(x3,y3)から、数8に従って、アフィン変換行列Afを求める(ステップS97)。
画像処理装置25は、このアフィン変換行列Afの各要素をアフィンパラメータAとして、このアフィンパラメータAを取得する(ステップS98)。
The image processing device 25 calculates the affine transformation from the calculated vertex coordinates (x0, y0), (x1, y1), (x2, y2), (x3, y3) of the four points of the quadrangle according to Equation 8 A matrix Af is obtained (step S97).
The image processing apparatus 25 acquires the affine parameter A using each element of the affine transformation matrix Af as the affine parameter A (step S98).

尚、四角形が認識できないような場合(図8のステップS33においてNo)のように、画像撮影条件等が不適であり、射影パラメータが得られない場合がある。このような場合、図23(a)に示すような警告文を、液晶モニタ12に表示させ、撮影者に領域が検出できなかったことを適切に警告し、撮影者に、図23(b)に示すようなカメラ撮影設定モードにして撮影条件を変更させ、再度撮影を促すようにしたほうが好ましい。さらに再度、撮影条件を変えるように警告をした方が好ましい場合がある。   Note that, as in the case where the quadrangle cannot be recognized (No in step S33 in FIG. 8), the image capturing condition or the like is inappropriate, and the projection parameter may not be obtained. In such a case, a warning message as shown in FIG. 23A is displayed on the liquid crystal monitor 12 to appropriately warn the photographer that the area could not be detected, and to the photographer, FIG. It is preferable to change the shooting conditions to the camera shooting setting mode as shown in FIG. Furthermore, it may be preferable to warn again to change the shooting conditions.

CPU30は、このように適正な射影パラメータが得られなかった場合、図24に示すフローチャートに従って、警告処理を行う(図5のステップS27)。   When the proper projection parameter cannot be obtained as described above, the CPU 30 performs a warning process according to the flowchart shown in FIG. 24 (step S27 in FIG. 5).

CPU30は、表示装置24を制御して、図23(a)に示すような警告文を液晶モニタ12に表示させる(ステップS101)。   The CPU 30 controls the display device 24 to display a warning text as shown in FIG. 23A on the liquid crystal monitor 12 (step S101).

CPU30は、YESキー、NOキーのいずれが押下されたかを、操作部26から送信された操作情報に基づいて判定する(ステップS102)。   The CPU 30 determines which of the YES key and the NO key has been pressed based on the operation information transmitted from the operation unit 26 (step S102).

NOキーが押下されたと判定した場合(ステップS102においてNo)、CPU30は、この警告処理を終了させる。   If it is determined that the NO key has been pressed (No in step S102), the CPU 30 ends the warning process.

一方、YESキーが押下されたと判定した場合(ステップS102においてYes)、CPU30は、撮影モードに切り替えて(ステップS103)、この警告処理を終了させる。   On the other hand, if it is determined that the YES key has been pressed (Yes in step S102), the CPU 30 switches to the shooting mode (step S103) and ends this warning process.

(2)抽出したアフィンパラメータによる画像変換
次に、得られたアフィンパラメータを用いて補正画像を作成する画像処理方法について説明する。
まず、アフィンパラメータを用いて射影変換や他のアフィン変換を行なう場合、図25に示すように、元の画像の点p(x,y)が、変換行列Apによる射影変換等によって変換(後)画像の点P(u,v)に対応するものとする。この場合、元の画像の点pに対応する変換画像の点Pを求めるよりは、変換画像の点P(u,v)に対応する元の画像の点p(x,y)を求めたほうが好ましい。
(2) Image Conversion Using Extracted Affine Parameters Next, an image processing method for creating a corrected image using the obtained affine parameters will be described.
First, when projective transformation or other affine transformation is performed using affine parameters, as shown in FIG. 25, the point p (x, y) of the original image is transformed by projective transformation using the transformation matrix Ap (after). Assume that it corresponds to the point P (u, v) of the image. In this case, it is better to obtain the point p (x, y) of the original image corresponding to the point P (u, v) of the converted image than to obtain the point P of the converted image corresponding to the point p of the original image. preferable.

尚、変換画像の点Pの座標を求める際、バイリニア法による補間方法を用いるものとする。バイリニア法による補間方法は、一方の画像(元の画像)の座標点と対応する他方の画像(変換画像)の座標点を探し出して、一方の画像の座標点の周辺4点の(画素)値から変換画像の点P(u,v)の(画素)値を求める方法である。この方法によれば、変換画像の点Pの画素値Pは、次の数15に従って算出される。
Note that when obtaining the coordinates of the point P of the converted image, an interpolation method based on the bilinear method is used. In the bilinear interpolation method, the coordinate point of the other image (transformed image) corresponding to the coordinate point of one image (original image) is searched, and the (pixel) values of four points around the coordinate point of the one image are found. Is a method for obtaining a (pixel) value of a point P (u, v) of the converted image. According to this method, the pixel value P of the point P of the converted image is calculated according to the following Expression 15.

変換画像の点P(u,v)に対応する元の画像の点p(x,y)を求めるため、画像処理装置25は、図26に示すフローチャートの処理を実行する。
画像処理装置25は、変換画像の画素位置uを0に初期化する(ステップS111)。
In order to obtain the point p (x, y) of the original image corresponding to the point P (u, v) of the converted image, the image processing device 25 executes the process of the flowchart shown in FIG.
The image processing device 25 initializes the pixel position u of the converted image to 0 (step S111).

画像処理装置25は、変換画像の画素位置vを0に初期化する(ステップS112)。
画像処理装置25は、数5及び数8で得られたアフィンパラメータAを用いて変換画像の画素位置(u,v)を代入し、数2に従って、元の画像の画素位置(x,y)を求める(ステップS113)。
The image processing device 25 initializes the pixel position v of the converted image to 0 (step S112).
The image processing device 25 substitutes the pixel position (u, v) of the converted image using the affine parameter A obtained by Equations 5 and 8, and according to Equation 2, the pixel position (x, y) of the original image Is obtained (step S113).

画像処理装置25は、求めた画素位置(x,y)から、数15に従って、バイリニア法により画素値P(u,v)を求める(ステップS114)。
画像処理装置25は、補正後画像の座標vを1つだけインクリメントする(ステップS115)。
The image processing device 25 obtains the pixel value P (u, v) from the obtained pixel position (x, y) according to the formula 15 by the bilinear method (step S114).
The image processing device 25 increments the coordinate v of the corrected image by one (step S115).

画像処理装置25は、補正後画像の座標vと座標vの最大値vmaxとを比較して、補正後画像の座標vが最大値vmax以上になったか否かを判定する(ステップS116)。   The image processing device 25 compares the coordinate v of the corrected image with the maximum value vmax of the coordinate v, and determines whether or not the coordinate v of the corrected image is greater than or equal to the maximum value vmax (step S116).

座標vが最大値vmax未満であると判定した場合(ステップS116においてNo)、画像処理装置25は、ステップS113〜S115を再度実行する。   When it is determined that the coordinate v is less than the maximum value vmax (No in step S116), the image processing device 25 executes steps S113 to S115 again.

ステップS113〜S115の処理を繰り返すことにより、座標vが最大値vmaxに達したと判定した場合(ステップS116においてYes)、画像処理装置25は、補正後画像の座標uを1つだけインクリメントする(ステップS117)。   When it is determined that the coordinate v has reached the maximum value vmax by repeating the processes in steps S113 to S115 (Yes in step S116), the image processing device 25 increments the coordinate u of the corrected image by one ( Step S117).

画像処理装置25は、座標uと座標uの最大値umaxとを比較し、座標uが最大値umax以上になったか否かを判定する(ステップS118)。
座標uが最大値umax未満であると判定した場合(ステップS118においてNo)、画像処理装置25は、再度、ステップS112〜S117の処理を実行する。
The image processing device 25 compares the coordinate u with the maximum value umax of the coordinate u, and determines whether or not the coordinate u is equal to or greater than the maximum value umax (step S118).
When it is determined that the coordinate u is less than the maximum value umax (No in step S118), the image processing device 25 executes the processes of steps S112 to S117 again.

ステップ112〜S117の処理を繰り返すことにより、座標uが最大値umaxに達したと判定した場合(ステップ118においてYes)、画像処理装置25は、この画像変換処理を終了させる。   When it is determined that the coordinate u has reached the maximum value umax by repeating the processing of steps 112 to S117 (Yes in step 118), the image processing device 25 ends the image conversion processing.

(3)画像変換の調整
次に、一度画像変換を行った画像に対して行われる調整(図5のステップS22)について説明する。
抽出された四角形の頂点の座標に若干の誤差等が含まれているような場合、図27(a)に示すように、得られたアフィンパラメータで射影した結果が好ましくない場合がある。このため、本実施形態のデジタルカメラ1は、一度画像変換した画像に対して調整を行い、図27(b)に示すような画像を得るために、ユーザによって射影変換の調整を行えるように構成されている。
(3) Image Conversion Adjustment Next, adjustment (step S22 in FIG. 5) performed on an image that has been once converted will be described.
If the extracted quadrangular vertex coordinates include some errors and the like, the result of projection with the obtained affine parameters may be undesirable as shown in FIG. For this reason, the digital camera 1 according to the present embodiment is configured so that the user can adjust the projective transformation in order to adjust the image once converted and obtain an image as shown in FIG. Has been.

ユーザが操作部26の射影変換キー、回転補正キーを操作すると、操作部26は、ユーザの操作に応答して、この操作情報をCPU30に送信する。CPU30は、この操作情報を判別し、判別結果に従って画像処理装置25を制御する。   When the user operates the projection conversion key and the rotation correction key of the operation unit 26, the operation unit 26 transmits this operation information to the CPU 30 in response to the user's operation. The CPU 30 determines this operation information and controls the image processing device 25 according to the determination result.

尚、図28に示すように、補正画像の補間画素Q(u',v')を求める際に、補間画素Q(u',v')に対して逆変換Aiを行って、補間画素Q(u',v')に対応する補正画像P(u,v)を求め、さらに補正画像P(u,v)に対して逆変換を行って、元の画像のp(x,y)を求め、画像p(x,y)に対して画素補間を行う。また、射影変換と拡大変換等、画像変換を2段変換する場合は、2つの変換を合成した変換行列を求めておいて、元の画像に対して変換を一度で行う。この方が、変換を2回行うより画像を高速に求めることができ、かつ、画像の劣化は少なくてすむ。   As shown in FIG. 28, when the interpolation pixel Q (u ′, v ′) of the corrected image is obtained, the inverse transformation Ai is performed on the interpolation pixel Q (u ′, v ′) to obtain the interpolation pixel Q. A corrected image P (u, v) corresponding to (u ′, v ′) is obtained, and further the inverse transformation is performed on the corrected image P (u, v) to obtain p (x, y) of the original image. Then, pixel interpolation is performed on the image p (x, y). Further, when performing two-stage image conversion such as projective conversion and enlargement conversion, a conversion matrix obtained by combining the two conversions is obtained, and the original image is converted at a time. In this case, an image can be obtained at a higher speed than when conversion is performed twice, and image deterioration can be reduced.

変換前の画像を、X軸,Y軸を中心に角度θだけ回転して得られた変換後の画像から、変換前の画像を取得する場合の回転逆変換行列Arは、次の数16によって表される。
変換前の画像を、X軸,Y軸を中心にしてSc倍拡大して得られた変換後の画像から、変換前の画像を取得する場合の拡大行列Ascは、次の数17によって表される。
The rotation inverse transformation matrix Ar for obtaining the image before conversion from the image after conversion obtained by rotating the image before conversion by the angle θ about the X axis and the Y axis is expressed by the following equation (16). expressed.
An enlargement matrix Asc in the case of obtaining an image before conversion from an image after conversion obtained by enlarging the image before conversion by Sc magnification around the X axis and the Y axis is expressed by the following Expression 17. The

尚、一度、画像を拡大すると、アフィンパラメータの調整や計算で丸め誤差の処理等が行われる場合がある。このため、画像を拡大する場合、その前に元の等倍のアフィンパラメータに復帰させるようにしておく必要がある。   Note that once an image is enlarged, a rounding error may be processed by adjusting or calculating an affine parameter. For this reason, before enlarging the image, it is necessary to restore the original affine parameters at the same magnification.

変換前の画像をX,Y方向に、それぞれ、Tx,Tyだけ移動させることによって得られた変換後の画像から、変換前の画像を取得する場合の移動行列Asは、次の数18によって表される。
The movement matrix As for obtaining the image before conversion from the image after conversion obtained by moving the image before conversion in the X and Y directions by Tx and Ty, respectively, is expressed by the following equation (18). Is done.

補正前の画像をX,Y方向に、それぞれ、α,βだけ傾斜することによって得られた変換後の画像から、変換前の画像を取得する場合の射影効果行列Apは、次の数19によって表される。
そして、2段の逆変換を実行する場合、その逆変換行列Aは、次の数20によって表される。
The projection effect matrix Ap in the case of acquiring the image before conversion from the image after conversion obtained by inclining the image before correction in the X and Y directions by α and β, respectively, is given by expressed.
When performing two-stage inverse transformation, the inverse transformation matrix A is expressed by the following equation (20).

尚、本実施形態では、射影効果パラメータα、βは0.1刻み、角度補正パラメータθは1度刻みに設定するものとする。但し、実際の補正の効果を確かめながら各パラメータの調整幅を決定することができる。   In this embodiment, the projection effect parameters α and β are set in increments of 0.1, and the angle correction parameter θ is set in increments of 1 degree. However, the adjustment range of each parameter can be determined while checking the actual correction effect.

このような考え方に基づいて実行される画像変換の調整処理を、図29に示すフローチャートに基づいて説明する。
CPU30は、画像の中心座標Xc,Ycを設定する(ステップS121)。
CPU30は、操作部26から送信された操作情報に基づいて射影補正キーが押下されたか否かを判定する(ステップ122)。
射影変換キーが押下されたと判定した場合(ステップS122においてYes)、CPU30は、射影変換キーとして、上縮小キー111、下縮小キー112、右縮小キー113、左縮小キー114のうちの押下されたキーの種別を判別する(ステップS123〜S126)。
The image conversion adjustment process executed based on this concept will be described based on the flowchart shown in FIG.
The CPU 30 sets the center coordinates Xc and Yc of the image (step S121).
The CPU 30 determines whether or not the projection correction key has been pressed based on the operation information transmitted from the operation unit 26 (step 122).
If it is determined that the projection conversion key has been pressed (Yes in step S122), the CPU 30 has pressed one of the upper reduction key 111, the lower reduction key 112, the right reduction key 113, and the left reduction key 114 as the projection conversion key. The key type is determined (steps S123 to S126).

押下された射影変換キーが上縮小キー111であると判別した場合、CPU30は、数19に示す射影効果行列Apに、α=0.1、β=0をそれぞれ代入して、逆変換行列Ai=Apを取得する(ステップS123)。   When determining that the pressed projective transformation key is the up-reduction key 111, the CPU 30 assigns α = 0.1 and β = 0 to the projective effect matrix Ap shown in Equation 19 to obtain an inverse transformation matrix Ai = Ap. Is acquired (step S123).

押下された射影変換キーが下縮小キー112であると判別した場合、CPU30は、数19に示す射影効果行列Apに、α=-0.1,β=0をそれぞれ代入して、逆変換行列Ai=Apを取得する(ステップS124)。   If it is determined that the pressed projective transformation key is the lower reduction key 112, the CPU 30 assigns α = −0.1 and β = 0 to the projective effect matrix Ap shown in Equation 19 to obtain an inverse transformation matrix Ai = Ap is acquired (step S124).

押下された射影変換キーが右縮小キー113であると判別した場合、CPU30は、数19に示す射影効果行列Apに、α=0,β=0.1をそれぞれ代入して、逆変換行列Ai=Apを取得する(ステップS125)。   If it is determined that the pressed projective transformation key is the right reduction key 113, the CPU 30 substitutes α = 0 and β = 0.1 for the projection effect matrix Ap shown in Equation 19 to obtain an inverse transformation matrix Ai = Ap. Is acquired (step S125).

押下された射影変換キーが左縮小キー114であると判別した場合、CPU30は、数19に示す射影効果行列Apに、α=0,β=-0.1をそれぞれ代入して、逆変換行列Ai=Apを取得する(ステップS126)。   When determining that the pressed projective transformation key is the left reduction key 114, the CPU 30 assigns α = 0 and β = −0.1 to the projective effect matrix Ap shown in Equation 19, respectively, and the inverse transformation matrix Ai = Ap is acquired (step S126).

射影変換キーは押下されなかったと判定した場合(ステップ122においてNo)、CPU30は、回転補正キーが押下されたか否かを判定する(ステップS127)。
回転補正キーが押下されたと判定した場合(ステップS127においてYes)、CPU30は、押下された回転補正キーの種別を判別する(ステップS128、S129)。
When it is determined that the projection conversion key has not been pressed (No in Step 122), the CPU 30 determines whether or not the rotation correction key has been pressed (Step S127).
If it is determined that the rotation correction key has been pressed (Yes in step S127), the CPU 30 determines the type of the rotation correction key that has been pressed (steps S128, S129).

押下された回転補正キーが右回転キー115であると判別した場合、CPU30は、数16に示す回転逆変換行列Arに、θ=−1を代入して、逆変換行列A=Arを取得する(ステップ128)。   When determining that the pressed rotation correction key is the right rotation key 115, the CPU 30 substitutes θ = −1 into the rotation inverse transformation matrix Ar shown in Expression 16 to obtain the inverse transformation matrix A = Ar. (Step 128).

押下された回転補正キーが左回転キー116であると判別した場合、CPU30は、数16に示す回転逆変換行列Arに、θ=1を代入して、逆変換行列Ai=Arを取得する(ステップ129)。   If it is determined that the pressed rotation correction key is the left rotation key 116, the CPU 30 substitutes θ = 1 for the rotation inverse transformation matrix Ar shown in Equation 16 to obtain the inverse transformation matrix Ai = Ar ( Step 129).

また、射影変換キー又は回転補正キーが押下されたと判定して、逆変換行列Aiを設定した場合(ステップS123〜S126,S128,S129)、CPU30は、数20に従って、逆変換行列Aを求める(ステップS130)。   Further, when it is determined that the projective transformation key or the rotation correction key has been pressed and the inverse transformation matrix Ai is set (steps S123 to S126, S128, S129), the CPU 30 obtains the inverse transformation matrix A according to Equation 20 ( Step S130).

CPU30は、求めた変換行列Aを画像処理装置25に供給し、逆変換行列Aに基づいて画像変換を行うように画像処理装置25を制御する。画像処理装置25は、供給された逆変換行列Aに基づいて、アフィン変換による画像変換を行い(ステップS131)、この画像変換の調整処理を終了させる。
一方、回転補正キーが押下されていないと判定した場合(ステップS127においてNo)、CPU30は、そのまま、この画像変換の調整処理を終了させる。
The CPU 30 supplies the obtained conversion matrix A to the image processing device 25, and controls the image processing device 25 to perform image conversion based on the inverse conversion matrix A. The image processing device 25 performs image conversion by affine transformation based on the supplied inverse transformation matrix A (step S131), and ends this image transformation adjustment processing.
On the other hand, if it is determined that the rotation correction key has not been pressed (No in step S127), the CPU 30 ends the adjustment processing of the image conversion as it is.

このようにして得られたアフィンパラメータを用いて、前述した方法にて画像変換を行うことにより、補正画像に対して、さらに画像をマニュアル調整することもできる。   By performing image conversion by the above-described method using the affine parameters obtained in this manner, the image can be further manually adjusted with respect to the corrected image.

例えば、図27に示すような画像を調整する場合、画像が左方向に歪んでいるので、まず右回転キー115を押下すると、画像処理装置25は、画像を右回転させる。このまま、右回転キー115が押下されて、文字列が正しく表示されたときに右回転キー115の押下が停止すると、画像処理装置25は、画像の右回転を停止させる。   For example, when adjusting an image as shown in FIG. 27, since the image is distorted leftward, first, when the right rotation key 115 is pressed, the image processing device 25 rotates the image to the right. If the right rotation key 115 is pressed as it is and the character string is correctly displayed and the right rotation key 115 stops being pressed, the image processing device 25 stops the right rotation of the image.

次に画像の左側が右側に比較して大きいので左縮小キー114が押下されると、画像処理装置25は、画像の左右を調整する。このまま、左縮小キー114が押下されて左右のバランスが揃ったときに左縮小キー114の押下が停止すると、画像処理装置25は、左縮小処理を停止させる。   Next, since the left side of the image is larger than the right side, when the left reduction key 114 is pressed, the image processing device 25 adjusts the left and right sides of the image. If the left reduction key 114 is pressed and the left and right balances are aligned and the pressing of the left reduction key 114 stops, the image processing device 25 stops the left reduction process.

この方法は、元画像に対して一度だけの画像変換だけで、画像を得ることができるので、一度射影補正をおこなった画像に対して再度、回転、射影変換するより画質の良い画像を得ることができる。   In this method, an image can be obtained by performing only one image conversion on the original image, so that an image with better image quality than rotating and projecting the image once subjected to projection correction can be obtained. Can do.

(3)輝度あるいは色差等に関する画像効果補正用パラメータの抽出及び画像効果処理
次に、このように得られた画像から、画像効果補正用パラメータを抽出する処理と、このパラメータを用いて行う画像効果処理と、について説明する。画像効果処理は、より鮮明な画像を得るための処理である。
(3) Extraction of image effect correction parameters relating to luminance or color difference and image effect processing Next, processing for extracting image effect correction parameters from the image thus obtained, and image effects performed using these parameters Processing will be described. The image effect process is a process for obtaining a clearer image.

このようにして得られた画像は、結果として白板2や書類などを切り出した画像である。ヒストグラム補正などの画像効果を行なう場合、元の画像から補正パラメータを求めて補正を行うより、切り出す画像からパラメータを求めた方が、より有効なパラメータの取得が期待される。   The image thus obtained is an image obtained by cutting out the white board 2 or the document as a result. When performing image effects such as histogram correction, more effective parameters are expected to be obtained by obtaining parameters from the cut out image than by obtaining correction parameters from the original image and performing correction.

本実施形態では、補正画像データから輝度(Y)からヒストグラムを作成し、そのヒストグラムに応じて画像効果処理を行うものとする。   In the present embodiment, a histogram is created from luminance (Y) from the corrected image data, and image effect processing is performed according to the histogram.

尚、画像効果補正用パラメータは、輝度ヒストグラムの最大値、最小値、ピーク値といった画像効果処理に必要な変数である。   The image effect correction parameters are variables necessary for image effect processing such as the maximum value, minimum value, and peak value of the luminance histogram.

画像効果補正用パラメータを抽出するには、輝度のヒストグラムを生成する必要がある。まず、画像効果補正用パラメータの抽出に必要な処理について説明する。   In order to extract the image effect correction parameter, it is necessary to generate a luminance histogram. First, processing necessary for extracting image effect correction parameters will be described.

輝度ヒストグラムは、画像に存在する輝度値(Y)の分布を示すものであり、輝度値毎に画素の数を計数することにより生成される。図30に輝度ヒストグラムの一例を示す。図30において、横軸は、輝度値(Y)を示し、縦軸は、画素数を示す。画像効果を補正するには、画像効果補正用パラメータとして、最大値(Ymax)、最小値(Ymin)、ピーク値(Ypeak)を求める必要がある。   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. 30 shows an example of a luminance histogram. In FIG. 30, 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 necessary to obtain a maximum value (Ymax), a minimum value (Ymin), and a peak value (Ypeak) as image effect correction parameters.

最大値は、輝度値毎に画素の数を計数し、予め設定された所定数以上の計数値を有する輝度値のうちの最大輝度を示す値であり、最小値は、設定された所定数以上の計数値を有する輝度値のうちの最小輝度を示す値である。ピーク値は、計数値が最大となる輝度値である。ピーク値は、撮影対象の背景色の輝度値を示すものと考えられる。   The maximum value counts the number of pixels for each luminance value, and is a value indicating the maximum luminance among luminance values having a predetermined number or more set in advance, and the minimum value is a predetermined number or more This is a value indicating the minimum luminance among the luminance values having the counted value. The peak value is a luminance value that maximizes the count value. The peak value is considered to indicate the luminance value of the background color to be photographed.

尚、画像効果を補正して視認性に優れた画像を得るには、撮影対象の背景色によって補正効果が異なってくるため、画像効果の補正方法を撮影対象の背景色によって変える必要がある。このため、撮影対象の背景色の判別が必要になってくる。撮影対象の背景色は、輝度ヒストグラム、色差ヒストグラムの各ピーク値から判別される。   Note that in order to obtain an image with excellent visibility by correcting the image effect, the correction effect differs depending on the background color of the shooting target. Therefore, it is necessary to change the correction method of the image effect depending on the background color of the shooting target. For this reason, it is necessary to determine the background color of the shooting target. The background color to be photographed is determined from the peak values of the luminance histogram and the color difference histogram.

ここで、撮影対象の背景色を、3つに分類するものとする。第1は、ホワイトボード、ノート等のように背景色が白の場合である。第2は、黒板等のように背景色が黒の場合である。第3は、雑誌、パンフレットのように背景色が白又は黒以外の場合である。   Here, the background color to be photographed is classified into three. The first is a case where the background color is white, such as a whiteboard or notebook. The second is a case where the background color is black, such as a blackboard. The third is a case where the background color is other than white or black, such as a magazine or a pamphlet.

具体的に、撮影対象の背景色は、以下の判別式に従って判別される。
(2−a)白の判定条件
白判定条件は、次の数21によって表され、数21に示す条件を満足したときに、撮影対象の背景色は白(W)と判定される。
(2−b)黒の判定条件
黒判定条件は、次の数22によって表され、数22に示す条件を満足したときに、撮影対象の背景色は黒(b)と判定される。
Specifically, the background color of the shooting target is determined according to the following discriminant.
(2-a) White Determination Condition The white determination condition is expressed by the following Expression 21, and when the condition shown in Expression 21 is satisfied, the background color of the shooting target is determined to be white (W).
(2-b) Black Determination Condition The black determination condition is expressed by the following Expression 22, and when the condition shown in Expression 22 is satisfied, the background color of the shooting target is determined to be black (b).

また、数21,22に示す条件を満足しなかった場合、撮影対象の背景色はカラー(C)と判定される。尚、カラー閾値は、例えば、50及び128に、白判定閾値は、例えば、128に、黒判定閾値は、例えば、50に設定される。   If the conditions shown in Equations 21 and 22 are not satisfied, the background color to be imaged is determined to be color (C). For example, the color threshold is set to 50 and 128, the white determination threshold is set to 128, and the black determination threshold is set to 50, for example.

このような考え方に基づいて、画像処理装置25は、図31に示すフローチャートに従って画像効果補正用パラメータの抽出処理を実行する。
画像処理装置25は、各輝度(Y)値を有する画素の数を計数して、図30に示すような輝度ヒストグラムを生成する(ステップS141)。
Based on such an idea, the image processing device 25 executes image effect correction parameter extraction processing according to the flowchart shown in FIG.
The image processing device 25 counts the number of pixels having each luminance (Y) value, and generates a luminance histogram as shown in FIG. 30 (step S141).

画像処理装置25は、生成した輝度ヒストグラムから、輝度の最大値(Ymax)、最小値(Ymin)、ピーク値(Ypeak)を取得する(ステップS142)。   The image processing device 25 acquires the maximum value (Ymax), the minimum value (Ymin), and the peak value (Ypeak) of the luminance from the generated luminance histogram (step S142).

画像処理装置25は、輝度ヒストグラムのピーク値(Ypeak)から、数21,22に示す判定条件式に従って撮影対象の背景色を判別する(ステップS143)。
画像処理装置25は、画像効果補正用パラメータと撮影対象の背景色のデータをメモリ23に記憶する(ステップS144)。
The image processing device 25 discriminates the background color of the subject to be photographed from the peak value (Ypeak) of the luminance histogram according to the judgment conditional expressions shown in Equations 21 and 22 (step S143).
The image processing device 25 stores the image effect correction parameter and the background color data to be photographed in the memory 23 (step S144).

次に、画像処理装置25は、このように抽出した画像効果補正用パラメータを用いて画像効果処理(図5のステップS24)を行う。
前述のように、画像効果処理を効果的に行うには、背景色によって処理内容を替える必要がある。
Next, the image processing device 25 performs image effect processing (step S24 in FIG. 5) using the image effect correction parameters extracted in this way.
As described above, in order to effectively perform the image effect processing, it is necessary to change the processing contents depending on the background color.

ホワイトボード、ノート等のように、背景色が白である場合、図32(a)に示すような輝度変換を行う。黒板等のように、背景色が黒である場合、図32(b)に示すような輝度変換を行う。雑誌、パンフレット等のように、背景色が白または黒以外である場合、図32(c)に示すような変換を行う。尚、図32(a),(b),(c)において、横軸は、画素値の入力値を示し、縦軸は、画素値の出力値を示す。   When the background color is white, such as a whiteboard or notebook, luminance conversion as shown in FIG. When the background color is black, such as a blackboard, luminance conversion as shown in FIG. 32B is performed. When the background color is other than white or black, such as a magazine or pamphlet, the conversion shown in FIG. 32C is performed. In FIGS. 32A, 32B, and 32C, the horizontal axis indicates the input value of the pixel value, and the vertical axis indicates the output value of the pixel value.

背景色が白である場合、図32(a)に示すように、ピーク値を境にして、輝度変換線の傾斜角度を変える。所定輝度値を、例えば、230として、入力された輝度のピーク値を輝度値230まで引き上げる。そして、最大値を、最大輝度まで持ち上げる。従って、輝度変換線は、図32(a)に示すように、2つの線分によって表される。   When the background color is white, as shown in FIG. 32A, the inclination angle of the luminance conversion line is changed with the peak value as a boundary. The predetermined luminance value is set to 230, for example, and the input luminance peak value is raised to the luminance value 230. Then, the maximum value is raised to the maximum brightness. Therefore, the luminance conversion line is represented by two line segments as shown in FIG.

背景色が黒である場合、図32(b)に示すように、ピーク値をある一定の輝度値(20)になるように輝度変換を行なう。この場合も、図32(b)に示すように、輝度変換線は2つの線分によって表される。   When the background color is black, luminance conversion is performed so that the peak value becomes a certain luminance value (20), as shown in FIG. Also in this case, as shown in FIG. 32B, the luminance conversion line is represented by two line segments.

背景色が白または黒以外の色である場合、図32(c)に示すように、通常の引き伸ばし処理と同様に、最小値以下と最大値以上をカットし、1つの線分として表されるように輝度変換線を設定する。   When the background color is a color other than white or black, as shown in FIG. 32C, the minimum value or less and the maximum value or more are cut and expressed as one line segment as in the normal enlargement process. The luminance conversion line is set as follows.

尚、このように背景の輝度(Y)と出力(Y’)との変換テーブルを予め設定してメモリカード31に記憶してもよい。作成した変換テーブルに従って、入力された各画素の値から、それぞれの出力値を求め、画像効果処理を施す。このように変換された画像は、明るい画素はより明るく、暗い画素はより暗くなるので、輝度分布が広がり、視認性がすぐれた画像になる。   It should be noted that a conversion table of background luminance (Y) and output (Y ′) may be set in advance and stored in the memory card 31 as described above. According to the created conversion table, each output value is obtained from the input pixel value, and image effect processing is performed. In the image thus converted, bright pixels are brighter and dark pixels are darker, so that the luminance distribution is widened and the image is excellent in visibility.

このような考え方に基づいて、画像処理装置25は、図33に示すフローチャートに従って、画像効果処理を実行する。
画像処理装置25は、保存した画像効果補正用パラメータをメモリ23から読み出す(ステップS151)。
Based on such a concept, the image processing apparatus 25 executes image effect processing according to the flowchart shown in FIG.
The image processing device 25 reads out the stored image effect correction parameters from the memory 23 (step S151).

画像処理装置25は、背景が白か否かを判定する(ステップS152)。
背景が白と判定した場合(ステップS152においてYes)、画像処理装置25は、背景をより白くして、視認性が良くなるように、図32(a)に示すような輝度変換を行って、輝度ヒストグラムの調整を行う(ステップS153)。
The image processing device 25 determines whether or not the background is white (step S152).
When it is determined that the background is white (Yes in step S152), the image processing device 25 performs luminance conversion as illustrated in FIG. 32A so that the background is whiter and the visibility is improved. The brightness histogram is adjusted (step S153).

背景が白ではないと判定した場合(ステップS152においてNo)、画像処理装置25は、背景が黒か否かを判定する(ステップS154)。   If it is determined that the background is not white (No in step S152), the image processing apparatus 25 determines whether the background is black (step S154).

背景が黒であると判定した場合(ステップS154においてYes)、画像処理装置25は、背景が黒の場合、図32(b)に示すような輝度変換を行って、輝度ヒストグラムを調整する(ステップS155)。   When it is determined that the background is black (Yes in step S154), when the background is black, the image processing device 25 performs luminance conversion as illustrated in FIG. 32B and adjusts the luminance histogram (step). S155).

背景が黒ではないと判定した場合(ステップS154においてNo)、画像処理装置25は、図32(c)に示すような輝度変換を行って、撮影対象の背景色に応じたヒストグラム調整を行う(ステップS156)。   If it is determined that the background is not black (No in step S154), the image processing device 25 performs luminance conversion as shown in FIG. 32C and performs histogram adjustment according to the background color of the shooting target ( Step S156).

本実施形態のデジタルカメラ1では、モードを撮影モードだけでなく再生モードに設定することもできる。
操作部26の再生キーが押下されると、操作部26は、この操作情報をCPU30に送信する。
In the digital camera 1 of the present embodiment, the mode can be set not only to the shooting mode but also to the playback mode.
When the playback key of the operation unit 26 is pressed, the operation unit 26 transmits this operation information to the CPU 30.

CPU30は、この操作情報に基づいて、モードが再生モードになったことを判別すると、図34に示すフローチャートに従って、再生処理を実行する。
CPU30は、メモリカード31内に記録されている画像ファイルの中から、ユーザの選択された一枚の画像を選択する(ステップS161)。
When the CPU 30 determines that the mode is the playback mode based on the operation information, the CPU 30 executes the playback process according to the flowchart shown in FIG.
The CPU 30 selects one image selected by the user from the image files recorded in the memory card 31 (step S161).

CPU30は、この選択した画像ファイルをメモリカード31から読み出し、メモリ23に書き込む(ステップS162)。
CPU30は、読み出した画像から縮小画像を作成する(ステップS163)。
The CPU 30 reads the selected image file from the memory card 31 and writes it in the memory 23 (step S162).
The CPU 30 creates a reduced image from the read image (step S163).

CPU30は、メモリ23上のプレビュー画像用の記憶領域に書き込む(ステップS164)。これにより撮影モード時と同じように、この縮小画像が表示装置24から表示される。ユーザはこの表示を見ることで、再生画像を確認することができる。   The CPU 30 writes in the preview image storage area on the memory 23 (step S164). Thus, the reduced image is displayed from the display device 24 as in the photographing mode. The user can confirm the reproduced image by viewing this display.

ユーザがこの表示を視認して、他の画像を見たい場合にNOキーを押下すると、操作部26はこの操作情報をCPU30に送信する。
CPU30は、この操作情報に従って、次の画像が指定されたか否かを判定する(ステップS165)。
If the user visually recognizes this display and presses the NO key to view another image, the operation unit 26 transmits this operation information to the CPU 30.
The CPU 30 determines whether or not the next image has been designated according to the operation information (step S165).

次の画像が指定されたと判定した場合(ステップS165においてYes)、CPU30は、次の画像を選択し(ステップS166)、再度ステップS162〜S164を実行する。   When it is determined that the next image has been designated (Yes in step S165), the CPU 30 selects the next image (step S166) and executes steps S162 to S164 again.

次の画像が指定されなかったと判定した場合(ステップS165においてNo)、CPU30は、この再生モードが終了したか否かを判定する(ステップS167)。
再生キーが押下されなければ(ステップS167においてNo)、CPU30は、再度次の画像が指定されたか否かを判定する(ステップS165)。
When it is determined that the next image has not been designated (No in step S165), the CPU 30 determines whether or not the reproduction mode has ended (step S167).
If the play key is not pressed (No in step S167), CPU 30 determines again whether the next image has been designated (step S165).

一方、再生キーが押下されると、CPU30は、操作部26から、この操作情報を受信して再生モードが終了したと判定し(ステップS167においてYes)、再生処理を終了させる。   On the other hand, when the playback key is pressed, the CPU 30 receives this operation information from the operation unit 26 and determines that the playback mode has ended (Yes in step S167), and ends the playback process.

次に、パラメータのファイルヘッダへの書き込みについて説明する。
元画像と補正画像とを、共にJPEGフォーマットの画像として記録する際に、元画像のファイル名を画像ファイルのヘッダ(オプションデータ)領域に記録する。補正画像を再度修正したい場合に、修正画像ファイルを補正するのでは元の画像から作成することによって劣化の少ない画像を作成することができる。この画像編集は、デジタルカメラ1内で行われてもよい。しかし、画像編集は、コンピュータで行われることもできる。コンピュータで画像編集を行えば、さらに高度の画像補正を行えることが期待される。
Next, writing parameters to the file header will be described.
When both the original image and the corrected image are recorded as JPEG format images, the file name of the original image is recorded in the header (option data) area of the image file. When it is desired to correct the corrected image again, if the corrected image file is corrected, an image with little deterioration can be generated by generating the corrected image file from the original image. This image editing may be performed in the digital camera 1. However, image editing can also be performed on a computer. If image editing is performed on a computer, it is expected that more advanced image correction can be performed.

さらに、ヘッダに画像処理を行ったときのパラメータを記録することにより、コンピュータは、この元画像にこのパラメータを用いて、補正画像を再度、容易に作成することができる。このため、ユーザは即時、その前回の補正画像から手を加えやすくなる。   Further, by recording the parameters when image processing is performed in the header, the computer can easily create a corrected image again using the parameters for the original image. For this reason, it becomes easy for the user to make a change immediately from the previous corrected image.

ヘッダ情報は、図35に示すように、データの種類(データ名)と、それぞれのデータのバイト数と、その内容と、を含む。
CPU30は、このヘッダ情報を、ヘッダ情報記憶領域に順次、元画像データの画像ファイル名、補正画像の画像サイズ、アフィンパラメータ、ヒストグラムテーブルを作成するための入出力のデータセットを記憶する。
As shown in FIG. 35, the header information includes the type of data (data name), the number of bytes of each data, and the contents thereof.
The CPU 30 sequentially stores the header information in the header information storage area, the image file name of the original image data, the image size of the corrected image, the affine parameters, and an input / output data set for creating a histogram table.

入出力データセットは、入力データと出力データとの関係を示すデータのセットであり、入出力関係を示す直線の傾斜が変化する変化点毎に、入力データの小さい方から順に並べて、入力データと出力データとを組にしたものである。   The input / output data set is a set of data indicating the relationship between the input data and the output data, and is arranged in order from the smallest of the input data for each change point where the slope of the straight line indicating the input / output relationship changes. This is a set of output data.

変化点の入力データが、小さい方から、順に、x1,x2,…,xmとして、対応する出力データがy1,y2,...,ymとすると、データセットは、(x1,y1),(x2,y2),…,(xm,ym)のm個のデータセットで表される。この場合、入力データxは、xi<x<xi+1であれば、出力データyは次の数23によって表される。
If the input data at the change point is x1, x2, ..., xm in order from the smallest, and the corresponding output data is y1, y2, ..., ym, the data set is (x1, y1), ( x2, y2),..., (xm, ym). In this case, if the input data x is xi <x <xi + 1, the output data y is expressed by the following equation (23).

例えば、入力データと出力データとの関係が、図32(a)に示すような関係である場合、CPU30は、(0,0)、(最小値,0)、(ピーク値、一定輝度値(=230))、(最大値,255)、(255,255)の5つのデータセットをメモリカード31に記憶する。   For example, when the relationship between the input data and the output data is as shown in FIG. 32A, the CPU 30 determines (0, 0), (minimum value, 0), (peak value, constant luminance value ( = 230)), (maximum value, 255), and (255, 255) are stored in the memory card 31.

同様に、入出力データの関係が、図32(b)に示すような関係である場合、CPU30は、(0,0),(最小値,0),(ピーク値,一定輝度値(=20)),(最大値,255),(255,255)の5つのデータセットをメモリカード31に記憶する。   Similarly, when the relationship between input and output data is as shown in FIG. 32B, the CPU 30 determines (0, 0), (minimum value, 0), (peak value, constant luminance value (= 20). )), (Maximum value, 255), and (255, 255) are stored in the memory card 31.

入出力データの関係が、図32(c)に示すような関係である場合、CPU30は、(0,0),(最小値,0),(最大値,255),(255,255)の4つのデータセットをメモリカード31に記憶する。   When the relationship between the input and output data is as shown in FIG. 32C, the CPU 30 determines (0, 0), (minimum value, 0), (maximum value, 255), (255, 255). Four data sets are stored in the memory card 31.

このような輝度値のデータセットを記録することにより、様々なヒストグラムを記述することができる。CPU30は、このようなデータを補正画像データの記録(図5のステップS26)と同時に、メモリカード31に記録する。   By recording such a brightness value data set, various histograms can be described. The CPU 30 records such data on the memory card 31 simultaneously with the recording of the corrected image data (step S26 in FIG. 5).

次に、補正画像の編集処理について説明する。
画像データを一度保存した後、この画像データを再度補正したい場合がある。この場合、前述のように、元の画像データを一括して補正した方が、画像劣化が少ないという点で、好ましい。
Next, correction image editing processing will be described.
In some cases, after image data is stored once, it is desired to correct the image data again. In this case, as described above, it is preferable to collectively correct the original image data in that image deterioration is small.

ユーザがコントロールキーを操作して画像の編集モードを指定すると、CPU30は、図36に示すフローチャートに従って、画像の編集処理を実行する。
CPU30は、操作部26から送信された操作情報に従って、補正画像を選択する(ステップS171)。
When the user operates the control key to designate an image editing mode, the CPU 30 executes an image editing process according to the flowchart shown in FIG.
The CPU 30 selects a corrected image according to the operation information transmitted from the operation unit 26 (step S171).

CPU30は、メモリカード31のヘッダ情報記憶領域からヘッダ情報を読み込む(ステップS172)。
CPU30は、元画像を読み込む(ステップS173)。
CPU30は、読み込んだ補正画像、ヘッダ情報、元画像を画像処理装置25に送り、再度、補正するように、画像処理装置25を制御する(ステップS174)。
The CPU 30 reads header information from the header information storage area of the memory card 31 (step S172).
The CPU 30 reads the original image (step S173).
The CPU 30 sends the read corrected image, header information, and original image to the image processing device 25, and controls the image processing device 25 to correct again (step S174).

画像処理装置25は、補正画像、ヘッダ情報、元画像を、CPU30から取得して、射影変換画像を作成し(ステップS175)、画像効果処理を行う(ステップS176)。画像処理装置25は、作成した射影変換画像のデータを表示装置24に送り、表示装置24は、この画像を液晶モニタ12に表示する。   The image processing device 25 acquires the corrected image, the header information, and the original image from the CPU 30, creates a projective conversion image (step S175), and performs image effect processing (step S176). The image processing device 25 sends the data of the created projective transformation image to the display device 24, and the display device 24 displays this image on the liquid crystal monitor 12.

ユーザが射影変換キー、回転補正キーを操作すると、操作部26は、この操作情報をCPU30に送信する。CPU30は、この操作情報を取得して、画像処理装置25を射影手動補正処理を行うように制御する。   When the user operates the projection conversion key and the rotation correction key, the operation unit 26 transmits this operation information to the CPU 30. The CPU 30 acquires this operation information and controls the image processing apparatus 25 to perform the projection manual correction process.

画像処理装置25は、図29に示すフローチャートに従って射影手動補正処理(画像変換の調整処理)を行う(ステップS177)。
画像処理装置25は、ヘッダ情報と共に射影手動補正処理された補正画像をメモリカード31に記録し(ステップS178)、この編集処理を終了させる。
The image processing apparatus 25 performs a projection manual correction process (image conversion adjustment process) according to the flowchart shown in FIG. 29 (step S177).
The image processing device 25 records the corrected image subjected to the projection manual correction process together with the header information on the memory card 31 (step S178), and ends the editing process.

以上説明したように、本実施形態によれば、画像処理装置25は、ラベリング処理を行うことにより、撮影対象画像と同じ画素値を有する画素が連続する領域を求め、求めた領域のうち、面積が最大となる領域の画像を撮影対象画像とするようにした。また、画像処理装置52は、撮影対象画像の領域よりも小さな領域の画像の画素値を、背景画素の画素値に変更し、撮影対象画像のエッジ画像を生成するようにした。   As described above, according to the present embodiment, the image processing device 25 obtains a region in which pixels having the same pixel value as that of the image to be captured are obtained by performing a labeling process, and the area of the obtained regions is the area. The image of the area where the maximum is set as the image to be captured. In addition, the image processing device 52 changes the pixel value of the image in the region smaller than the region of the shooting target image to the pixel value of the background pixel, and generates an edge image of the shooting target image.

従って、プロジェクタによって白板上に投影された投影画像を撮影することにより、蛍光灯等の反射像や蛍光灯そのものが同時に写り込んでしまった場合でも、原稿のエッジ画像に四角形の被写体以外のエッジが表れることはない。このため、正確に被写体対象の輪郭を検出でき、撮影対象画像を正しく取得することができる。
尚、この処理は、輝度の低い台の上に置かれた白色書類を撮影し、射影歪みを補正する場合にも有効である。
Therefore, even if a reflected image such as a fluorescent lamp or the fluorescent lamp itself is reflected at the same time by photographing a projected image projected on a white plate by a projector, an edge other than a quadrangular subject appears on the edge image of the document. Never appear. For this reason, the outline of the subject can be accurately detected, and the image to be captured can be acquired correctly.
This process is also effective when photographing a white document placed on a table with low brightness and correcting projection distortion.

また、近傍8点の画素が背景である孤立点にはラベルをつけないようにラベリングをおこなうことで、孤立点におけるノイズによるラベル数の増加を防ぐことができ、演算時に使用するメモリを少なくして画像処理をおこなうことができる。   In addition, by labeling so that isolated pixels that are the background 8 pixels are not labeled, an increase in the number of labels due to noise at the isolated points can be prevented, and the memory used for calculation is reduced. Image processing.

また、画像処理装置25が、射影変換と画像効果処理を行った際に、補正した画像データをメモリカード31の画像ファイルに記録し、CPU30は、元の画像データ名と、求めた射影パラメータと、画像処理補正用パラメータと、をメモリカード31の画像ファイルに記憶するようにした。従って、再度、画像編集を行う際に、画像編集を容易に行って、画像を再度、補正することができる。   Further, when the image processing device 25 performs the projection conversion and the image effect processing, the corrected image data is recorded in the image file of the memory card 31, and the CPU 30 stores the original image data name, the obtained projection parameter, and The image processing correction parameters are stored in the image file of the memory card 31. Therefore, when image editing is performed again, image editing can be easily performed and the image can be corrected again.

また、画像処理装置25は、撮影対象(白板2)の画像から輪郭を取得して、撮影対象の形状を取得し、撮影対象の四角形の頂点位置から、射影パラメータを求めて撮影対象の画像を射影変換するようにした。   The image processing device 25 acquires an outline from the image of the shooting target (white plate 2), acquires the shape of the shooting target, obtains a projection parameter from the vertex position of the shooting target quadrangle, and obtains the image of the shooting target. Changed to projective transformation.

従って、撮影対象が四角形であれば、自動的に画像の歪みを容易に補正することができる。また、その結果として、元の撮影対象の画像に等しい判読性の高い画像を得ることができる。   Therefore, if the object to be imaged is a rectangle, the distortion of the image can be automatically corrected easily. As a result, an image with high legibility that is equal to the original image to be photographed can be obtained.

また、画像の中央部に被写体対象が存在すると仮定し、画像中央部のみのヒストグラムから二値化の閾値を得ることで、演算処理の効率をあげ高速な画像処理を行うことができる。   Further, assuming that the subject object exists in the center of the image and obtaining the binarization threshold value from the histogram only in the center of the image, it is possible to increase the efficiency of the arithmetic processing and perform high-speed image processing.

また、撮影対象が縦、横の比が不明な四角形であり、かつ、任意の撮影対象を任意の視点・姿勢で撮影した場合でもデジタルカメラ1の焦点距離を用いることにより、画像の歪みを補正することができる。   Further, even when the shooting target is a quadrangle whose aspect ratio is unknown and the shooting target is shot from any viewpoint / posture, the distortion of the image is corrected by using the focal length of the digital camera 1. can do.

また、射影パラメータを求めるのにプレビューなどに用いる解像度の低い縮小画像を用いるので、演算数は低減され、効率よく演算処理を行うことができ、画像処理を高速に行うことができる。   In addition, since a reduced image having a low resolution used for preview or the like is used to obtain the projection parameters, the number of operations can be reduced, the operation processing can be performed efficiently, and the image processing can be performed at high speed.

また、撮影された画像から、複数の四角形が抽出された場合に、最大外郭の四角形を優先的に選択し、NOキーやカーソルキー等によって、四角形が大きい方から順に選択されるように構成されているため、複数の撮影対象の輪郭の候補があっても、速やかに撮影対象の輪郭を取得することができ、結果として簡単な手法で判読性の高い画像を得ることができる。   In addition, when a plurality of rectangles are extracted from the captured image, the largest outline rectangle is preferentially selected, and the rectangle is selected in order from the larger one by the NO key, the cursor key, or the like. Therefore, even if there are a plurality of contour candidates for the photographing target, the contour of the photographing target can be quickly acquired, and as a result, a highly readable image can be obtained by a simple method.

また、歪み補正を行った画像から画像処理補正用パラメータを求めるようにしたので、より良好な画像効果補正を行うことができる。   In addition, since the image processing correction parameters are obtained from the distortion-corrected image, better image effect correction can be performed.

尚、本発明を実施するにあたっては、種々の形態が考えられ、上記実施形態に限られるものではない。
例えば、本実施形態では、縮小した二値化画像に対してラベリング処理を行うようにした。しかし、例えば、撮影画像の画素値に、撮影対象画像の画素値に対応するように範囲を設定して、ラベリング処理を行えば、ラベリング処理を行う対象となる画像は、必ずしも二値化画像である必要はない。
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 present embodiment, the labeling process is performed on the reduced binarized image. However, for example, if a range is set for the pixel value of the photographic image so as to correspond to the pixel value of the photographic target image and the labeling process is performed, the image to be subjected to the labeling process is not necessarily a binarized image. There is no need.

また、撮影対象画像に対応する画素値を有する画素が連続する領域を、上記実施形態のようなラベリング処理によって求める必要はない。例えば、すべての画素の画素値を求め、求めた画素のうち、撮影対象画像に対応する画素値を有する画素をグループ化して撮影対象画像に対応する画素値を有する画素が連続する領域を判別し、求めるようにしてもよい。   Further, it is not necessary to obtain a region in which pixels having pixel values corresponding to the image to be captured are continuous by the labeling process as in the above embodiment. For example, the pixel values of all the pixels are obtained, and among the obtained pixels, pixels having pixel values corresponding to the image to be photographed are grouped to determine a region where pixels having pixel values corresponding to the image to be photographed are continuous. You may make it ask.

上記実施形態では、補正画像の作成に用いたパラメータを補正画像のファイルに保存した。しかし、元画像のファイルにこのパラメータを保存することもできる。元画像のファイルにパラメータを保存すれば、補正画像を保存しなくても、元画像から容易に補正画像を作成することができる。   In the above embodiment, the parameters used to create the corrected image are stored in the corrected image file. However, this parameter can also be stored in the original image file. If the parameters are saved in the original image file, the corrected image can be easily created from the original image without saving the corrected image.

この場合のヘッダ情報は、図37に示すように、画像サイズと射影パラメータと画像効果補正用パラメータとのみで構成される。   As shown in FIG. 37, the header information in this case includes only the image size, projection parameters, and image effect correction parameters.

また、撮影処理を行う際、デジタルカメラ1は、変換後の画像を保存せずに、すぐに射影パラメータの抽出処理を行う。この撮影処理(2)の内容を図38のフローチャートに示す。
画像処理装置25は、射影補正画像を作成し(ステップS181〜189)、画像変換の調整、画像効果補正用パラメータの抽出、画像効果処理を行う(ステップS190〜S191)。
Further, when performing the photographing process, the digital camera 1 immediately performs the projection parameter extraction process without storing the converted image. The contents of the photographing process (2) are shown in the flowchart of FIG.
The image processing device 25 creates a projection corrected image (steps S181 to 189), performs image conversion adjustment, extraction of image effect correction parameters, and image effect processing (steps S190 to S191).

CPU30は、図37に示すヘッダ情報を作成する(ステップS192)。
画像処理装置25は、元画像データを圧縮し、CPU30は、作成したヘッダ情報を、圧縮した元画像データと共にメモリカード31に記録する(ステップS193,194)。
The CPU 30 creates header information shown in FIG. 37 (step S192).
The image processing device 25 compresses the original image data, and the CPU 30 records the created header information together with the compressed original image data in the memory card 31 (steps S193 and 194).

また、画像編集処理も図36に示す処理内容とは異なるものになる。即ち、画像編集処理は、補正画像ではなく、元画像に対して行われる。この画像再編集処理内容を図39のフローチャートに示す。
CPU30は、元画像を選択し、元画像のファイルからヘッダ情報を読み出す(ステップS201,S202)。
Also, the image editing process is different from the process shown in FIG. That is, the image editing process is performed not on the corrected image but on the original image. The contents of this image re-editing process are shown in the flowchart of FIG.
The CPU 30 selects the original image and reads header information from the original image file (steps S201 and S202).

画像処理装置25は、すぐに射影補正画像を作成し、画像効果処理を行う(ステップS203、S204)。
CPU30と画像処理装置25とは、射影手動補正処理を行い、補正終了後、CPU30は、変更された射影補正パラメータに基づいてヘッダ情報を作成し、作成したヘッダ情報を元画像のファイルに再度記録する(ステップS205〜S207)。
The image processing device 25 immediately creates a projection corrected image and performs image effect processing (steps S203 and S204).
The CPU 30 and the image processing device 25 perform a projection manual correction process. After the correction is completed, the CPU 30 creates header information based on the changed projection correction parameter, and records the created header information in the original image file again. (Steps S205 to S207).

また、上記実施形態では、画像補正をデジタルカメラ1で行うようにした。しかし、画像補正をコンピュータで行うことも可能である。この場合、コンピュータをコンピュータインタフェース部27に接続し、コンピュータが図36に示すフローチャートに従って画像の編集処理を実行する。コンピュータがこのような画像の編集処理を行えば、コンピュータは、マウス等を備え、デジタルカメラ1に比べて操作情報の入力も容易になるので、操作性が向上する。また、コンピュータの表示装置は、デジタルカメラ1の液晶モニタ12よりも大きいのが一般的であるので、画像を詳細に視認して、画像補正を精度良く行うことが可能になる。   In the above embodiment, the 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 image editing processing according to the flowchart shown in FIG. If the computer performs such image editing processing, the computer includes a mouse and the like, and it becomes easier to input operation information than the digital camera 1, so that the 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.

また、上記実施形態では、四角形を取得できない場合、警告を行うようにした。しかし、警告を行う代わりに、撮影した画像を表示して、コントロールキー等を用いて、ユーザに四角形の4点を指定させるように構成されることもできる。そして、この指定された4点を用いてアフィンパラメータを求めるようにすることもできる。   In the above embodiment, a warning is given when a quadrangle cannot be acquired. However, instead of issuing a warning, the photographed image can be displayed and the user can designate four rectangular points using a control key or the like. Then, the affine parameters can be obtained using the designated four points.

また、上記実施形態では、二値化の閾値は画像中央部のヒストグラムのピーク値に基づいて設定するものとした。しかし、閾値の設定方法はこれに限られず、例えば、事前に定めた一定の閾値を用いて二値化をおこなうようにすることも可能である。このように一定の基準に基づいて処理を行うことにより、撮影対象の特性によらず、安定して原稿の画像を取得することが可能となる。   In the above embodiment, the binarization threshold is set based on the peak value of the histogram at the center of the image. However, the threshold setting method is not limited to this. For example, binarization may be performed using a predetermined threshold. By performing processing based on a certain standard as described above, it is possible to stably acquire an image of a document regardless of the characteristics of a subject to be photographed.

尚、上記実施形態では、プログラムが、それぞれメモリ等に予め記憶されているものとして説明した。しかし、コンピュータを、装置の全部又は一部として動作させ、あるいは、上述の処理を実行させるためのプログラムを、フレキシブルディスク、CD−ROM(Compact Disk Read-Only Memory)、DVD(Digital Versatile Disk)、MO(Magneto Optical disk)などのコンピュータ読み取り可能な記録媒体に格納して配布し、これを別のコンピュータにインストールし、上述の手段として動作させ、あるいは、上述の工程を実行させてもよい。   In the above 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 a state when image | photographing a white board with the digital camera which concerns on 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 for demonstrating the function of the image processing apparatus shown in FIG. 図2に示す操作部が備える各キーを説明するための説明図である。It is explanatory drawing for demonstrating each key with which the operation part shown in FIG. 2 is provided. デジタルカメラが実行する撮影処理の内容を示すフローチャートである。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 square of the clipping object of the image processing apparatus shown in FIG. 射影パラメータの抽出とアフィン変換の基本的な考え方を説明するための説明図である。It is explanatory drawing for demonstrating the basic concept of extraction of a projection parameter, and an affine transformation. 図2に示す画像処理装置が実行する射影パラメータ抽出処理の内容を示すフローチャートである。It is a flowchart which shows the content of the projection parameter extraction process which the image processing apparatus shown in FIG. 2 performs. 図2に示す画像処理装置が実行する四角形輪郭抽出処理の内容を示すフローチャートである。It is a flowchart which shows the content of the square outline extraction process which the image processing apparatus shown in FIG. 2 performs. (a)は、図2に示す画像処理装置が取得した縮小二値化画像の一例を示す説明図であり、(b)は、(a)の縮小二値化画像に含まれている画像の説明図である。(A) is explanatory drawing which shows an example of the reduction | restoration binarization image which the image processing apparatus shown in FIG. 2 acquired, (b) is an image of the image contained in the reduction | restoration binarization image of (a). It is explanatory drawing. 図2に示す画像処理装置が実行するラベリング処理の説明図であり、(a)〜(d)は、それぞれ、ラベリング処理の際の条件1〜4を示す。It is explanatory drawing of the labeling process which the image processing apparatus shown in FIG. 2 performs, (a)-(d) shows the conditions 1-4 in the case of a labeling process, respectively. 図2に示す画像処理装置が実行するラベリング処理の内容を示すフローチャートである。It is a flowchart which shows the content of the labeling process which the image processing apparatus shown in FIG. 2 performs. 図2に示す画像処理装置が実行するラベリング処理の具体的な内容を示す説明図である。It is explanatory drawing which shows the specific content of the labeling process which the image processing apparatus shown in FIG. 2 performs. 図2に示す画像処理装置が実行するラベリング処理をした結果を示す説明図である。It is explanatory drawing which shows the result of having performed the labeling process which the image processing apparatus shown in FIG. 2 performs. (a)は、ラベリング後に取得された縮小二値化画像を示し、(b)は、(b)に示す縮小二値化画像に基づいて生成されたエッジ画像を示す説明図である。(A) is a reduced binarized image obtained after labeling, and (b) is an explanatory diagram showing an edge image generated based on the reduced binarized image shown in (b). Robertsフィルタの係数を示す説明図である。It is explanatory drawing which shows the coefficient of a Roberts filter. ラドン変換の原理を説明するためのイメージ図である。It is an image figure for demonstrating the principle of radon conversion. X、Y座標系の直線をラドン変換して極座標系のデータを取得する動作を説明するための説明図である。It is explanatory drawing for demonstrating the operation | movement which acquires the data of a polar coordinate system by radon-transforming the straight line of a X, Y coordinate system. 図2に示す画像処理装置が実行する極座標系のデータからのピーク点検出処理の内容を示すフローチャートである。It is a flowchart which shows the content of the peak point detection process from the data of the polar coordinate system which the image processing apparatus shown in FIG. 2 performs. ピーク点を検出して抽出した直線から、四角形を検出する考え方を示す説明図である。It is explanatory drawing which shows the view which detects a square from the straight line which detected and extracted the peak point. 図2に示す画像処理装置が実行する検出した四角形の選択処理の内容を示すフローチャートである。It is a flowchart which shows the content of the selection process of the detected square which the image processing apparatus shown in FIG. 2 performs. 図2に示す画像処理装置が実行する四角形の頂点からアフィンパラメータを取得するアフィンパラメータの取得処理の内容を示すフローチャートである。It is a flowchart which shows the content of the acquisition process of the affine parameter which acquires an affine parameter from the square vertex performed by the image processing apparatus shown in FIG. 四角形を抽出できなかった場合の警告の内容を示す説明図である。It is explanatory drawing which shows the content of the warning when a square cannot be extracted. 図2に示すCPUが実行する警告処理の内容を示すフローチャートである。It is a flowchart which shows the content of the warning process which CPU shown in FIG. 2 performs. 射影変換後の画像から元の画像を得るための逆変換を説明するための説明図である。It is explanatory drawing for demonstrating the inverse transformation for obtaining the original image from the image after projective transformation. 図2に示す画像処理装置が実行するアフィン変換による画像変換処理の内容を示すフローチャートである。It is a flowchart which shows the content of the image conversion process by the affine transformation which the image processing apparatus shown in FIG. 2 performs. 射影変換によって画像の歪みを補正することができなかった例を示す説明図である。It is explanatory drawing which shows the example which could not correct | amend the distortion of an image by projective transformation. 元の画像、射影変換画像、拡大した射影変換画像との対応関係を説明するための説明図である。It is explanatory drawing for demonstrating the correspondence with an original image, a projection conversion image, and the enlarged projection conversion image. 図2に示す画像処理装置が実行する画像変換の調整処理の内容を示すフローチャートである。3 is a flowchart showing the contents of image conversion adjustment processing executed by the image processing apparatus shown in FIG. 2. 輝度ヒストグラムの一例を示す説明図である。It is explanatory drawing which shows an example of a brightness | luminance histogram. 図2に示す画像処理装置が実行する画像効果補正用パラメータの抽出処理の内容を示すフローチャートである。3 is a flowchart showing the contents of image effect correction parameter extraction processing executed by the image processing apparatus shown in FIG. 2. 画像効果処理を示す説明図であり、(a)は、背景色が白の場合の画像効果処理を示し、(b)は、背景が黒の場合の画像効果処理を示し、(c)は、背景が白又は黒以外の場合の画像効果処理を示す。It is explanatory drawing which shows an image effect process, (a) shows an image effect process in case a background color is white, (b) shows an image effect process in case a background is black, (c), The image effect processing when the background is other than white or black is shown. 図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に示すCPU、画像処理装置が実行する再生処理の内容を示すフローチャートである。It is a flowchart which shows the content of the reproduction | regeneration processing which CPU and image processing apparatus which are shown in FIG. 2 perform. ヘッダ情報の内容を示す説明図である。It is explanatory drawing which shows the content of header information. 図2に示すCPU、画像処理装置が実行する補正画像の編集処理の内容を示すフローチャートである。3 is a flowchart showing the content of a correction image editing process executed by the CPU and image processing apparatus shown in FIG. 元画像のみを保存する場合のヘッダ情報の内容を示す説明図である。It is explanatory drawing which shows the content of the header information in the case of preserve | saving only an original image. 元画像のみを保存する場合に図2に示すCPU、画像処理装置が実行する撮影処理(2)の内容を示すフローチャートである。3 is a flowchart showing the contents of a photographing process (2) executed by the CPU and image processing apparatus shown in FIG. 2 when only the original image is stored. 元画像のみを保存する場合に図2に示すCPU、画像処理装置が実行する補正画像の再編集処理の内容を示すフローチャートである。FIG. 3 is a flowchart showing details of a correction image re-editing process executed by the CPU and the image processing apparatus shown in FIG. 2 when only the original image is stored.

符号の説明Explanation of symbols

1・・・デジタルカメラ、2・・・白板、11・・・撮影レンズ部、12・・・液晶モニタ、13・・・シャッタボタン、21・・・光学レンズ装置、22・・・イメージセンサ、23・・・メモリ、24・・・表示装置、25・・・画像処理装置、30・・・CPU、31・・・メモリカード   DESCRIPTION OF SYMBOLS 1 ... Digital camera, 2 ... White board, 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 (8)

撮影によって得られた撮影画像から、目的とする撮影対象の画像を取得して画像処理を行う画像処理装置において、
前記撮影対象画像の画素値に対応する画素値を有する画素が連続する領域を求め、求めた複数の領域のうち、面積が最大となる領域の画像を前記撮影対象画像として取得する画像取得部と、
前記画像取得部が取得した前記撮影対象画像の画像処理を行う画像処理部と、を備えた、
ことを特徴とする画像処理装置。
In an image processing apparatus that acquires an image of a target shooting target from a shot image obtained by shooting and performs image processing,
An image acquisition unit that obtains an area in which pixels having pixel values corresponding to pixel values of the image to be photographed are continuous, and obtains an image of an area having the maximum area among the obtained areas as the image to be photographed; ,
An image processing unit that performs image processing of the shooting target image acquired by the image acquisition unit,
An image processing apparatus.
前記画像取得部は、前記撮影画像の各画素を走査して前記撮影対象画像の画素値に対応する画素値を有する画素を対象画素として取得し、取得した対象画素と前記対象画素に隣接する画素の画素値との対応関係に基づいて前記領域を判別する、
ことを特徴とする請求項1に記載の画像処理装置。
The image acquisition unit scans each pixel of the captured image, acquires a pixel having a pixel value corresponding to a pixel value of the captured image as a target pixel, and acquires the acquired target pixel and a pixel adjacent to the target pixel Determining the region based on the correspondence with the pixel value of
The image processing apparatus according to claim 1.
前記画像取得部は、前記連続した画素によって形成された領域のうち、前記撮影対象画像の領域よりも小さな領域の画像を前記撮影対象とともに撮影された撮影対象外の画像と判別し、前記撮影対象外の画像の画素値を予め設定された背景画素の画素値に変更して、前記撮影対象画像を取得する、
ことを特徴とする請求項1又は2に記載の画像処理装置。
The image acquisition unit determines that an image of an area smaller than the area of the image to be imaged among areas formed by the continuous pixels is an image outside the object to be imaged taken together with the object to be imaged, and Changing the pixel value of the outside image to the pixel value of the background pixel set in advance, and acquiring the shooting target image;
The image processing apparatus according to claim 1, wherein the image processing apparatus is an image processing apparatus.
前記撮影画像の各画素の画素値を所定の閾値と比較し、比較結果に基づいて前記撮影画像の二値化画像を作成する二値化画像作成部を備え、
前記画像取得部は、前記二値化画像作成部が作成した二値化画像から、前記撮影対象画像に対応する画素値を有する画素を取得する、
ことを特徴とする請求項1乃至3のいずれか1項に記載の画像処理装置。
Comparing a pixel value of each pixel of the photographed image with a predetermined threshold, and a binarized image creating unit that creates a binarized image of the photographed image based on a comparison result,
The image acquisition unit acquires a pixel having a pixel value corresponding to the shooting target image from the binarized image created by the binarized image creation unit.
The image processing apparatus according to claim 1, wherein the image processing apparatus is an image processing apparatus.
前記画像取得部は、前記撮影画像の各画素を走査して前記対象画素を取得したときに、取得した対象画素に隣接する画素の画素値を参照し、既に走査された隣接画素が予め設定された背景画素の画素値を有する場合には、前記対象画素に新たに固有の値を付し、前記隣接画素に既に固有の値が付されたものがある場合には、前記対象画素に前記隣接画素と同じ値を付すことにより、前記対象画素と前記対象画素に隣接する画素の画素値との対応関係を求め、前記撮影画像の全画素を走査したときに、各画素に付された固有の値を参照して前記領域を判別する、
ことを特徴とする請求項2に記載の画像処理装置。
When the image acquisition unit scans each pixel of the captured image to acquire the target pixel, the image acquisition unit refers to the pixel value of the pixel adjacent to the acquired target pixel, and the already scanned adjacent pixel is preset. If the pixel value of the background pixel has a unique value, the target pixel is newly assigned a unique value, and if the adjacent pixel already has a unique value, the neighbor pixel is adjacent to the target pixel. By assigning the same value as the pixel, the correspondence relationship between the target pixel and the pixel value of the pixel adjacent to the target pixel is obtained, and when all the pixels of the photographed image are scanned, each pixel is assigned a unique value. Determine the region by referring to the value;
The image processing apparatus according to claim 2.
前記画像処理部は、
前記画像取得部が取得した前記撮影対象画像の輪郭を取得して、前記画像の形状を取得する形状取得部と、
前記形状取得部が取得した前記撮影対象画像の形状と前記撮影対象の形状とを対応させて、前記撮影対象と前記撮影対象画像との関係を示す射影パラメータを求める射影パラメータ取得部と、
前記射影パラメータ取得部が求めた射影パラメータを用いて前記撮影対象画像の画像変換を行う画像変換部と、を備えた、
ことを特徴とする請求項1乃至5のいずれか1項に記載の画像処理装置。
The image processing unit
A shape acquisition unit that acquires the contour of the image to be captured acquired by the image acquisition unit and acquires the shape of the image;
A projection parameter acquisition unit for associating the shape of the imaging target image acquired by the shape acquisition unit with the shape of the imaging target to obtain a projection parameter indicating a relationship between the imaging target and the imaging target image;
An image conversion unit that performs image conversion of the shooting target image using the projection parameter obtained by the projection parameter acquisition unit,
The image processing apparatus according to claim 1, wherein the image processing apparatus is an image processing apparatus.
撮影対象を撮影する撮影装置の画像処理方法であって、
撮影によって得られた撮影画像から、目的とする撮影対象の画像の画素値に対応する画素値を有する画素が連続する領域を求めるステップと、
求めた領域が複数の場合、面積が最大となる領域の画像を前記撮影対象画像として取得するステップと、
前記取得した前記撮影対象の画像の画像処理を行うステップと、を備えた、
ことを特徴とする撮影装置の画像処理方法。
An image processing method of a photographing apparatus for photographing a photographing object,
Obtaining a region in which pixels having pixel values corresponding to pixel values of a target image to be photographed are continuous from a photographed image obtained by photographing;
When there are a plurality of obtained regions, obtaining an image of the region having the largest area as the image to be captured;
Performing image processing of the acquired image to be photographed,
An image processing method for a photographing apparatus.
コンピュータに、
撮影によって得られた撮影画像から、目的とする撮影対象の画像の画素値に対応する画素値を有する画素が連続する領域を求める手順、
求めた領域が複数の場合、面積が最大となる領域の画像を前記撮影対象画像として取得する手順、
前記取得した前記撮影対象の画像の画像処理を行う手順、
を実行させるためのプログラム。
On the computer,
A procedure for obtaining a region in which pixels having pixel values corresponding to pixel values of a target image to be photographed are continuous from a photographed image obtained by photographing,
In the case where there are a plurality of obtained areas, a procedure for acquiring an image of an area with the largest area as the image to be captured,
A procedure for performing image processing of the acquired image to be imaged;
A program for running
JP2004083338A 2004-03-22 2004-03-22 Image processing device, image processing method and program Abandoned JP2005275447A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004083338A JP2005275447A (en) 2004-03-22 2004-03-22 Image processing device, image processing method and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004083338A JP2005275447A (en) 2004-03-22 2004-03-22 Image processing device, image processing method and program

Publications (2)

Publication Number Publication Date
JP2005275447A true JP2005275447A (en) 2005-10-06
JP2005275447A5 JP2005275447A5 (en) 2007-02-15

Family

ID=35175106

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004083338A Abandoned JP2005275447A (en) 2004-03-22 2004-03-22 Image processing device, image processing method and program

Country Status (1)

Country Link
JP (1) JP2005275447A (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007164571A (en) * 2005-12-15 2007-06-28 Toppan Printing Co Ltd Editing device, method and program
JP2007194865A (en) * 2006-01-18 2007-08-02 Casio Comput Co Ltd Image projecting device, projection image correction method and program
JP2009251902A (en) * 2008-04-04 2009-10-29 Sony Corp Imaging processing apparatus, image processing method, and imaging device
US7986831B2 (en) 2006-08-29 2011-07-26 Sony Corporation Image processing apparatus, image processing method and computer program
US8144241B2 (en) 2008-04-04 2012-03-27 Sony Corporation Imaging apparatus, image processing apparatus, and exposure control method
JP2012119798A (en) * 2010-11-30 2012-06-21 Casio Comput Co Ltd Image generation method, image generation device and program
JP2014007484A (en) * 2012-06-22 2014-01-16 Seiko Epson Corp Correction control device, correction method, and projector
US8670616B2 (en) 2010-11-18 2014-03-11 Casio Computer Co., Ltd. Region specification method, region specification apparatus, recording medium, server, and system
JP2015007866A (en) * 2013-06-25 2015-01-15 ローランドディー.ジー.株式会社 Projection image correction system, projection image correction method, projection image correction program, and computer-readable recording medium
JP2017111034A (en) * 2015-12-17 2017-06-22 株式会社日立ソリューションズ Terminal having camera, navigation information providing system, and navigation information display method
JP2017531167A (en) * 2014-08-08 2017-10-19 ヘレーウス テネーヴォ エルエルシーHeraeus Tenevo Llc Method and apparatus for determining geometric properties of an optical fiber preform
CN109934244A (en) * 2017-12-15 2019-06-25 京瓷办公信息系统株式会社 Format Category Learning system and image processing apparatus
CN112840640A (en) * 2018-08-09 2021-05-25 松下知识产权经营株式会社 Projection control device, projection control method, and projection control system

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007164571A (en) * 2005-12-15 2007-06-28 Toppan Printing Co Ltd Editing device, method and program
JP2007194865A (en) * 2006-01-18 2007-08-02 Casio Comput Co Ltd Image projecting device, projection image correction method and program
JP4645455B2 (en) * 2006-01-18 2011-03-09 カシオ計算機株式会社 Image projection apparatus, projection image correction method, and program
US7986831B2 (en) 2006-08-29 2011-07-26 Sony Corporation Image processing apparatus, image processing method and computer program
JP2009251902A (en) * 2008-04-04 2009-10-29 Sony Corp Imaging processing apparatus, image processing method, and imaging device
US8144241B2 (en) 2008-04-04 2012-03-27 Sony Corporation Imaging apparatus, image processing apparatus, and exposure control method
US8670616B2 (en) 2010-11-18 2014-03-11 Casio Computer Co., Ltd. Region specification method, region specification apparatus, recording medium, server, and system
US8687888B2 (en) 2010-11-18 2014-04-01 Casio Computer Co., Ltd. Region specification method, region specification apparatus, recording medium, server, and system
JP2012119798A (en) * 2010-11-30 2012-06-21 Casio Comput Co Ltd Image generation method, image generation device and program
JP2014007484A (en) * 2012-06-22 2014-01-16 Seiko Epson Corp Correction control device, correction method, and projector
JP2015007866A (en) * 2013-06-25 2015-01-15 ローランドディー.ジー.株式会社 Projection image correction system, projection image correction method, projection image correction program, and computer-readable recording medium
JP2017531167A (en) * 2014-08-08 2017-10-19 ヘレーウス テネーヴォ エルエルシーHeraeus Tenevo Llc Method and apparatus for determining geometric properties of an optical fiber preform
US10378996B2 (en) 2014-08-08 2019-08-13 Heraeus Quartz North America Llc Methods and apparatus for determining geometric properties of optical fiber preforms
JP2017111034A (en) * 2015-12-17 2017-06-22 株式会社日立ソリューションズ Terminal having camera, navigation information providing system, and navigation information display method
CN109934244A (en) * 2017-12-15 2019-06-25 京瓷办公信息系统株式会社 Format Category Learning system and image processing apparatus
CN109934244B (en) * 2017-12-15 2023-04-28 京瓷办公信息系统株式会社 Format type learning system and image processing apparatus
CN112840640A (en) * 2018-08-09 2021-05-25 松下知识产权经营株式会社 Projection control device, projection control method, and projection control system

Similar Documents

Publication Publication Date Title
JP4363151B2 (en) Imaging apparatus, image processing method thereof, and program
JP4341629B2 (en) Imaging apparatus, image processing method, and program
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
US7643701B2 (en) Imaging apparatus for correcting a distortion of an image
KR100610569B1 (en) Photographing device, image processor, image-processing method of photographing device
TWI268096B (en) Image processing apparatus for correcting distortion of image, image shooting apparatus for correcting distortion of shot image and recordable medium
JP4556813B2 (en) Image processing apparatus and program
WO2013108727A1 (en) Image-capturing device, captured image processing system, program, and recording medium
JP6426815B2 (en) Image processing apparatus and image processing method
JP2007074578A (en) Image processor, photography instrument, and program
JP2005275447A (en) Image processing device, image processing method and program
JP5541679B2 (en) Image processing apparatus and method, and program
JP4501701B2 (en) Image capturing apparatus, image processing method for image capturing apparatus, and program
JP4363154B2 (en) Imaging apparatus, image processing method thereof, and program
JP4182937B2 (en) Image capturing apparatus, image processing method for image capturing apparatus, and program
JP4375069B2 (en) Image processing apparatus, image processing method, and program
JP4600019B2 (en) Imaging apparatus, image processing method, and program
JP2005260657A (en) Photographing apparatus, image processing method and program therefor
JP2012060468A (en) Imaging apparatus, image generating apparatus, image generating program and image generating method
JP2005269449A (en) Image processor, image processing method and program
JP4561302B2 (en) Image capturing apparatus, image processing method for image capturing apparatus, and program
JP4363153B2 (en) Imaging apparatus, image processing method thereof, and program
JP4363152B2 (en) Captured image projection device, image processing method and program for captured image projection device
JP4524616B2 (en) Imaging apparatus, image processing method and program for captured image
JP2005122319A (en) Photographing device, its image processing method, and program

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

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20080805

A762 Written abandonment of application

Free format text: JAPANESE INTERMEDIATE CODE: A762

Effective date: 20081006