JP4363154B2 - Imaging apparatus, image processing method thereof, and program - Google Patents

Imaging apparatus, image processing method thereof, and program Download PDF

Info

Publication number
JP4363154B2
JP4363154B2 JP2003354429A JP2003354429A JP4363154B2 JP 4363154 B2 JP4363154 B2 JP 4363154B2 JP 2003354429 A JP2003354429 A JP 2003354429A JP 2003354429 A JP2003354429 A JP 2003354429A JP 4363154 B2 JP4363154 B2 JP 4363154B2
Authority
JP
Japan
Prior art keywords
image
photographing
shape
photographed
unit
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.)
Expired - Fee Related
Application number
JP2003354429A
Other languages
Japanese (ja)
Other versions
JP2005122328A (en
Inventor
哲司 牧野
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 JP2003354429A priority Critical patent/JP4363154B2/en
Publication of JP2005122328A publication Critical patent/JP2005122328A/en
Application granted granted Critical
Publication of JP4363154B2 publication Critical patent/JP4363154B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Description

本発明は、撮影装置、その画像処理方法及びプログラムに関するものである。   The present invention relates to a photographing apparatus, an image processing method thereof, 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. Applications are being considered in which the displayed images are 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 capture 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.

このような不具合を解消するものとして、撮影時の原稿とデジタルカメラとの相対的な位置ずれによる画像の歪みを補正する画像処理装置を備えたデジタルカメラがある(例えば、特許文献1参照)。   In order to solve such a problem, there is a digital camera provided with an image processing device that corrects image distortion due to a relative displacement between a document and a digital camera at the time of shooting (for example, see Patent Document 1).

かかるデジタルカメラでは、画像処理装置を備え、この画像処理装置は、入力された画像の上下左右の4つの部分画像を作成し、それぞれの部分画像の傾きを基に不等辺四角形を作成し、不等辺四角形の互いに対向する水平方向の2辺が平行となるようにあおり回転変換を行なう。   Such a digital camera includes an image processing device. The image processing device creates four upper, lower, left, and right partial images of the input image, creates an unequal side rectangle based on the inclination of each partial image, Rotational transformation is performed so that two opposite sides of the equilateral square are parallel to each other.

次に、画像処理装置は、水平あおり角αを求めてから互いに平行な2辺と垂直に交わる直線と垂直方向の線との角度をスキュー回転角βとして求める。画像処理装置は、残りの対向する2辺が平行となるように垂直方向にあおり回転変換することにより、垂直あおり角γを求める。そして、画像処理装置は、水平あおり角αとスキュー回転角βと垂直あおり角γを用いて、入力された画像に幾何変換を施すことにより画像の歪みを補正する。
特開2000−341501号公報(第6頁−第14頁、図1等)
Next, the image processing apparatus obtains the horizontal tilt angle α, and then obtains the angle between a straight line perpendicular to two parallel sides and a vertical line as the skew rotation angle β. The image processing apparatus obtains the vertical tilt angle γ by rotating in the vertical direction so that the remaining two opposite sides are parallel to each other. The image processing apparatus corrects image distortion by performing geometric transformation on the input image using the horizontal tilt angle α, the skew rotation angle β, and the vertical tilt angle γ.
Japanese Unexamined Patent Publication No. 2000-341501 (pages 6 to 14, FIG. 1 etc.)

しかし、かかる従来のデジタルカメラでは、多くの回転変換処理を行わなければならず、演算数が多くなり、処理に時間がかかる。また、処理時間を低減しようとすると、高価な演算装置を必要になってくる。   However, in such a conventional digital camera, many rotation conversion processes must be performed, the number of operations increases, and the process takes time. In addition, an expensive arithmetic unit is required to reduce the processing time.

本発明は、上記問題点に鑑みてなされたもので、撮影対象物の画像の補正を高速化することが可能な撮影装置、その画像処理方法及びプログラムを提供することを目的とする。   The present invention has been made in view of the above problems, and an object of the present invention is to provide a photographing apparatus capable of speeding up correction of an image of a photographing target, an image processing method thereof, and a program.

この目的を達成するため、本発明の第1の観点に係る撮影装置は、
撮影部により撮影対象物を撮影する撮影装置において、
撮影によって得られた前記撮影対象物の画像の歪みを補正するように、前記撮影画像に対して画像処理を行う画像処理部を備え、
前記画像処理部は、
前記撮影対象物の画像の画素を選択することによってデータ量を低減させた縮小画像を生成し、前記選択した画素に対して前記撮影対象物の画像の歪曲補正を行い、生成した縮小画像から前記撮影対象物の画像のエッジ画像を生成し、生成したエッジ画像から、前記撮影対象物の画像の形状を取得する形状取得部と、
前記形状取得部が取得した前記画像の形状と実際の撮影対象物の形状とを3次元の座標系を設定することで対応させて、前記撮影対象物の画像の頂点位置から、前記画像と実際の撮影対象物との関係を示す射影パラメータを求める射影パラメータ取得部と、
前記撮影部が有するレンズの焦点距離と前記撮影対象物の画像の頂点位置とに基づいて前記撮影対象物の縦横比を求める縦横比取得部と、
前記射影パラメータ取得部が求めた射影パラメータと前記縦横比取得部が求めた縦横比とを用いて前記撮影対象物の画像の画像変換を行う画像変換部と、を備えたことを特徴とする。
In order to achieve this object, an imaging device according to the first aspect of the present invention provides:
In a photographing device that photographs a photographing object by a photographing unit,
An image processing unit that performs image processing on the photographed image so as to correct distortion of the image of the photographing object obtained by photographing;
The image processing unit
A reduced image with a reduced amount of data is generated by selecting pixels of the image of the photographing object, distortion correction of the image of the photographing object is performed on the selected pixels, and the reduced image is generated from the generated reduced image. A shape acquisition unit that generates an edge image of the image of the shooting target and acquires the shape of the image of the shooting target from the generated edge image;
The shape of the image acquired by the shape acquisition unit and the actual shape of the object to be photographed are associated with each other by setting a three-dimensional coordinate system. A projection parameter obtaining unit for obtaining a projection parameter indicating a relationship with the object to be imaged,
An aspect ratio acquisition unit for obtaining an aspect ratio of the photographing object based on a focal length of a lens included in the photographing unit and a vertex position of an image of the photographing object;
An image conversion unit that performs image conversion of the image of the object to be photographed using the projection parameter obtained by the projection parameter acquisition unit and the aspect ratio obtained by the aspect ratio acquisition unit.

前記形状取得部は、
前記撮影対象物の画像の縮小画像を生成する画素を選択し、前記選択した画素を調査対象として前記撮影対象物の画像の歪曲補正を行って前記撮影対象物の画像のエッジ画像を生成するエッジ画像生成部と、
前記エッジ画像生成部が生成したエッジ画像から、前記エッジ画像を形成する直線を取得する直線取得部と、
前記直線取得部が取得した直線によって前記撮影対象物の画像の形状の候補を生成する形状候補生成部と、
前記形状候補生成部が生成した前記撮影対象物の画像の形状の候補から、前記撮影対象物の画像の形状を選択する形状選択部と、を備えてもよい。
The shape acquisition unit
An edge that selects a pixel that generates a reduced image of the image of the shooting object, and performs an edge correction of the image of the shooting object by performing distortion correction on the image of the shooting object using the selected pixel as an investigation target. An image generator;
A straight line acquisition unit that acquires a straight line forming the edge image from the edge image generated by the edge image generation unit;
A shape candidate generation unit that generates a shape candidate of the image of the object to be photographed by the straight line acquired by the straight line acquisition unit;
A shape selection unit that selects a shape of the image of the shooting target from a shape candidate of the image of the shooting target generated by the shape candidate generation unit.

前記直線取得部は、前記エッジ画像生成部が生成したエッジ画像から取得した直線の長さを求め、求めた前記直線の長さに基づいて、前記撮影対象物の画像の形状を形成する直線を選択して取得してもよい。   The straight line acquisition unit obtains the length of the straight line obtained from the edge image generated by the edge image generation unit, and based on the obtained straight line length, forms a straight line that forms the shape of the image of the photographing object. You may select and acquire.

前記直線取得部は、前記エッジ画像生成部が生成したエッジ画像から取得した直線の角度を求め、求めた角度に基づいて、前記撮影対象物の画像の形状を形成する直線を選択して取得してもよい。   The straight line acquisition unit obtains an angle of a straight line obtained from the edge image generated by the edge image generation unit, and selects and obtains a straight line that forms the shape of the image of the photographing object based on the obtained angle. May be.

前記形状選択部は、前記形状候補生成部が生成した前記撮影対象物の画像の形状の候補のうち、前記形状で囲まれた画像領域のサイズが最大となるものを選択して、選択したものを前記撮影対象物の画像の形状として取得してもよい。   The shape selection unit selects and selects the image of the object to be imaged generated by the shape candidate generation unit that has the largest image area size surrounded by the shape. May be acquired as the shape of the image of the object to be photographed.

前記撮影対象物の画像データを記憶する記憶部を備えてもよい。   You may provide the memory | storage part which memorize | stores the image data of the said imaging | photography target object.

本発明の第2の観点に係る撮影装置の画像処理方法は、
撮影部により撮影対象物を撮影することによって得られた前記撮影対象物の画像の歪みを補正するように、前記撮影対象物の画像に対して画像処理を行う撮影装置の画像処理方法であって、
前記撮影対象物の画像の画素を選択することによってデータ量を低減させた縮小画像を生成し、前記選択した画素に対して前記撮影対象物の画像の歪曲補正を行うステップと、
生成した縮小画像から前記撮影対象物の画像のエッジ画像を生成するステップと、
生成したエッジ画像から、前記撮影対象物の画像の形状を取得するステップと、
前記撮影対象物の形状と前記形状取得部が取得した前記撮影対象物の画像の形状とを3次元の座標系を設定することで対応させて、前記撮影対象物の画像の頂点位置から、前記画像と前記撮影対象物との関係を示す射影パラメータを求めるステップと、
前記撮影部が有するレンズの焦点距離と前記撮影対象物の画像の頂点位置とに基づいて前記撮影対象物の縦横比を求めるステップと、
求めた射影パラメータと縦横比とを用いて前記撮影対象物の画像の画像変換を行うステップと、を備えたことを特徴とする。
An image processing method of the photographing apparatus according to the second aspect of the present invention is as follows.
An image processing method of a photographing apparatus that performs image processing on an image of the photographing target so as to correct distortion of the image of the photographing target obtained by photographing the photographing target by a photographing unit. ,
Generating a reduced image with a reduced amount of data by selecting pixels of the image of the shooting object, and correcting distortion of the image of the shooting object for the selected pixels;
Generating an edge image of the image of the object to be photographed from the generated reduced image;
Obtaining the shape of the image of the object to be photographed from the generated edge image;
The shape of the object to be photographed and the shape of the image of the object to be photographed acquired by the shape acquisition unit are associated with each other by setting a three-dimensional coordinate system, and from the vertex position of the image of the object to be photographed, Obtaining a projection parameter indicating a relationship between an image and the object to be photographed;
Obtaining an aspect ratio of the photographing object based on a focal length of a lens included in the photographing unit and a vertex position of an image of the photographing object;
Performing image conversion of the image of the object to be photographed using the obtained projection parameters and aspect ratio.

本発明の第3の観点に係るプログラムは、
撮影部により撮影対象物を撮影する撮影装置が有するコンピュータに、
前記撮影対象物の画像の画素を選択することによってデータ量を低減させた縮小画像を生成し、前記選択した画素に対して前記撮影対象物の画像の歪曲補正を行う手順、
生成した縮小画像から前記撮影対象物の画像のエッジ画像を生成する手順、
生成したエッジ画像から、前記撮影対象物の画像の形状を取得する手順、
前記撮影対象物の形状と前記形状取得部が取得した前記撮影対象物の画像の形状とを3次元の座標系を設定することで対応させて、前記撮影対象物の画像の頂点位置から、前記画像と前記撮影対象物との関係を示す射影パラメータを求める手順、
前記撮影部が有するレンズの焦点距離と前記撮影対象物の画像の頂点位置とに基づいて前記撮影対象物の縦横比を求める手順、
求めた射影パラメータと縦横比とを用いて前記撮影対象物の画像の画像変換を行う手順、
を実行させるためのものである。
The program according to the third aspect of the present invention is:
In the computer of the photographing device that photographs the object to be photographed by the photographing unit,
A procedure for generating a reduced image with a reduced amount of data by selecting pixels of the image of the shooting object, and correcting distortion of the image of the shooting object for the selected pixel;
A procedure for generating an edge image of the image of the object to be photographed from the generated reduced image;
A procedure for acquiring the shape of the image of the photographing object from the generated edge image,
The shape of the object to be photographed and the shape of the image of the object to be photographed acquired by the shape acquisition unit are associated with each other by setting a three-dimensional coordinate system, and from the vertex position of the image of the object to be photographed, A procedure for obtaining a projection parameter indicating a relationship between an image and the object to be imaged;
A procedure for obtaining an aspect ratio of the photographing object based on a focal length of a lens of the photographing unit and a vertex position of an image of the photographing object;
A procedure for performing image conversion of the image of the object to be photographed using the obtained projection parameters and aspect ratio;
Is to execute.

本発明によれば、撮影対象物の画像を補正する処理を高速化することができる。   According to the present invention, it is possible to speed up the process of correcting an image of a photographing object.

以下、本発明の実施の形態に係る撮影装置を図面を参照して説明する。
尚、実施形態では、撮影装置をデジタルカメラとして説明する。
Hereinafter, a photographing apparatus 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 captures characters such as a white board 2, a figure, a photograph, and the like as an object to be photographed, detects and corrects image distortion from an image obtained by photographing, and is as if from the front. It generates an image as if it was taken. 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 keys and switches, 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 reduction key 115, and a left reduction 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 object. 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は、外部記憶IO装置28を介してメモリカード31に、プレビュー画像、高解像度の画像のデータを記録したり、メモリカード31から、記録された画像データを読み出したりする。CPU30は、メモリカード31には、例えば、JPEGフォーマットで圧縮した画像データを記録する。   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 example, the CPU 30 records image data compressed in the JPEG format in the memory card 31.

CPU30は、メモリ23に画像データを一時記憶する際、プレビュー画像、高解像度の画像データを異なる記憶領域に記録する。また、CPU30は、メモリカード31には、画像データを画像ファイルに分けて記録し、記録する際、画像データに関するヘッダ情報も画像ファイルのヘッダ情報記憶領域に記録する   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. Further, the CPU 30 records the image data separately in the image file in the memory card 31, and also records the header information regarding the image data in the header information storage area of the image file.

次に本実施形態に係るデジタルカメラ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)。   The image processing device 25 records the created compressed data on the memory card 31 (step S26).

一方、射影パラメータを抽出することができなかったと判定した場合(ステップ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によって関係付けられることになる。射影変換もこのアフィン変換により行われることができる。
最終的な座標(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 to each other by the following equation (1) by conversion such as movement, enlargement / reduction, and rotation. 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 as vectors 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 of the object 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) of the object to be photographed is connected to the origin by a straight line, and there is a point that intersects the straight line and the projection screen, and the XY coordinate of the intersection is p (x, y ). 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の値との関係は、数4から、次の数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 4.

カメラパラメータであるレンズの焦点距離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 as the object to be imaged. An aspect 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 image of the photographed subject (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は、撮影した撮影対象物の画像から、この撮影対象物の画像の4すみの座標点(四角形輪郭)を抽出する(ステップS31)。画像処理装置25は、図9のフローチャートに示す処理を行い、四角形の輪郭を抽出する。   The image processing device 25 extracts four corner coordinate points (rectangular contours) of the image of the imaged object from the imaged object (step S31). The image processing device 25 performs the process shown in the flowchart of FIG. 9 and extracts a quadrilateral outline.

即ち、画像処理装置25は、画像処理の演算数を減らすため、入力画像から縮小輝度画像を生成する(ステップS41)。
画像処理装置25は、生成した縮小輝度画像から、直線のみの画像を生成し、これを撮影対象物のエッジ画像とする(ステップS42)。
画像処理装置25は、エッジ画像に歪曲収差補正を加える(ステップS43)。
That is, the image processing device 25 generates a reduced luminance image from the input image in order to reduce the number of operations for image processing (step S41).
The image processing device 25 generates an image of only a straight line from the generated reduced luminance image, and sets this as an edge image of the photographing object (step S42).
The image processing device 25 adds distortion correction to the edge image (step S43).

画像処理装置25は、撮影対象物のエッジ画像から、このエッジ画像に含まれる直線パラメータを検出する(ステップS44)。
画像処理装置25は、検出した直線パラメータから、撮影対象物の輪郭を形成する候補となる四角形を作成する(ステップS45)。
The image processing device 25 detects a straight line parameter included in the edge image from the edge image of the photographing object (step S44).
The image processing device 25 creates a quadrangle that is a candidate for forming the contour of the object to be photographed from the detected straight line parameters (step S45).

画像処理装置25は、このように候補となる四角形を生成し、生成した各四角形に優先順位を付す(図8のステップS32)。
画像処理装置25は、優先順位に従って四角形を選択し、選択した四角形を抽出できたか否かを判定する(ステップS33)。
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)に示す。画像処理装置25は、このような縮小輝度画像から、Robertsフィルタと呼ばれるエッジ検出用のフィルタを用いて図10(b)に示すようなエッジ画像を生成する(ステップS42)。このRobertsフィルタとは、2つの4近傍画素の重み付けを行って2つのフィルタΔ1、Δ2を取得して平均化することによって、画像のエッジを検出するフィルタである。
Next, the projection parameter extraction process will be described more specifically.
An example of the reduced luminance image generated by the image processing device 25 in step S41 is shown in FIG. The image processing device 25 generates an edge image as shown in FIG. 10B from such a reduced luminance image 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.

図11(a)は、フィルタΔ1の係数を示し、図11(b)は、フィルタΔ2の係数を示す。この2つのフィルタΔ1,Δ2の係数を、ある着目した座標(x,y)の画素値f(x,y)に適用すると、変換後の画素値g(x,y)は、次の数12によって表される。
11A shows the coefficient of the filter Δ1, and FIG. 11B shows the coefficient 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

ステップS42で生成したエッジ画像において、歪曲収差により直線が抽出できない場合がある。そこで、画像処理装置25は、エッジ画像に対して歪曲収差補正を行う(ステップS43の処理)。元画像ではなくエッジ画像に対して歪曲補正を行うのは、処理の高速化のためである。歪曲補正計算は、調査対象の画素が歪曲補正後には元画像中のどの画素になるかを画素ごとに計算するものである。その際、エッジ画像であれば、調査対象は一定間隔でスキップした座標のみとなり、画素が少ない分、高速に処理を行うことができる。   In the edge image generated in step S42, a straight line may not be extracted due to distortion. Therefore, the image processing device 25 performs distortion correction on the edge image (step S43). The reason for performing distortion correction not on the original image but on the edge image is to increase the processing speed. The distortion correction calculation is to calculate for each pixel which pixel in the original image becomes the pixel to be examined after distortion correction. At that time, in the case of an edge image, only the coordinates skipped at a constant interval are investigated, and processing can be performed at a high speed because there are few pixels.

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

ハフ変換は、X−Y平面上の直線を構成する点を次の数13によって定義されるρ−θ平面に投票する変換である。
The Hough transform is a transform that votes points constituting a straight line on the XY plane to the ρ-θ plane defined by the following equation (13).

各点の座標(x、y)においてθを0から360°まで変化させた場合、同一直線はρ−θ平面上では一点で表される。このため、投票数の多いρ−θ座標を直線と判定することができる。その際、投票数は直線上のピクセル数であり、直線の長さに相当する。したがって、投票数の極端に少ないρ−θ、即ち短い直線は、直線の候補から除外することができる。   When θ is changed from 0 to 360 ° in the coordinates (x, y) of each point, the same straight line is represented by one point on the ρ-θ plane. For this reason, it is possible to determine a ρ-θ coordinate having a large number of votes as a straight line. At that time, the number of votes is the number of pixels on a straight line, which corresponds to the length of the straight line. Therefore, ρ−θ having an extremely small number of votes, that is, a short straight line can be excluded from the straight line candidates.

このようにハフ変換を用いる手法では、調査対象の点や角度が多ければ多いほど処理速度が低下してしまう。この処理速度の低下を回避するため、エッジ検出時に調査対象の座標をX、Y軸方向双方に一定の間隔でとばして処理することによって、エッジ画像を縮小する。これにより、調査対象を減らすことができる。   Thus, in the method using the Hough transform, the processing speed decreases as the number of points or angles to be investigated increases. In order to avoid this decrease in processing speed, the edge image is reduced by processing the coordinates of the investigation target at a constant interval in both the X and Y axis directions at the time of edge detection. As a result, the number of survey targets can be reduced.

さらに、別の方法で調査角度を減らすことができる。
即ち、調査対象であるエッジ画像において画像中心を原点とした座標系で考えると、ρはマイナスの値も取ることになるため、角度0≦θ<180°を測定すればよく、残りの180°≦θ<360°はρがマイナスの値を取ることで表現できる。
Furthermore, the investigation angle can be reduced in another way.
That is, when considering the coordinate system with the center of the image as the origin in the edge image to be examined, ρ also takes a negative value, so it is sufficient to measure the angle 0 ≦ θ <180 ° and the remaining 180 °. ≦ θ <360 ° can be expressed by taking a negative value of ρ.

しかし実際に撮影される四角形は、その四角形が画像の中心にあった場合、各辺が上下左右に存在することになる。したがって、0°≦θ<180°の範囲で調査するより、図12(a)及び12(b)に示すように、上下の辺、左右の辺はそれぞれ次の数14で表される範囲で測定した方が、より効果的である。
However, when a square is actually captured, each side exists vertically and horizontally when the square is at the center of the image. Therefore, by investigating in the range of 0 ° ≦ θ <180 °, as shown in FIGS. 12A and 12B, the upper and lower sides and the left and right sides are within the range represented by the following formula 14, respectively. The measurement is more effective.

また、数14から明らかなように、45°≦θ<135°のcosθと135°≦θ<225°のsinθ、45°≦θ<135°のsinθと135°≦θ<225°のcosθにマイナスをかけたもの、がそれぞれ対応しているため、sinテーブルとcosテーブルとを共用することが可能である。   As is clear from Equation 14, cos θ of 45 ° ≦ θ <135 °, sin θ of 135 ° ≦ θ <225 °, sin θ of 45 ° ≦ θ <135 °, and cos θ of 135 ° ≦ θ <225 ° Since the minus numbers correspond to each other, the sin table and the cos table can be shared.

また、図13(a)に45°≦θ<135°で検出される直線を太線で、図13(b)に135°≦θ<225°で検出された直線を太線で示すように、ρが+の値か−の値かによって、辺の上下、または辺の左右を特定することが可能である。したがって、より効率的に、中心の四角形を構成する辺を選択することができる。   In addition, a straight line detected at 45 ° ≦ θ <135 ° in FIG. 13A is indicated by a thick line, and a straight line detected at 135 ° ≦ θ <225 ° is indicated by a thick line in FIG. Depending on whether is a positive value or a negative value, it is possible to specify the upper and lower sides or the left and right sides. Therefore, it is possible to select the sides constituting the central square more efficiently.

このような考え方に基づいて、画像処理装置25は、直線を検出し、四角形を特定する。尚、この四角形特定処理は、書画撮影のように、撮影対象物を真上から撮影する場合と、撮影対象物に対してデジタルカメラ1を傾けて撮影する場合とで異なるものとなる。まず、撮影対象物を真上から撮影する場合における処理を、図14に示すフローチャートに従って説明する。   Based on such a concept, the image processing device 25 detects a straight line and identifies a quadrangle. Note that this quadrangle specifying process is different between when shooting an object to be shot from directly above as in document shooting and when shooting with the digital camera 1 tilted with respect to the object to be shot. First, processing in the case of photographing an object to be photographed from directly above will be described according to the flowchart shown in FIG.

画像処理装置25は、ハフ変換を用いて、X−Y平面からρ−θ平面への投票を行う(ステップS51)。そして、画像理装置25は、45°≦θ<135°における投票が多い座標を、上下の辺を形成する直線の候補として複数取得する(ステップS52)。同様に、画像処理装置25は、135°≦θ<225°における投票が多い座標を、左右の辺を形成する直線の候補として複数取得する(ステップS53)。   The image processing device 25 uses the Hough transform to vote from the XY plane to the ρ-θ plane (step S51). Then, the image processing apparatus 25 acquires a plurality of coordinates having a large number of votes in 45 ° ≦ θ <135 ° as candidates for straight lines forming the upper and lower sides (step S52). Similarly, the image processing apparatus 25 acquires a plurality of coordinates having a large number of votes when 135 ° ≦ θ <225 ° as candidates for straight lines forming the left and right sides (step S53).

画像処理装置25は、X軸方向の候補、Y軸方向の候補のうち、ρの値の+−が異なり、θが同じものを選択する(ステップS54)。これは、撮影対象物を真上から撮影する場合、撮影対象物が大きく歪む心配がなく、その相対する辺が平行で直交する辺は垂直であると見なせるためである。さらに、直交する別方向の直線のうち、平行な2本が存在すれば、図15(a)に示すように、四角形(長方形)が特定されるからである。   The image processing apparatus 25 selects an X-axis direction candidate and a Y-axis direction candidate that have different values of ρ and the same θ (step S54). This is because, when the object to be imaged is photographed from directly above, the object to be imaged does not have to be greatly distorted, and the opposite sides are parallel and can be regarded as perpendicular. Furthermore, if there are two parallel straight lines in different directions perpendicular to each other, a quadrangle (rectangle) is specified as shown in FIG.

画像処理装置25は、X軸方向の候補とY軸方向の候補とから、既存の用紙の縦横比に近い比率となる組み合わせを選択する(ステップS55)。具体的には、まず、画像処理装置25は、数14で表される直線をy=ax+bに置き換えて、直交するxy座標を算出する。これにより2点間の距離が判明する。また、既にどの辺がx軸方向でどの辺がy軸方向なのかが特定されているため、撮影対象の縦横比が容易に判明する。画像処理装置25は、以上の処理を実行することにより、用紙サイズ(縦横比率)に当てはまる四角形を、撮影四角形であると特定する。   The image processing apparatus 25 selects a combination having a ratio close to the aspect ratio of the existing paper from the X-axis direction candidates and the Y-axis direction candidates (step S55). Specifically, first, the image processing device 25 replaces the straight line expressed by Equation 14 with y = ax + b and calculates orthogonal xy coordinates. This reveals the distance between the two points. Further, since which side is already specified in the x-axis direction and which side is in the y-axis direction, the aspect ratio of the subject to be imaged can be easily determined. By executing the above processing, the image processing device 25 identifies a quadrangle that matches the paper size (vertical / horizontal ratio) as a photographing quadrangle.

次に、撮影対象物に対してデジタルカメラ1を傾けて撮影する場合における処理を、図16に従って説明する。尚、ステップS61〜S63までの処理は、撮影対象物を真上から撮影する場合(図14)のステップS51〜S53までの処理と同様であるため、ここでの説明は省略する。   Next, processing when the digital camera 1 is tilted with respect to the object to be imaged will be described with reference to FIG. Note that the processing from step S61 to S63 is the same as the processing from step S51 to S53 in the case where the object to be photographed is photographed from directly above (FIG. 14), and therefore description thereof is omitted here.

画像処理装置25は、X軸方向の候補、Y軸方向の候補のうち、ρの絶対値|ρ|が等しいもの同士を特定し、その絶対値が大きいものから順に優先度を設定する(ステップS64)。これは、撮影対象物を斜めから撮影する場合に、相対する辺が平行とは限らないためである。上下左右の辺を|ρ|の絶対値の大きなもの同士に特定することで、図15(b)に太線で示すような、面積が最大である領域を特定するための直線の優先順位を得ることができる。   The image processing device 25 identifies candidates having the same absolute value | ρ | of ρ among candidates in the X-axis direction and candidates in the Y-axis direction, and sets priorities in descending order of the absolute values (steps). S64). This is because the opposite sides are not always parallel when the object to be photographed is photographed from an oblique direction. By specifying the top, bottom, left, and right sides to have a large absolute value of | ρ |, a straight line priority order for specifying a region having the maximum area as shown by a thick line in FIG. 15B is obtained. be able to.

画像処理装置25は、前述した最大領域を構成する四角形を、撮影四角形として特定する(ステップS65)。   The image processing device 25 identifies the quadrangle that constitutes the above-described maximum area as a photographing quadrangle (step S65).

このようにして、選択された撮影対象物の四角形の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 quadrangle of the selected photographing object, According to Equation 8, affine parameters that are each element in the matrix shown in Equation 8 can be obtained.

(1)撮影対象画像からのアフィンパラメータ抽出
このような考え方に基づいて、画像処理装置25は、四角形の頂点からアフィンパラメータを取得する。この処理を、図17に示すフローチャートに基づいて説明する。
(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に従って、射影係数α、βを算出する(ステップS71)。   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 S71).

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

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

vmax/umax>kの場合(ステップS74においてYes)、縦横比kを変えないものとして、画像処理装置25は、V軸側(縦)の最大画像サイズvmaxの方が撮影対象物の画像サイズよりも大きいと判定する。そして、画像処理装置25は、U軸側の最大画像サイズと撮影対象物の画像サイズとが一致するように、数11の条件(2)に従ってm,nの値を求める(ステップS76)。   When vmax / umax> k (Yes in step S74), 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 of the object to be photographed. Is also determined 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 object to be photographed (step S76).

画像処理装置25は、算出したm、nと四角形の4点の頂点座標(x0,y0),(x1,y1),(x2,y2),(x3,y3)から、数8に従って、アフィン変換行列Afを求める(ステップS77)。
画像処理装置25は、このアフィン変換行列Afの各要素をアフィンパラメータAとして、このアフィンパラメータAを取得する(ステップS78)。
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 S77).
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 S78).

尚、四角形が認識できないような場合(図8のステップS33においてNo)のように、画像撮影条件等が不適であり、射影パラメータが得られない場合がある。このような場合、図18(a)に示すような警告文を、液晶モニタ12に表示させ、撮影者に領域が検出できなかったことを適切に警告し、撮影者に、図18(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. 18A 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 condition to the camera shooting setting mode as shown in FIG. Furthermore, it may be preferable to warn again to change the shooting conditions.

CPU30は、このように適正な射影パラメータが得られなかった場合、図19に示すフローチャートに従って、警告処理を行う(図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. 19 (step S27 in FIG. 5).

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

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

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

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

(2)抽出したアフィンパラメータによる画像変換
次に、得られたアフィンパラメータを用いて補正画像を作成する画像処理方法について説明する。
まず、アフィンパラメータを用いて射影変換や他のアフィン変換を行なう場合、図20に示すように、元の画像の点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. 20, 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は、図21に示すフローチャートの処理を実行する。
画像処理装置25は、変換画像の画素位置uを0に初期化する(ステップS91)。
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 S91).

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

画像処理装置25は、求めた画素位置(x,y)から、数15に従って、バイリニア法により画素値P(u,v)を求める(ステップS94)。
画像処理装置25は、補正後画像の座標vを1つだけインクリメントする(ステップS95)。
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 S94).
The image processing device 25 increments the corrected image coordinate v by one (step S95).

画像処理装置25は、補正後画像の座標vと座標vの最大値vmaxとを比較して、補正後画像の座標vが最大値vmax以上になったか否かを判定する(ステップS96)。   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 S96).

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

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

画像処理装置25は、座標uと座標uの最大値umaxとを比較し、座標uが最大値umax以上になったか否かを判定する(ステップS98)。
座標uが最大値umax未満であると判定した場合(ステップS98においてNo)、画像処理装置25は、再度、ステップS92〜S97の処理を実行する。
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 S98).
When it is determined that the coordinate u is less than the maximum value umax (No in step S98), the image processing device 25 executes the processes of steps S92 to S97 again.

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

(3)画像変換の調整
次に、一度画像変換を行った画像に対して行われる調整(図5のステップS22)について説明する。
抽出された四角形の頂点の座標に若干の誤差等が含まれているような場合、図22(a)に示すように、得られたアフィンパラメータで射影した結果が好ましくない場合がある。このため、本実施形態のデジタルカメラ1は、一度画像変換した画像に対して調整を行い、図22(b)に示すような画像を得るために、ユーザによって射影変換の調整を行えるように構成されている。
(3) Image Conversion Adjustment Next, adjustment (step S22 in FIG. 5) performed on an image that has been once converted will be described.
In the case where some errors are included in the coordinates of the extracted quadrangular vertices, as shown in FIG. 22A, the result of projection with the obtained affine parameters may not be preferable. For this reason, the digital camera 1 of 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.

尚、図23に示すように、補正画像の補間画素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. 23, when the interpolation pixel Q (u ′, v ′) of the corrected image is obtained, an 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). When performing two-stage image conversion, such as projection 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 of 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.

このような考え方に基づいて実行される画像変換の調整処理を、図24に示すフローチャートに基づいて説明する。
CPU30は、画像の中心座標Xc,Ycを設定する(ステップS101)。
CPU30は、操作部26から送信された操作情報に基づいて射影変換キーが押下されたか否かを判定する(ステップ102)。
射影変換キーが押下されたと判定した場合(ステップS102においてYes)、CPU30は、射影変換キーとして、上縮小キー111、下縮小キー112、右縮小キー113、左縮小キー114のうちの押下されたキーの種別を判別する(ステップS103〜S106)。
Image conversion adjustment processing 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 S101).
The CPU 30 determines whether or not the projection conversion key has been pressed based on the operation information transmitted from the operation unit 26 (step 102).
If it is determined that the projection conversion key has been pressed (Yes in step S102), 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 S103 to S106).

押下された射影変換キーが上縮小キー111であると判別した場合、CPU30は、数19に示す射影効果行列Apに、α=0.1、β=0をそれぞれ代入して、逆変換行列Ai=Apを取得する(ステップS103)。   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 S103).

押下された射影変換キーが下縮小キー112であると判別した場合、CPU30は、数19に示す射影効果行列Apに、α=-0.1,β=0をそれぞれ代入して、逆変換行列Ai=Apを取得する(ステップS104)。   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 S104).

押下された射影変換キーが右回転キー113であると判別した場合、CPU30は、数19に示す射影効果行列Apに、α=0,β=0.1をそれぞれ代入して、逆変換行列Ai=Apを取得する(ステップS105)。   When it is determined that the pressed projective transformation key is the right rotation 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 S105).

押下された射影変換キーが左回転キー114であると判別した場合、CPU30は、数19に示す射影効果行列Apに、α=0,β=-0.1をそれぞれ代入して、逆変換行列Ai=Apを取得する(ステップS106)。   When determining that the pressed projective transformation key is the left rotation 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 S106).

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

押下された回転補正キーが右回転キー115であると判別した場合、CPU30は、数16に示す回転逆変換行列Arに、θ=−1を代入して、逆変換行列Ai=Arを取得する(ステップ108)。   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 Ai = Ar. (Step 108).

押下された回転補正キーが左回転キー116であると判別した場合、CPU30は、数16に示す回転逆変換行列Arに、θ=1を代入して、逆変換行列Ai=Arを取得する(ステップ109)。   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 109).

また、射影変換キー又は回転補正キーが押下されたと判定して、逆変換行列Aiを設定した場合(ステップS103〜S106,S108,S109)、CPU30は、数20に従って、逆変換行列Aを求める(ステップS110)。   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 S103 to S106, S108, S109), the CPU 30 obtains the inverse transformation matrix A according to Equation 20 ( Step S110).

CPU30は、求めた変換行列Aを画像処理装置25に供給し、逆変換行列Aに基づいて画像変換を行うように画像処理装置25を制御する。画像処理装置25は、供給された逆変換行列Aに基づいて、アフィン変換による画像変換を行い(ステップS111)、この画像変換の調整処理を終了させる。
一方、回転補正キーが押下されていないと判定した場合(ステップS107において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 S111), 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 S107), the CPU 30 ends the image conversion adjustment process 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.

例えば、図22に示すような画像を調整する場合、画像が左方向に歪んでいるので、まず右回転キー115を押下すると、画像処理装置25は、画像を右回転させる。このまま、右回転キー115が押下されて、文字列が正しく表示されたときに右回転キー115の押下が停止すると、画像処理装置25は、画像の右回転を停止させる。   For example, when adjusting an image as shown in FIG. 22, 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.

(4)輝度あるいは色差等に関する画像効果補正用パラメータの抽出及び画像効果処理
次に、このように得られた画像から、画像効果補正用パラメータを抽出する処理と、このパラメータを用いて行う画像効果処理と、について説明する。画像効果処理は、より鮮明な画像を得るための処理である。
(4) 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)の分布を示すものであり、輝度値毎に画素の数を計数することにより生成される。図25に輝度ヒストグラムの一例を示す。図25において、横軸は、輝度値(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. 25 shows an example of a luminance histogram. In FIG. 25, 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 of the photographing object.

尚、画像効果を補正して視認性に優れた画像を得るには、撮影対象物の背景色によって補正効果が異なってくるため、画像効果の補正方法を撮影対象物の背景色によって変える必要がある。このため、撮影対象物の背景色の判別が必要になってくる。撮影対象物の背景色は、輝度ヒストグラム、色差ヒストグラムの各ピーク値から判別される。   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 object to be imaged. Therefore, it is necessary to change the image effect correction method depending on the background color of the object to be imaged. is there. For this reason, it is necessary to determine the background color of the object to be photographed. The background color of the object 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 of the photographing object 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 photographing target is determined to be white (W).
(2-b) Black Determination Condition The black determination condition is represented 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に、黒判定閾値は、例えば、50に設定される。   If the conditions shown in Equations 21 and 22 are not satisfied, the background color of the object to be photographed is determined to be color (C). For example, the color threshold is set to 50, the white determination threshold is set to 128, and the black determination threshold is set to 50, for example.

このような考え方に基づいて、画像処理装置25は、図26に示すフローチャートに従って画像効果補正用パラメータの抽出処理を実行する。
画像処理装置25は、各輝度(Y)値を有する画素の数を計数して、図25に示すような輝度ヒストグラムを生成する(ステップS121)。
Based on such a concept, 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. 25 (step S121).

画像処理装置25は、生成した輝度ヒストグラムから、輝度の最大値(Ymax)、最小値(Ymin)、ピーク値(Ypeak)を取得する(ステップS122)。   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 S122).

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

次に、画像処理装置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.

ホワイトボード、ノート等のように、背景色が白である場合、図27(a)に示すような輝度変換を行う。黒板等のように、背景色が黒である場合、図27(b)に示すような輝度変換を行う。雑誌、パンフレット等のように、背景色が白または黒以外である場合、図27(c)に示すような変換を行う。尚、図27(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. When the background color is other than white or black, such as a magazine or pamphlet, the conversion shown in FIG. 27C is performed. In FIGS. 27A, 27B, and 27C, the horizontal axis indicates the input value of the pixel value, and the vertical axis indicates the output value of the pixel value.

背景色が白である場合、図27(a)に示すように、ピーク値を境にして、輝度変換線の傾斜角度を変える。所定輝度値を、例えば、230として、入力された輝度のピーク値を輝度値230まで引き上げる。そして、最大値を、最大輝度まで持ち上げる。従って、輝度変換線は、図27(a)に示すように、2つの線分によって表される。   When the background color is white, as shown in FIG. 27A, 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.

背景色が黒である場合、図27(b)に示すように、ピーク値をある一定の輝度値(20)になるように輝度変換を行う。この場合も、図27(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. 27B, the luminance conversion line is represented by two line segments.

背景色が白または黒以外の色である場合、図27(c)に示すように、通常の引き伸ばし処理と同様に、最小値以下と最大値以上をカットし、1つの線分として表されるように輝度変換線を設定する。   When the background color is a color other than white or black, as shown in FIG. 27C, 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は、図28に示すフローチャートに従って、画像効果処理を実行する。
画像処理装置25は、保存した画像効果補正用パラメータをメモリ23から読み出す(ステップS131)。
Based on such a concept, the image processing device 25 executes image effect processing according to the flowchart shown in FIG.
The image processing device 25 reads the stored image effect correction parameters from the memory 23 (step S131).

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

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

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

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

本実施形態のデジタルカメラ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は、この操作情報に基づいて、モードが再生モードになったことを判別すると、図29に示すフローチャートに従って、再生処理を実行する。
CPU30は、メモリカード31内に記録されている画像ファイルの中から、ユーザに選択された一枚の画像を選択する(ステップS141)。
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 S141).

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

CPU30は、メモリ23上のプレビュー画像用の記憶領域に書き込む(ステップS144)。これにより撮影モード時と同じように、この縮小画像が表示装置24から表示される。ユーザはこの表示を見ることで、再生画像を確認することができる。   The CPU 30 writes in the preview image storage area on the memory 23 (step S144). 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は、この操作情報に従って、次の画像が指定されたか否かを判定する(ステップS145)。
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 S145).

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

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

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

ヘッダ情報は、図30に示すように、データの種類(データ名)と、それぞれのデータのバイト数と、その内容と、を含む。
CPU30は、このヘッダ情報を、ヘッダ情報記憶領域に順次、元画像データの画像ファイル名、補正画像の画像サイズ、アフィンパラメータ、ヒストグラムテーブルを作成するための入出力のデータセットを記憶する。
As shown in FIG. 30, 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).

例えば、入力データと出力データとの関係が、図27(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. 27A, 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.

同様に、入出力データの関係が、図27(b)に示すような関係である場合、CPU30は、(0,0),(最小値,0),(ピーク値,一定輝度値(=20)),(最大値,255),(255,255)の5つのデータセットをメモリカード31に記憶する。   Similarly, when the relationship between the input and output data is as shown in FIG. 27B, 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.

入出力データの関係が、図27(c)に示すような関係である場合、CPU30は、(0,0),(最小値,0),(最大値,255),(255,255)の4つのデータセットをメモリカード31に記憶する。   When the relationship between the input and output data is as shown in FIG. 27C, 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は、図31に示すフローチャートに従って、画像の編集処理を実行する。
CPU30は、操作部26から送信された操作情報に従って、補正画像を選択する(ステップS151)。
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 S151).

CPU30は、メモリカード31のヘッダ情報記憶領域からヘッダ情報を読み込む(ステップS152)。
CPU30は、元画像を読み込む(ステップS153)。
CPU30は、読み込んだ補正画像、ヘッダ情報、元画像を画像処理装置25に送り、再度、補正するように、画像処理装置25を制御する(ステップS154)。
The CPU 30 reads header information from the header information storage area of the memory card 31 (step S152).
The CPU 30 reads the original image (step S153).
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 S154).

画像処理装置25は、補正画像、ヘッダ情報、元画像を、CPU30から取得して、射影変換画像を作成する(ステップS155)。画像処理装置25は、作成した射影変換画像のデータを表示装置24に送り、表示装置24は、この画像を液晶モニタ12に表示する。   The image processing device 25 acquires a corrected image, header information, and an original image from the CPU 30, and creates a projective conversion image (step S155). 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は、図24に示すフローチャートに従って射影手動補正処理を行う(ステップS157)。
画像処理装置25は、ヘッダ情報と共に射影手動補正処理された補正画像をメモリカード31に記録し(ステップS158)、この編集処理を終了させる。
The image processing device 25 performs a projection manual correction process according to the flowchart shown in FIG. 24 (step S157).
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 S158), and ends the editing process.

以上説明したように、本実施形態によれば、画像処理装置25は、撮影対象物(白板2)の画像の画素を選択して縮小画像を生成するとともに、選択した画素を調査対象として、歪曲補正を行い、エッジ画像を作成するようにした。   As described above, according to the present embodiment, the image processing device 25 generates a reduced image by selecting pixels of the image of the shooting target (white plate 2), and distorts the selected pixels as a survey target. Correction was made to create an edge image.

従って、精度を維持しつつ、処理するデータ数を低減することができるので、撮影対象物の画像の歪みの補正を高速化することができる。また、直線を抽出する場合でも、調査範囲を低減させてハフ変換を実行するため、処理を高速化することができる。   Accordingly, the number of data to be processed can be reduced while maintaining accuracy, so that the correction of the distortion of the image of the photographic subject can be speeded up. Even when a straight line is extracted, the Hough transform is executed with the investigation range reduced, so that the processing can be speeded up.

また、作成したエッジ画像から輪郭を取得して、撮影対象物の形状を取得し、撮影対象物の四角形の頂点位置から、射影パラメータを求めて撮影対象物の画像を射影変換するようにしたので、撮影対象物が四角形であれば、自動的に画像の歪みを容易に補正することができる。また、斜めから撮影した場合でも、正面から撮影した撮影対象物の画像と同じような判読性の高い画像を得ることができる。   Also, because the contour is obtained from the created edge image, the shape of the object to be photographed is obtained, and the projection parameter is obtained from the vertex position of the quadrangle of the object to be photographed, and the image of the object to be photographed is projectively transformed. If the object to be photographed is a quadrangle, the image distortion can be automatically corrected easily. Further, even when the image is taken from an oblique direction, an image having high legibility similar to the image of the object to be imaged taken from the front can be obtained.

尚、本発明を実施するにあたっては、種々の形態が考えられ、上記実施形態に限られるものではない。
例えば、上記実施形態では、補正画像の作成に用いたパラメータを補正画像のファイルに保存した。しかし、元画像のファイルにこのパラメータを保存することもできる。元画像のファイルにパラメータを保存すれば、補正画像を保存しなくても、元画像から容易に補正画像を作成することができる。
In carrying out the present invention, various forms are conceivable and the present invention is not limited to the above embodiment.
For example, in the above embodiment, the 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.

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

また、撮影処理を行う際、デジタルカメラ1は、変換後の画像を保存せずに、すぐに射影パラメータの抽出処理を行う。この処理内容を図33のフローチャートに示す。
画像処理装置25は、射影補正画像を作成し(ステップS161〜169)、画像変換の調整、画像効果補正用パラメータの抽出、画像効果処理を行う(ステップS170〜172)。
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 this processing are shown in the flowchart of FIG.
The image processing device 25 creates a projection correction image (steps S161 to S169), performs image conversion adjustment, extraction of image effect correction parameters, and image effect processing (steps S170 to 172).

CPU30は、図32に示すヘッダ情報を作成する(ステップS173)。
画像処理装置25は、元画像データを圧縮し、CPU30は、作成したヘッダ情報を、圧縮した元画像データと共にメモリカード31に記録する(ステップS174,175)。
The CPU 30 creates header information shown in FIG. 32 (step S173).
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 S174 and 175).

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

画像処理装置25は、すぐに射影補正画像を作成し、画像効果処理を行う(ステップS183)。
CPU30と画像処理装置25とは、射影手動補正処理を行い、補正終了後、CPU30は、変更された射影補正パラメータに基づいてヘッダ情報を作成し、作成したヘッダ情報を元画像のファイルに再度記録する(ステップS184〜S187)。
The image processing device 25 immediately creates a projection corrected image and performs image effect processing (step S183).
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 S184 to S187).

また、上記実施形態では、画像補正をデジタルカメラ1で行うようにした。しかし、画像補正をコンピュータで行うことも可能である。この場合、コンピュータをコンピュータインタフェース部27に接続し、コンピュータが図31に示すフローチャートに従って画像の編集処理を実行する。コンピュータがこのような画像の編集処理を行えば、コンピュータは、マウス等を備え、デジタルカメラ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.

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

さらに、インターネット上のサーバ装置が有するディスク装置等にプログラムを格納しておき、例えば、搬送波に重畳させて、コンピュータにダウンロード等するものとしてもよい。   Furthermore, the program may be stored in a disk device or the like of 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 idea 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. 縮小輝度画像とエッジ画像を説明するための説明図である。It is explanatory drawing for demonstrating a reduced luminance image and an edge image. Robertsフィルタの機能を説明するための説明図である。It is explanatory drawing for demonstrating the function of a Roberts filter. ハフ変換を用いた直線検出を説明するための図であり、(a)は、上下の辺を検出する処理を示し、(b)は、左右の辺を検出する処理を示している。It is a figure for demonstrating the straight line detection using Hough transform, (a) shows the process which detects an upper and lower side, (b) has shown the process which detects a right and left side. ρがプラスの値かマイナスの値かによって、上下、または左右を判定可能であることを示すイメージ図である。It is an image figure which shows that upper and lower sides or right and left can be determined depending on whether ρ is a positive value or a negative value. 図2に示す画像処理装置が実行する書画撮影の場合の四角形検出処理の内容を示すフローチャートである。FIG. 3 is a flowchart showing the contents of a quadrangle detection process in the case of document shooting performed by the image processing apparatus shown in FIG. 2. 直線検出後の四角形を特定する様子を模式的に示すイメージ図であり、(a)は、書画撮影の場合を、(b)は書画撮影以外の場合を示している。It is an image figure which shows a mode that the square after a straight line detection is specified typically, (a) shows the case of document photography, (b) has shown the case other than document photography. 図2に示す画像処理装置が実行する書画撮影以外の場合の四角形検出処理の内容を示すフローチャートである。FIG. 3 is a flowchart showing the contents of a quadrangle detection process in a case other than document shooting performed by the image processing apparatus shown in FIG. 2. 図2に示す画像処理装置が実行する四角形の頂点からアフィンパラメータを求める処理の内容を示すフローチャートである。It is a flowchart which shows the content of the process which calculates | requires 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 the original image, a projection conversion image, and the enlarged projection conversion image. 図2に示す画像処理装置が実行する補正調整と画像変換処理の内容を示すフローチャートである。3 is a flowchart showing details of correction adjustment and image conversion 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 shown in FIG. 2 and an image processing apparatus perform. ヘッダ情報の内容を示す説明図である。It is explanatory drawing which shows the content of header information. 図2に示すCPU、画像処理装置が実行する補正画像の再編集処理の内容を示すフローチャートである。3 is a flowchart showing the contents of a re-editing process of a corrected image 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、画像処理装置が実行する撮影処理の内容を示すフローチャートである。FIG. 3 is a flowchart showing the contents of a photographing process executed by the CPU and image processing apparatus shown in FIG. 2 when only an 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)

撮影部により撮影対象物を撮影する撮影装置において、
撮影によって得られた前記撮影対象物の画像の歪みを補正するように、前記撮影画像に対して画像処理を行う画像処理部を備え、
前記画像処理部は、
前記撮影対象物の画像の画素を選択することによってデータ量を低減させた縮小画像を生成し、前記選択した画素に対して前記撮影対象物の画像の歪曲補正を行い、生成した縮小画像から前記撮影対象物の画像のエッジ画像を生成し、生成したエッジ画像から、前記撮影対象物の画像の形状を取得する形状取得部と、
前記形状取得部が取得した前記画像の形状と実際の撮影対象物の形状とを3次元の座標系を設定することで対応させて、前記撮影対象物の画像の頂点位置から、前記画像と実際の撮影対象物との関係を示す射影パラメータを求める射影パラメータ取得部と、
前記撮影部が有するレンズの焦点距離と前記撮影対象物の画像の頂点位置とに基づいて前記撮影対象物の縦横比を求める縦横比取得部と、
前記射影パラメータ取得部が求めた射影パラメータと前記縦横比取得部が求めた縦横比とを用いて前記撮影対象物の画像の画像変換を行う画像変換部と、を備えた、
ことを特徴とする撮影装置。
In a photographing device that photographs a photographing object by a photographing unit,
An image processing unit that performs image processing on the photographed image so as to correct distortion of the image of the photographing object obtained by photographing;
The image processing unit
A reduced image with a reduced amount of data is generated by selecting pixels of the image of the photographing object, distortion correction of the image of the photographing object is performed on the selected pixels, and the reduced image is generated from the generated reduced image. A shape acquisition unit that generates an edge image of the image of the shooting target and acquires the shape of the image of the shooting target from the generated edge image;
The shape of the image acquired by the shape acquisition unit and the actual shape of the object to be photographed are associated with each other by setting a three-dimensional coordinate system. A projection parameter obtaining unit for obtaining a projection parameter indicating a relationship with the object to be imaged,
An aspect ratio acquisition unit for obtaining an aspect ratio of the photographing object based on a focal length of a lens included in the photographing unit and a vertex position of an image of the photographing object;
An image conversion unit that performs image conversion of the image of the photographing object using the projection parameter obtained by the projection parameter obtaining unit and the aspect ratio obtained by the aspect ratio obtaining unit;
An imaging apparatus characterized by that.
前記形状取得部は、
前記撮影対象物の画像の縮小画像を生成する画素を選択し、前記選択した画素を調査対象として前記撮影対象物の画像の歪曲補正を行って前記撮影対象物の画像のエッジ画像を生成するエッジ画像生成部と、
前記エッジ画像生成部が生成したエッジ画像から、前記エッジ画像を形成する直線を取得する直線取得部と、
前記直線取得部が取得した直線によって前記撮影対象物の画像の形状の候補を生成する形状候補生成部と、
前記形状候補生成部が生成した前記撮影対象物の画像の形状の候補から、前記撮影対象物の画像の形状を選択する形状選択部と、を備える、
ことを特徴とする請求項1に記載の撮影装置。
The shape acquisition unit
An edge that selects a pixel that generates a reduced image of the image of the shooting object, and performs an edge correction of the image of the shooting object by performing distortion correction on the image of the shooting object using the selected pixel as an investigation target. An image generator;
A straight line acquisition unit that acquires a straight line forming the edge image from the edge image generated by the edge image generation unit;
A shape candidate generation unit that generates a shape candidate of the image of the object to be photographed by the straight line acquired by the straight line acquisition unit;
A shape selection unit that selects the shape of the image of the shooting target from the shape candidates of the image of the shooting target generated by the shape candidate generation unit;
The imaging apparatus according to claim 1, wherein:
前記直線取得部は、前記エッジ画像生成部が生成したエッジ画像から取得した直線の長さを求め、求めた前記直線の長さに基づいて、前記撮影対象物の画像の形状を形成する直線を選択して取得する、
ことを特徴とする請求項2に記載の撮影装置。
The straight line acquisition unit obtains the length of the straight line obtained from the edge image generated by the edge image generation unit, and based on the obtained straight line length, forms a straight line that forms the shape of the image of the photographing object. Select to get,
The imaging apparatus according to claim 2, wherein:
前記直線取得部は、前記エッジ画像生成部が生成したエッジ画像から取得した直線の角度を求め、求めた角度に基づいて、前記撮影対象物の画像の形状を形成する直線を選択して取得する、
ことを特徴とする請求項2に記載の撮影装置。
The straight line acquisition unit obtains an angle of the straight line obtained from the edge image generated by the edge image generation unit, and selects and obtains a straight line that forms the shape of the image of the photographing object based on the obtained angle. ,
The imaging apparatus according to claim 2, wherein:
前記形状選択部は、前記形状候補生成部が生成した前記撮影対象物の画像の形状の候補のうち、前記形状で囲まれた画像領域のサイズが最大となるものを選択して、選択したものを前記撮影対象物の画像の形状として取得する、
ことを特徴とする請求項2に記載の撮影装置。
The shape selection unit selects and selects the image of the object to be imaged generated by the shape candidate generation unit that has the largest image area size surrounded by the shape. As the shape of the image of the object to be photographed,
The imaging apparatus according to claim 2, wherein:
前記撮影対象物の画像データを記憶する記憶部を備えた、
ことを特徴とする請求項1乃至5のいずれか1項に記載の撮影装置。
A storage unit for storing image data of the photographing object;
The photographing apparatus according to claim 1, wherein the photographing apparatus is characterized in that:
撮影部により撮影対象物を撮影することによって得られた前記撮影対象物の画像の歪みを補正するように、前記撮影対象物の画像に対して画像処理を行う撮影装置の画像処理方法であって、
前記撮影対象物の画像の画素を選択することによってデータ量を低減させた縮小画像を生成し、前記選択した画素に対して前記撮影対象物の画像の歪曲補正を行うステップと、
生成した縮小画像から前記撮影対象物の画像のエッジ画像を生成するステップと、
生成したエッジ画像から、前記撮影対象物の画像の形状を取得するステップと、
前記撮影対象物の形状と前記形状取得部が取得した前記撮影対象物の画像の形状とを3次元の座標系を設定することで対応させて、前記撮影対象物の画像の頂点位置から、前記画像と前記撮影対象物との関係を示す射影パラメータを求めるステップと、
前記撮影部が有するレンズの焦点距離と前記撮影対象物の画像の頂点位置とに基づいて前記撮影対象物の縦横比を求めるステップと、
求めた射影パラメータと縦横比とを用いて前記撮影対象物の画像の画像変換を行うステップと、を備えた、
ことを特徴とする撮影装置の画像処理方法。
An image processing method of a photographing apparatus that performs image processing on an image of the photographing target so as to correct distortion of the image of the photographing target obtained by photographing the photographing target by a photographing unit. ,
Generating a reduced image with a reduced amount of data by selecting pixels of the image of the shooting object, and correcting distortion of the image of the shooting object for the selected pixels;
Generating an edge image of the image of the object to be photographed from the generated reduced image;
Obtaining the shape of the image of the object to be photographed from the generated edge image;
The shape of the object to be photographed and the shape of the image of the object to be photographed acquired by the shape acquisition unit are associated with each other by setting a three-dimensional coordinate system, and from the vertex position of the image of the object to be photographed, Obtaining a projection parameter indicating a relationship between an image and the object to be photographed;
Obtaining an aspect ratio of the photographing object based on a focal length of a lens included in the photographing unit and a vertex position of an image of the photographing object;
Performing image conversion of the image of the object to be photographed using the obtained projection parameters and aspect ratio,
An image processing method for a photographing apparatus.
撮影部により撮影対象物を撮影する撮影装置が有するコンピュータに、
前記撮影対象物の画像の画素を選択することによってデータ量を低減させた縮小画像を生成し、前記選択した画素に対して前記撮影対象物の画像の歪曲補正を行う手順、
生成した縮小画像から前記撮影対象物の画像のエッジ画像を生成する手順、
生成したエッジ画像から、前記撮影対象物の画像の形状を取得する手順、
前記撮影対象物の形状と前記形状取得部が取得した前記撮影対象物の画像の形状とを3次元の座標系を設定することで対応させて、前記撮影対象物の画像の頂点位置から、前記画像と前記撮影対象物との関係を示す射影パラメータを求める手順、
前記撮影部が有するレンズの焦点距離と前記撮影対象物の画像の頂点位置とに基づいて前記撮影対象物の縦横比を求める手順、
求めた射影パラメータと縦横比とを用いて前記撮影対象物の画像の画像変換を行う手順、
を実行させるためのプログラム。
In the computer of the photographing device that photographs the object to be photographed by the photographing unit,
A procedure for generating a reduced image with a reduced amount of data by selecting pixels of the image of the shooting object, and correcting distortion of the image of the shooting object for the selected pixel;
A procedure for generating an edge image of the image of the object to be photographed from the generated reduced image;
A procedure for acquiring the shape of the image of the photographing object from the generated edge image,
The shape of the object to be photographed and the shape of the image of the object to be photographed acquired by the shape acquisition unit are associated with each other by setting a three-dimensional coordinate system, and from the vertex position of the image of the object to be photographed, A procedure for obtaining a projection parameter indicating a relationship between an image and the object to be imaged;
A procedure for obtaining an aspect ratio of the photographing object based on a focal length of a lens of the photographing unit and a vertex position of an image of the photographing object;
A procedure for performing image conversion of the image of the object to be photographed using the obtained projection parameters and aspect ratio;
A program for running
JP2003354429A 2003-10-14 2003-10-14 Imaging apparatus, image processing method thereof, and program Expired - Fee Related JP4363154B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003354429A JP4363154B2 (en) 2003-10-14 2003-10-14 Imaging apparatus, image processing method thereof, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003354429A JP4363154B2 (en) 2003-10-14 2003-10-14 Imaging apparatus, image processing method thereof, and program

Publications (2)

Publication Number Publication Date
JP2005122328A JP2005122328A (en) 2005-05-12
JP4363154B2 true JP4363154B2 (en) 2009-11-11

Family

ID=34612344

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003354429A Expired - Fee Related JP4363154B2 (en) 2003-10-14 2003-10-14 Imaging apparatus, image processing method thereof, and program

Country Status (1)

Country Link
JP (1) JP4363154B2 (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8120665B2 (en) 2005-08-25 2012-02-21 Ricoh Company, Ltd. Image processing method and apparatus, digital camera, and recording medium recording image processing program
JP4772894B2 (en) * 2009-08-03 2011-09-14 シャープ株式会社 Image output device, portable terminal device, captured image processing system, image output method, program, and recording medium
JP4630936B1 (en) 2009-10-28 2011-02-09 シャープ株式会社 Image processing apparatus, image processing method, image processing program, and recording medium recording image processing program
JP5765026B2 (en) 2011-04-06 2015-08-19 富士ゼロックス株式会社 Image processing apparatus and program
JP5742399B2 (en) 2011-04-06 2015-07-01 富士ゼロックス株式会社 Image processing apparatus and program
JP6271969B2 (en) * 2013-11-27 2018-01-31 キヤノン株式会社 Imaging apparatus and image correction method
JP6233842B2 (en) * 2014-02-14 2017-11-22 Kddi株式会社 Information terminal device, method and program
KR102267442B1 (en) * 2019-10-07 2021-06-22 계명대학교 산학협력단 Correction method of camera distortion caused by multi-view capturing and generating method for block 3d model using thereof
WO2022087846A1 (en) * 2020-10-27 2022-05-05 Oppo广东移动通信有限公司 Image processing method and apparatus, device, and storage medium

Also Published As

Publication number Publication date
JP2005122328A (en) 2005-05-12

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
JP4556813B2 (en) Image processing apparatus 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
US8009929B2 (en) Image-capturing apparatus, method, and program which correct distortion of a captured image based on an angle formed between a direction of an image-capturing apparatus and a gravitational direction
JP2005267457A (en) Image processing device, imaging apparatus, image processing method and program
KR100682651B1 (en) Image processing device, image projection apparatus, image processing method, and recording medium for storing the related program
KR100610569B1 (en) Photographing device, image processor, image-processing method of photographing device
JP4010754B2 (en) Image processing apparatus, image processing method, and computer-readable recording medium
JP2006074512A (en) Photographing device, and image processing method, and program for photographing device
JP2007074578A (en) Image processor, photography instrument, and program
JP4363154B2 (en) Imaging apparatus, image processing method thereof, and program
JP2005275447A (en) Image processing device, image processing method and program
JP4375069B2 (en) Image processing apparatus, image processing method, and program
JP2005269449A (en) Image processor, image processing method and program
JP4363153B2 (en) Imaging apparatus, image processing method thereof, and program
JP4238749B2 (en) Image processing apparatus, image projection apparatus, image processing method, and program
JP4561302B2 (en) Image capturing apparatus, image processing method for image capturing apparatus, and program
JP4363152B2 (en) Captured image projection device, image processing method and program for captured image projection device
JP2001250114A (en) Method and device for image processing and computer- readable recording medium
JP2005122319A (en) Photographing device, its image processing method, and program
JP4225224B2 (en) Image processing apparatus, captured image projection apparatus, image processing method, and program
JP4591343B2 (en) Image processing apparatus, imaging apparatus, image processing method, and program
JP2005217721A (en) Apparatus and method for generating still picture
JP2007148612A (en) Photographing device, image processing method and image processing program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20061011

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20080718

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20080729

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20080925

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20090421

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090618

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20090728

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20090810

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

Free format text: PAYMENT UNTIL: 20120828

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

Ref document number: 4363154

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20120828

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20130828

Year of fee payment: 4

LAPS Cancellation because of no payment of annual fees