The present invention relates to an image stabilization apparatus, an image stabilization method and a document and more particularly, relates to a technique for correcting blurring in an image (blurring in an image caused by camera shake, to be precise) by using a PSF (Point Spread Function).
Conventionally, there are portable terminal devices each provided with a camera and configured to photograph a document such as a check or receipt, for example, and then perform image recognition on the photographed image. Many devices of this kind include a function for correcting blurring in an image because camera shake at the time of photographing causes blurring in an image.
As a method for correcting such image blurring in a still image by image processing, a technique using PSFs (Point Spread Functions) is known. A PSF is a function that represents the way blurring appears. Deconvolution of the PSF on the photographed image having image blurring enables recovery of a sharp image that could have been obtained otherwise.
One method for estimating a PSF is Blind Deconvolution. Blind Deconvolution is a method that assumes a feature (gradient distribution) included in a sharp natural image, and stochastically derives a PSF and a recovered image that is likely and satisfies the assumption only from an input image. Drawbacks of Blind Deconvolution include its enormous amount of operations, low accuracy in the estimated PSF, and low robustness with respect to input images.
In this respect, a method that uses an additional sensor is considered. This method adds a rate sensor to a camera, acquires motion information on the camera during an exposure period to generate a trajectory of camera shake by using the rate sensor, and estimates the trajectory of the camera shake as a PSF.
Further, as an image-blurring correction method using a PSF, there is a method disclosed in Patent Literature 1. The method uses an ideal image of an edge and an actually photographed image. The overview of the method will be explained. The technique of Patent Literature 1 aims at a stationary-type finger and palm print image input device and estimates a PSF unique to a device based on an actual edge data formed by photographing an edge image whose pattern is predetermined and ideal edge data formed by the ideal edge image. Next, based on the estimated PSF, an input finger and palm print image is corrected by a deconvolution filter to obtain a sharp image having no device specific influence.
Here, the use of an external sensor such as a rate sensor requires the installation of the sensor to the camera. Thus, there is a drawback that the structure is more complicated for the presence of the SENSOR. Further, another drawback is a larger error of the estimated PSF (the error from the actual PSF becomes large since the obtained trajectory of the camera shake has a shape formed by connecting line segments and there is no line width information).
Further, since the technique disclosed in Patent Literature 1 requires fixing a positional relationship between a photographic subject and a camera, the technique has a drawback in that it is difficult to apply the technique to image stabilization for a hand-held camera. Further, since it is premised on the photographing of an actual edge image whose patterns are limited to edges, user operations for the setting are necessary, and in addition to the photographing, a photographing step for PSF estimation is necessary. Therefore, there is a drawback of involving time and effort in photographing.
The present invention is made in view of the above described circumstances, and an object of the invention is thus to provide an image stabilization apparatus, an image stabilization method and a document that enable highly accurate image stabilization with a relatively small amount of operations, a simple configuration as well as easy user operations in correcting image blurring using a PSF.
An image stabilization apparatus according to one aspect of the present invention includes: an image receiving unit that receives a photographed image including a layout marker and a PSF estimation marker; a layout marker detection unit that detects a layout marker from the photographed image; a marker information keeping unit that keeps information on the layout marker; an estimation marker position calculation unit that obtains a position of the PSF estimation marker based on a result of layout marker detection obtained by the layout marker detection unit and the information on the layout marker kept in the marker information keeping unit; an estimation marker size calculation unit that obtains a size of the PSF estimation marker based on the result of layout marker detection obtained by the layout marker detection unit and the information on the layout marker kept by the marker information keeping unit; an estimation marker reference image generating unit that generates an image of the PSF estimation marker to be a reference based on the size of the PSF estimation marker obtained by the estimation marker size calculation unit; an estimation marker position associating unit that associates a position of the image of the PSF estimation marker to be the reference obtained by the estimation marker reference image generating unit with a position of the image of the PSF estimation marker in the photographed image based on the position of the PSF estimation marker obtained by the estimation marker position calculation unit; a PSF estimation unit that estimates a PSF by using the image of the PSF estimation marker to be the reference and the image of the PSF estimation marker in the photographed image, which are associated with each other by the estimation marker position associating unit; and an image stabilization unit that corrects blurring in the image by using the estimated PSF.
To achieve at least one of the abovementioned objects, an image stabilization method according to one aspect of the present invention includes: a layout marker detection step of detecting a layout marker from a photographed image including a layout marker and a PSF estimation marker; an estimation marker position calculation step of obtaining a position of the PSF estimation marker based on the detected layout marker; an estimation marker size calculation step of obtaining a size of the PSF estimation marker based on the detected layout marker; an estimation marker reference image generating step of generating an image of the PSF estimation marker to be a reference based on the calculated size of the PSF estimation marker; an estimation marker position associating step of associating a position of the generated image of the PSF estimation marker to be the reference and a position of the image of the PSF estimation marker in the photographed image based on the calculated position of the PSF estimation marker; a PSF estimation step of estimating a PSF by using the image of the PSF estimation marker to be the reference and the image of the PSF estimation marker in the photographed image, which are associated with each other; and an image stabilization step of correcting blurring in the photographed image by using the estimated PSF.
A document according to one aspect of the present invention includes: a reading frame; a character entry area provided within the reading frame; first and second layout markers respectively formed at positions within the reading frame, the positions being located across the character entry area from one another; and a PSF estimation marker formed at a position within the reading frame and between the first and second layout markers.
According to the present invention, it is made possible to perform highly accurate image stabilization with a relatively small amount of operations, a simple configuration as well as easy user operations in correcting image blurring using a PSF.
Hereafter, embodiments of the present invention are explained in detail with reference to the drawings.
First, principles of the embodiments are explained.
In the present embodiment, the document is processed as follows.
Known patterns (layout markers) A1 and A2 for acquiring positional relationships within a photographed image are printed. Layout markers A1 and A2 are two markers that are spaced apart from each other. The shapes of layout markers A1 and A2 are not limited to any particular shape, but preferably have a size surely readable by a camera and also have an easily recognizable pattern.
A known pattern (PSF estimation marker) B1 for estimating a PSF is printed. The shape of PSF estimation marker B1 is not limited to a particular shape, but preferably is a closed figure such as a circle, a triangle, a quadrangle or a polygon. As will be described later, layout markers A1 and A2 or a ruler line such as a reading frame can serve as the PSF estimation marker B1.
Examples of arrangement of the markers in the document will be described later in detail (
Next, an overview of an image stabilization process will be described. The image stabilization process is performed in the following order.
<1> Layout markers A1 and A2 are detected in the photographed image.
<2> Based on the positions of layout markers A1 and A2, the position and size of PSF estimation marker B1 are derived. Here, it is assumed that the positional relationship and the relationship of sizes of layout markers A1 and A2 and PSF estimation marker B1 on an actual document are known in the blurring correction apparatus (that is, those pieces of information are stored in advance in the blurring correction apparatus).
<3> A subregion including PSF estimation marker B1 is cut out from the photographed image.
<4> An image having no blurring for PSF estimation marker B1 is generated based on the information derived in above-described <2>. Here, it is assumed that the shape of PSF estimation marker B1 is known in the blurring correction apparatus (that is, the information is stored in advance in the blurring correction apparatus). In the example of
<5> The PSF is estimated by performing a deconvolution operation by using the two marker images for PSF estimation obtained in the above-described <3>, and <4>.
<6> By performing the deconvolution operation according to Non-blind method using the estimated PSF, a stabilized image is obtained by correcting the blurring of the photographed image as a whole or the image of a region of interest.
Image stabilization apparatus 100 receives an image that is a target of image stabilization by image receiving unit 101. Image receiving unit 101 has a frame memory, receives a photographed image obtained by photographing a subject, including a document or the like as shown in
Layout marker detection unit 102 searches images stored in image receiving unit 101 for layout markers A1 and A2 whose shapes are predetermined. As a search method for layout markers A1 and A2, a publicly known method such as pattern detection may be used. Layout markers A1 and A2 in a photographed image are detected by, for example, template matching, feature point matching or the like.
Marker information keeping unit 103 keeps information on the sizes, the positional relationship, and the shape regarding layout markers A1 and A2 and PSF estimation marker (hereafter, the PSF estimation marker is called simply as an estimation marker) B.
Estimation marker position calculation unit 104 calculates a position of estimation marker B based on layout markers A1 and A2 detected by layout marker detection unit 102 and marker information kept by marker information keeping unit 103. The calculation of the estimation marker position will be described in detail later.
Estimation marker size calculation unit 105 calculates a size of estimation marker B based on layout markers A1 and A2 detected by layout marker detection unit 102, and the position of the estimation marker B calculated by estimation marker position calculation unit 104, and marker information kept in marker information keeping unit 103. The calculation of the estimation marker size will be described later in detail.
Estimation marker reference image generating unit 106 generates a reference image of estimation marker B based on the position of estimation marker B calculated by estimation marker position calculation unit 104, the size of estimation marker B calculated by estimation marker position size calculation unit 105, and the shape of estimation marker B kept in marker information keeping unit 103. The reference image generation process for estimation marker B will be described in detail later.
Estimation marker position associating unit 107, based on the position of estimation marker B calculated by estimation marker position calculation unit 104, cuts out the position of estimation marker in the photographed image while associating the positions with each other. Specifically, estimation marker position associating unit 107 cuts out a subregion image including PSF estimation marker B from a frame memory of image receiving unit 101 based on the position and size of PSF estimation marker B and keeps the subregion image as actual PSF estimation marker image data.
PSF calculation unit 108 calculates (estimates) a PSF by performing a deconvolution process by using an estimation marker reference image obtained by estimation marker reference image generating unit 106, and an estimation marker image cut out from the photographed image by estimation marker position associating unit 107. Here, in order to perform a deconvolution operation, it is possible to use an element that performs a deconvolution operation in a frequency domain, such as an inverse filter or a Wiener filter.
Image stabilization unit 109 performs a deconvolution operation on the whole of the photographed image stored in the frame memory of image receiving unit 101 or a region of interest of the image data to correct the blurring in the photographed image by using the estimated PSF data obtained by PSF calculation unit 108. The deconvolution operation here may be performed by using, for example, an inverse filter or a Wiener filter that performs deconvolution operation in a frequency domain. However, the method for deconvolution is not limited to this, and any method that can perform Non-blind Deconvolution can be used. Image stabilization unit 109 stores image data in which blurring is corrected in an image output memory, or records the image data in an external storage medium.
Upon start of an image stabilization process, image stabilization apparatus 100 receives a photographed image by image receiving unit 101 in step S101. In step S102 following step S101, layout marker detection unit 102 detects layout markers A1 and A2, and it is determined in step S103 whether the layout markers A1 and A2 are detected successfully. For example, when the positions where at least two layout markers A1 and A2 exist (coordinates within the image) are successfully obtained, the detection is determined to be successful and otherwise the detection is determined to be failed. In step S103, when the detection is determined to be successful, the process proceeds to step S104.
In step S104, estimation marker position calculation unit 104 calculates the position of PSF estimation marker B. In step S105, estimation marker size calculation unit 105 calculates the size of PSF estimation marker B.
In step S106, estimation marker position associating unit 107 cuts out the image of PSF estimation marker from the photographed image. In step S107, estimation marker reference image generating unit 106 generates a reference image of PSF estimation marker B. In step S108, PSF calculation unit 108 performs a deconvolution operation of the image of the PSF estimation marker to obtain estimated PSF data.
In step S109, PSF calculation unit 108 determines whether the estimated PSF thus calculated is appropriate for use in the image stabilization. As examples of decision criteria (criteria for determining that the estimated PSF is appropriate for use in the image stabilization), the following two criteria can be cited. One criterion is that the number of elements whose signal level is high of the estimated PSF data is the predetermined number or less. Another criterion is that when the estimated PSF data is viewed as a two-dimensional image, there are no independent, multiple domains where the signal level is high. When the estimated PSF is determined to be appropriate in step S109 (step S109; Yes), the processing proceeds to step S110, while processing returns to step S101 when the estimated PSF is determined to be not appropriate (step S109; No).
In step S110, image stabilization unit 109 performs a deconvolution operation on the photographed image (on the whole of the image or the ROI (Region Of Interest)) by using the PSF obtained in step S109 to thereby correct the blurring in the photographed image.
In step S111, image stabilization unit 109 outputs an image after image stabilization to another apparatus, such as a document control apparatus or a monitor.
First, a document in
The example shown in
The example shown in
An explanation is given in detail by using
Estimation marker position calculation unit 104, as shown in
In step S302, estimation marker position calculation unit 104 calculates a distance between layout markers A1 and A2. More specifically, estimation marker position calculation unit 104 calculates distance DI in the image and between the two sets of coordinates of the centers received as shown in
(Equation 1)
DI=sqrt((XR−XL)2+(YR−YL)2) [1]
Here, (XL, YL) is the set of coordinates of the center of layout marker A1 for the start position, and (XR, YR) is the set of coordinates of the center of layout marker A2 for the termination position.
In step S303, estimation marker position calculation unit 104 reads and acquires layout information as shown in
In step S304, estimation marker position calculation unit 104 calculates a center position of PSF estimation marker B 1. Specifically, assuming that the set of center position coordinates is denoted as (XP, YP), estimation marker position calculation unit 104 calculates (XP, YP) according to the following formula by using a similarity relationship between the photographed image and the document layout.
(Equation 2)
XP=XL+cos R0·DXP·Z−sin R0·DYP·Z
YP=YL+sin J0·DXP·Z+cos J0·DYP·Z [2]
where
R0: an angle formed by a line segment connecting between the centers of the layout markers with a horizontal axis; J0=tan−1((YR−YL)/(XR−XL)); and Z=DI/D.
In step S305, estimation marker position calculation unit 104 calculates and outputs a set of PSF estimation marker region coordinates. Specifically, when a set of upper left coordinates and a set of lower right coordinates of the region to be calculated are respectively (XPL, YPT), (XPR, YPB), estimation marker position calculation unit 104 calculates the set of upper left coordinates (XPL, YPT) and the set of lower right coordinates (XPR, YPB) by using the actual size of the PSF estimation marker region acquired in step S303 and the result of calculation in step S304 according to the following formula and outputs the region coordinate data.
(Equation 3)
XPL=XP−((WP/2)·cos J0+(HP/2)·sin |J0|)·Z
YPT=YP−((WP/2)·sin |J0|+(HP/2)·cos J0)·Z
XPR=XP+((WP/2)·cos J0+(HP/2)·sin |J0|)·Z
YPB=YP+((WP/2)·sin |J0|+(HP/2)·cos J0)·Z [3]
An explanation is given in detail by using
As shown in
In step S602, estimation marker size calculation unit 105 reads and acquires information on PSF estimation marker B1 on the document from marker information keeping unit 103. The information acquired by estimation marker size calculation unit 105 is the following information (see
In step S603, estimation marker size calculation unit 105 calculates the size of the PSF estimation marker on the photographed image by using ratio Z calculated in step S601 and the value of actual size acquired in step S602 and outputs a calculation result. Here, the PSF estimation marker size to be calculated is marker size RPI=RP*Z where the shape is a circle.
An explanation is given in detail by using
Estimation marker reference image generating unit 106, as shown in
In step S802, estimation marker reference image generating unit 106 receives the size of PSF estimation marker B from estimation marker size calculation unit 105. Specifically, estimation marker reference image generating unit 106 receives the PSF estimation marker size and an angle of deviation J0(
In step S803, estimation marker reference image generating unit 106 reads and acquires information on PSF estimation marker B on the document from marker information keeping unit 103. The information acquired by estimation marker reference image generating unit 106 is the following information.
In step S804, estimation marker reference image generating unit 106 determines a color of a PSF estimation marker pixel. Specifically, a pixel value in the range input and specified in step S801 is read from the frame memory (image receiving unit 101) in which the photographed image is stored, and the pixel color of PSF estimation marker B is determined.
As a method for determination, there are two examples in the following.
A histogram of pixel values within the range is set, and a pixel level that is a peak in each of a low luminance side and a high luminance side is extracted, and a pixel value forming the peak in the low luminance side is assigned to black color of the PSF estimation marker, and a pixel value forming the peak in the high luminance side is assigned to the white color of the PSF estimation marker.
A minimum value of the pixel values within the range is assigned to the black color of the PSF estimation marker, and a maximum value of the pixel values within the range is assigned to the white color of the PSF estimation marker.
In step S805, estimation marker reference image generating unit 106 renders an image of the PSF estimation marker. Specifically, estimation marker reference image generating unit 106 calculates a size of the region from the set of marker region coordinates input in step S801, and prepares an image memory having a size that is the same as the size of the region. Then, estimation marker reference image generating unit 106 renders a pattern of the PSF estimation marker in the prepared image memory based on the information obtained in step S802 and step S803. For the pixel value corresponding to each of the white and black of the patterns, a pixel value determined in step S804 is used.
For pixel a, it is determined that the pixel is outside of the circumference according to (x-coordinate)2+(y-coordinate)2=13>(RPI/2)2=6.25 and rendered by a background color. For pixel b, it is determined that the pixel is inside of the circumference according to (x-coordinate)2+(y-coordinate)2=2<(RPI/2)2=6.25 and rendered by a foreground color.
By performing the same determination processing also for other pixels, it is determined by which of the background and foreground colors the pixel is to be rendered, to perform rendering. Here, in the case of marker color arrangement in which the maker is black on the white background, the background color is “white” and foreground color is “black.” Inversely, in the case of marker color arrangement in which the marker is white on the black background, the background color is “black” and the foreground color is “white.” Specific pixel values for “white” and “black” are the values determined in step S804.
In step S806, estimation marker reference image generating unit 106 rotates the image of the PSF estimation marker. Specifically, rotational conversion by rotational angle J0 (
In step S807, estimation marker reference image generating unit 106 outputs data in the image memory on which the processes of steps S805 to S806 are performed, as a PSF estimation marker reference image.
It is possible to obtain a clearer image when PSF calculation unit 108 is configured as shown in
Here, it is often that in the case where a document is photographed by a hand-held camera or the like, a sheet surface of the document is not perpendicular to an optical axis of the camera. In this case, the marker is photographed while being geometrically deformed in shape. Then, image stabilization apparatus 200 detects the geometrical deformation of the marker shape by distortion detection unit 201 and performs PSF estimation after deforming the PSF estimation marker reference image in the same way. This makes it possible to suppress the enlargement of estimation error. Image stabilization apparatus 200 is configured to add the same distortion as that in the photographed image to the PSF estimation marker reference image without correcting the distortion of the photographed image, rather than performing a series of processes for the basic configuration (
An explanation is given of a process for detecting geometric distortion performed in step S1101 by distortion detection unit 201.
Distortion detection unit 201 detects a planar distortion on the image of document sheet surface received in step S101; and obtains homography matrix H that represents the distortion. Homography matrix H is formed of 3×3 elements and includes eight unknown numeric elements and can be represented by the following formula:
As a method for calculating H, there is a method that detects which sets of coordinates in the photographed image the four representative points on the document as shown in
Here, (XRn, YRn) represents a set of known coordinates of n-th representative point (expressed by document layout coordinate system), and (XIn, YIn) represents a set of observation coordinates of the n-th representative point (expressed by photographed image coordinate system).
Method 1) When four corner points of reading frame R1 of the document are set to be the representative points, edges are detected from the image and coordinates of intersection points of the detected edges are calculated to thereby obtain the representative point coordinates.
Method 2) A document image having no distortion is generated, and feature point matching with the photographed image is performed. Of a plurality of matched coordinate pairs, four points whose evaluation values are high are extracted.
An explanation is given of a process for calculating a PSF estimation marker region performed in step S1102 by estimation marker position calculation unit 104.
Estimation marker position calculation unit 104 calculates a PSF estimation marker region by using the document layout information from marker information keeping unit 103, and the homography matrix calculated in step S1101.
Estimation marker position calculation unit 104 receives homography matrix H from distortion detection unit 201 in step S1301. In step S1302, estimation marker position calculation unit 104 reads out layout information of document from marker information keeping unit 103 and obtains sets of coordinates of the PSF estimation marker region. In the case of the example of
In step S1303, estimation marker position calculation unit 104 calculates a PSF estimation marker region. Specifically, the sets of coordinates of four corners of the PSF estimation marker region are respectively transformed into sets of coordinates in the photographed image coordinate system according to homography matrix H. In the case of the example of
Here, wi (i=1 to 4) is an inverse number of the value of the element in the third row of the multiplication result of the matrix in the right side of the each formula.
In step S1304, estimation marker position calculation unit 104 calculates the sets of coordinates of a rectangle region circumscribed by a rectangle defined by four points obtained by transformation in step S1303 and outputs the calculation result as PSF estimation marker region coordinates. In the case of the example of
(Equation 7)
XPL=Min{XIP1,XIP2,XIP3,XIP4}
XPR=Max{XIP1,XIP2,XIP3,XIP4}
YPT=Min{YIP1,YIP2,YIP3,YIP4}
YPB=Max{YIP1,YIP2,YIP3,YIP4} [7]
An explanation is given of a process for generating a reference image of the PSF estimation marker performed by estimation marker reference image generating unit 106 in step S1103.
Estimation marker reference image generating unit 106 generates a reference image of a PSF estimation marker having a distortion that is the same as that of the photographed image based on the PSF estimation marker region calculated by estimation marker position calculation unit 104, known PSF estimation marker shape data read from marker information keeping unit 103 and homography matrix H calculated in distortion detection unit 201, and keeps the reference image as PSF estimation marker reference image data.
Estimation marker reference image generating unit 106 receives homography matrix H from distortion detection unit 201 in step S1401. In step S1402, estimation marker reference image generating unit 106 reads and acquires information on the PSF estimation marker on the document from marker information keeping unit 103. The information acquired by estimation marker reference image generating unit 106 is the following information:
In step S1403, estimation marker reference image generating unit 106 renders an image of the PSF estimation marker. Specifically, estimation marker reference image generating unit 106 calculates the size of the region from the marker region coordinates input in step S801, and prepares an image memory having the same size as the region. Then, estimation marker reference image generating unit 106 renders the pattern of the PSF estimation marker in the prepared image memory, based on the information obtained in steps S1401 and S 1402. For the pixel value corresponding to the pattern of each of white and black, each pixel value determined in step S804 is used.
Here, to determine which of the black and white each pixel on the image memory is, it may be checked to which position of the PSF estimation marker the coordinate values obtained by mapping the coordinates of the pixel (represented in the photographed image coordinate system) on the document layout coordinate system by an inverse matrix H−1 of homography matrix H correspond.
In the case of the example in
Here, w is a normalization constant that matches elements on both sides of the third row.
Distance DM between the point M′ and the center (XRPC, YRPC) of the marker circle can be calculated based on the following formula:
(Equation 9)
DM=sqrt((XRM−XRPC)2+(YRM−YRPC)2) [9]
Therefore, estimation marker reference image generating unit 106 performs determination as described below on pixel a and pixel b in
Pixel a comes under the case where DM>RP/2, and since point M′ is outside of the marker circle, point M is rendered in the background color. Pixel b comes under the case where DM<=RP/2, and since point M′ is inside of the marker circle, point M is rendered by the foreground color.
In this way, the estimation marker reference image generating unit can reflect the distortion detected by distortion detection unit 201 on the image of the PSF estimation marker to be the reference.
Region dividing unit 301 divides a photographing region according to the position of estimation marker B in the image obtained by estimation marker position calculation unit 104. For example, a Volonoi region is prepared based on the position of each estimation marker B. Divided photographed images are output to optimal PSF associating unit 302.
Optimal PSF associating unit 302 associates PSFs corresponding to divided images. Image stabilization unit 109 performs image stabilization of each region by using the PSF corresponding to the region. Synthesizing unit 303 synthesizes the regions in which image stabilization is performed.
Here, in the case of camera shake, the whole of the screen should blur uniformly. However, depending on the conditions of photographing, the image may blur partially differently. Therefore, in the present configuration, the PSF estimation marker is formed (printed) on a plurality of locations in the document, and PSF estimation and image stabilization are performed for each location. Then, finally, selection or synthetic output of a stabilized image is performed depending on to which maker and by which degree each pixel position is close to.
As shown in
Here, the ruler line cross-section, when the ruler line in the horizontal direction is used for the PSF estimation, refers to a plane obtained by cutting by a line segment in the vertical direction, and when the ruler line in the vertical direction is used for the PSF estimation, refers to a plane obtained by cutting by a line segment in the horizontal direction.
Ruler line position calculation unit 401 calculates the position of a ruler line (hereafter called as an estimation ruler line) to be used for PSF estimation based on the sets of coordinates of layout markers A1 and A2 detected by layout marker detection unit 102, and marker information (known layout information) kept by marker information keeping unit 103 and outputs the calculated cutting position coordinate data. Although a case is described in which reading frame R1 is used as the ruler line for PSF estimation, another ruler line that surrounds a reading target may be used. The calculation of the position of the ruler line will be described in detail later.
Ruler line width calculation unit 402 calculates the width of the ruler line based on the set of coordinates of the layout marker detected by layout marker detection unit 102, the position of the ruler line calculated by ruler line position calculation unit 401 and the marker information (known layout information) kept by marker information keeping unit 103. The calculation of the width of the ruler line will be described later in detail.
Ruler line cross-section reference image generating unit 403 generates a reference image (one-dimensional signal) of the ruler line cross-section based on the ruler line width calculated by ruler line width calculation unit 402. The process for generating the reference image of the ruler line cross-section will be described in detail later.
Ruler line cross-section position associating unit 404 cuts out a cross-section image (one-dimensional data) of the estimation ruler line from the frame memory of image receiving unit 101 based on the position of the ruler line calculated by ruler line position calculation unit 401 and the ruler line width calculated by ruler line width calculation unit 402 in association with the position of the ruler line cross-section in the photographed image corresponding to the ruler line cross-section to be a reference and keeps the cross-section image as estimation ruler line cross-section actual image data.
PSF calculation unit 108 calculates (estimates) a PSF by performing a deconvolution operation by using the ruler line cross-section reference image obtained by ruler line cross-section reference image generating unit 403 and the ruler line cross-section image (one-dimensional signal) cut out from the photographed image by ruler line cross-section position associating unit 404. PSF calculation unit 108 keeps the operation result as estimated PSF data. The estimated PSF data obtained here is also one-dimensional.
Then, ruler line cross-section reference image generating unit 403 expands the one-dimensional estimated PSF data into two-dimensional data. The operation is shown in
In step S1601, a position of the estimation ruler line is calculated by ruler line position calculation unit 401, and in step S1602, the width of the estimation ruler line is calculated by ruler line width calculation unit 402.
In step S1603, an estimation ruler line cross-section image is cut out from the photographed image by ruler line cross-section position associating unit 404. In step S1604, a reference image of the estimation ruler line cross-section is generated by ruler line cross-section reference image generating unit 403.
In step S1605, PSF calculation unit 108 performs a deconvolution process on the estimation ruler line cross-section image to thereby obtain an estimated PSF. Further, the one-dimensional estimated PSF is expanded into two-dimensional estimated PSF.
An explanation is given of a process for calculating the position of the estimation ruler line performed by the ruler line position calculation unit 401 in step S1601.
Ruler line position calculation unit 401 receives layout information in step S1701. That is, ruler line position calculation unit 401 reads and acquires the information on the layout of the document from marker information keeping unit 103.
In step S1702, ruler line position calculation unit 401 calculates the cutting position of the estimation ruler line and outputs coordinate data of the calculated cutting position. Here, when the set of coordinates of the cutting position to be calculated is (XP, YP), the set of cutting position coordinates (XP, YP) is calculated according to the following formula by using the similarity relationship between the photographed image and the document layout. The method for calculating is similar to that explained with
(Equation 10)
XP=XL+cos J0·DXP·Z−sin J0·DYP·Z
YP=YL+sin J0·DXP·Z+cos J0·DYP·Z [10]
DXP is a position (by a unit of the size in the document layout) where the cross-section of the estimation ruler line is obtained, and any values of 0 to D may be set according to the part of the document where the estimated PSF is intended to be calculated.
An explanation is given of a process for calculating the estimation ruler line width calculation process performed by ruler line width calculation unit 402 in step S1602.
Ruler line width calculation unit 402 calculates, in step S601, ratio Z of distance DI
(
Ruler line width calculation unit 402 receives the layout information in step S1901. That is, ruler line width calculation unit 402 reads and acquires information on the layout of the document from marker information keeping unit 103. The layout information read by ruler line width calculation unit 402 is the following information.
In step S1902, ruler line width calculation unit 402 calculates the width (cross-section width) of the estimation ruler line on the photographed image by using the value obtained in step S601 and step S1901 and outputs the result of calculation. Ruler line width HPIC can be obtained by the following formula:
(Equation 11)
HPIC=HP·Z/cos J0 [11]
5-3. Process for Generating Reference Image of Estimation Ruler Line Cross-Section An explanation is given of a process for generating the reference image of the estimation ruler line cross-section performed by ruler line cross-section reference image generating unit 403 in step S1604.
In step S2001, ruler line cross-section reference image generating unit 403 receives a set of coordinates (XP, YP) of the estimation ruler line cutting position calculated in step S1702 earlier. In step S2002, ruler line cross-section reference image generating unit 403 receives estimation ruler line cross-section width HPIC calculated in step S1602 earlier.
Ruler line cross-section reference image generating unit 403 reads and acquires information on the layout of the document in step S2003 from marker information keeping unit 103. The information acquired by ruler line cross-section reference image generating unit 403 is the following information.
In step S2004, ruler line cross-section reference image generating unit 403 reads a pixel value on the cross-section line segment specified in steps S2001 and S2002 from a frame memory of image receiving unit 101 in which a photographed image is stored, and determines the pixel color of the estimation ruler line cross-section reference image. Reading of the above is performed in such a way that a background pixel near the ruler line cross-section is included. For example, when the horizontal ruler line is used, the coordinates of the range to be read are determined as (XP, YP−delta 1)−(XP, YP+HPIC+delta 2). In the formula, delta 1 and delta 2 indicate extra portion of the heights of the background region read out below and above the ruler line. The method for determining the pixel value is similar to the method explained in step S804.
In step S2005, ruler line cross-section reference image generating unit 403 renders an estimation ruler line cross-section image. Specifically, ruler line cross-section reference image generating unit 403 first prepares an image memory (one-dimensional) having elements of the same number as that of pieces of pixel data read from the photographed image in step S2004. Then, ruler line cross-section reference image generating unit 403 renders a ruler line cross-section pattern based on the information obtained in steps S2002 and S2003 on the image memory prepared. For the pixel value corresponding to each of the patterns of white and black, each pixel value determined in step S2004 is used.
In step S2006, ruler line cross-section reference image generating unit 403 outputs data Tendered in step S2005 as the estimation ruler line cross-section reference image.
In the present configuration, a point image of one dot is used as a PSF estimation marker. As described in patent literature 2, this makes it possible to utilize the photographed image of a point image of one dot as a PSF without any processing when the PSF is obtained. Therefore, the calculation amount can be small. When a point image having a plurality of dots is used, a deconvolution process will be necessary, and therefore the amount of calculation becomes large. Here, one dot refers to a minimum pixel of the camera used in photographing the photographed image (for example, one light receiving element of CCD).
Estimation marker size calculation unit 105 estimates the sizes of a plurality of point images (
Marker selection unit 501 selects an image photographed by one dot from among the plurality of point images based on the size estimation result.
Estimation marker position associating unit 107 associates the position of the estimation marker in the photographed image based on the position of the estimation marker selected by marker selection unit 501 and cuts out the image.
PSF normalization unit 502 normalizes a signal level of each pixel of the marker region image (approximately PSF image) cut out by estimation marker position associating unit 107. Specifically, the following process is performed.
It is made possible to perform highly accurate image stabilization with a relatively small amount of operations, and a simple configuration as well as easy user operations by the configuration including: layout marker detection unit 102 that detects a layout marker from a photographed image; estimation marker position calculation unit 104 that obtains the position of the PSF estimation marker; estimation marker size calculation unit 105 that obtains the size of the PSF estimation marker; estimation marker reference image generating unit 106 that generates an image of the PSF estimation marker to be a reference; PSF calculation (estimation) unit 108 that estimates a PSF by using the estimation marker image to be a reference and an estimation marker image corresponding thereto in the photographed image; and image stabilization unit 109 that corrects blurring in the photographed image by using the estimated PSF.
In other words, according to the present embodiment, blurring can be corrected based on one still image with a small amount of operations and high accuracy. Further, it is made possible to correct blurring without any additional sensor. Further, any extra photographing steps can be made unnecessary since the PSF is estimated at the same time as photographing the subject. Further, it is made possible to correct blurring without fixing the positional relationship between the camera and the subject. Further, not only it is made possible to correct the blurring in an image caused by the camera shake at photographing, but also to correct the blurring in an image attributable to a condition of a photographic target such as a document or the like.
Image stabilization apparatuses 100, 200, 300, 400, and 500 of the above embodiments can be formed of a computer such as a personal computer including a memory and a CPU. Then, the functions of constituent elements of image stabilization apparatuses 100, 200, 300, 400 and 500 can be realized by reading a computer program stored in a memory, by a CPU.
The disclosure of Japanese Patent Application No. 2011-134926 filed on Jun. 17, 2011, including the specification, drawings and abstract, is incorporated herein by reference in its entirety.
The present invention is useful for an apparatus in which a document or the like is photographed by, for example, a portable terminal having a camera such as a hand-held terminal and the photographed image is subjected to image recognition.
Number | Date | Country | Kind |
---|---|---|---|
2011-134926 | Jun 2011 | JP | national |
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/JP2012/003933 | 6/15/2012 | WO | 00 | 8/27/2013 |