This invention relates to an image pickup apparatus and an image pickup method with which to perform registration processing between a plurality of images, and more particularly to an image pickup apparatus and an image pickup method with which to perform registration processing that is used when images are superimposed during image blur correction and the like.
A block matching method or a correlation method based on a correlation calculation is known as a conventional method of detecting a motion vector of an image during image blur correction and the like.
In the block matching method, an input image signal is divided into a plurality of blocks of an appropriate size (for example, 8 pixels×8 lines), and a difference in pixel value between a current field (or frame) and a previous field is calculated in block units. Further, on the basis of this difference, a block of the previous field that has a high correlation to a certain block of the current field is searched for. A relative displacement between the two blocks is then set as the motion vector of the certain block.
In a method of searching for a block having a high correlation during block matching, the correlation is evaluated using a sum of squared difference SSD, which is the sum of squares of the pixel value difference, and a sum of absolute difference SAD, which is the absolute value sum of the pixel value difference. As SSD and SAD decrease, the correlation is evaluated to be higher. When a pixel position within a matching reference block region I of the current field is represented by p, a pixel position (a position corresponding to the pixel position p) within a subject block region I′ of the previous field is represented by q, and the pixel values of the pixel positions p, q are represented by Lp, Lq, respectively, SSD and SAD are respectively expressed by the following Equations (1) and (2).
Here, p and q are quantities having two-dimensional values. I and I′ represent two-dimensional regions of the current field and the previous field, respectively. The term pεI indicates that the coordinate p is included in the region I, and the term qεI′ indicates that the coordinate q is included in the region I′.
Meanwhile, in the correlation method based on a correlation calculation, average values Ave (Lp), Ave (Lq) of the pixels pεI and qεI′ respectively included in the matching reference block region I and the subject block region I′ are calculated. A difference between the pixel value included in each block and the average value is then calculated using the following Equation (3).
Next, a normalization cross-correlation NCC is calculated using Equation (4).
NCC=ΣLp′Lq′ (4)
A block having a large normalization cross-correlation NCC is evaluated as having a high correlation, and the displacement between the blocks I′ and I having the highest correlation is set as the motion vector.
When an object or an image pickup subject included in an image is stationary, the motion within individual regions and the motion of the entire image match, and therefore the motion vector may be calculated by disposing the block in which the correlation calculation is to be performed in an arbitrary fixed position.
It should be noted that in certain cases, it may be impossible to obtain a highly reliable motion vector due to the effects of noise or when the block is applied to a flat portion or an edge portion having a larger structure than the block. To prevent such cases from arising, a technique for performing a reliability determination during calculation of the motion vector is disclosed in JP8-163573A and JP3164121B, for example.
Further, when the object or image pickup subject included in the image includes a plurality of motions, it is necessary to calculate the motion vector of the entire image in order to correct blur, for example. In JP8-251474A, the object is divided into a plurality of regions, and an important region is selected from the plurality of regions in accordance with the magnitude of the motion vector, the size of the region, and so on. The motion vector of the selected region is then set as the motion of the entire image.
In this case, region selecting means (i) select the region having the largest range from the plurality of regions, (ii) select the region having the smallest motion vector from the plurality of regions, (iii) select the region having the largest range of overlap with a previously selected region from the plurality of regions, and (iv) select one of the region having the largest range, the region having the smallest motion vector, and the region having the largest range of overlap with the previously selected region.
An aspect of this invention provides an image pickup apparatus that performs image registration processing between a plurality of images using a motion vector calculation. The image processing apparatus includes: an exposure calculation unit for calculating an exposure when an object is photographed; a flash photography unit for performing image pickup of one of the plurality of images by causing a flash device to emit light during the image pickup in accordance with the exposure; a motion vector measurement region setting unit for setting a plurality of motion vector measurement regions for which a motion vector is measured; a motion vector calculation unit for calculating the motion vectors of the plurality of motion vector measurement regions; a motion vector reliability calculation unit for calculating a reliability of the respective motion vectors; a main region detection unit for detecting a main region from the image photographed by the flash photography unit; and a motion vector integration processing unit for calculating an inter-image correction vector on the basis of the motion vectors of the plurality of motion vector measurement regions, taking into account the reliability. The motion vector integration processing unit includes a contribution calculation unit for calculating a contribution of the respective motion vectors from a positional relationship between the respective motion vector measurement regions and the main region, and integrates the motion vectors of the plurality of motion vector measurement regions in accordance with the reliability and the contribution.
Referring to
A main controller 100 performs overall operation control, and includes a CPU such as a DSP (Digital Signal Processor), for example. In
A plurality of images input from the image pickup unit 101 through continuous shooting (continuous image pickup) or the like are all stored in a frame memory 102. The image pickup unit 101 that obtains the images is constituted by a lens system, an imaging device such as a CCD (charge coupled device) array, and so on. An exposure calculation unit (exposure calculating means) 112 calculates an exposure of the imaging device when an object is photographed on the basis of data relating to luminance values (pixel values) of the images stored in the frame memory 102.
A strobo-light emitting unit 111 (flash device) emits a flash that illuminates the object during image pickup. The main controller 100 controls the strobo-light emitting unit 111 such that the strobo-light emitting unit 111 emits light in accordance with the calculated exposure. More specifically, the main controller 100 causes the strobo-light emitting unit 111 to emit light only when the calculated exposure is equal to or smaller than a threshold. Further, when the strobo-light emitting unit 111 emits light, the main controller 100 may adjust a light emission amount of the strobo-light emitting unit 111 in accordance with the calculated exposure. The image pickup unit 101, main controller 100, and strobo-light emitting unit 111 constitute a flash photography unit.
The strobo-photographed image data are stored temporarily in the frame memory 102 from the image pickup unit 101. A main region detection unit 113 then detects a main region (a region of a main object or the like). Position information data relating to the detected main region are then transmitted to a main region setting unit 108. Here, the main region position information data may be data indicating a reference frame block corresponding to the main region or the like.
A region setting unit 103 sets predetermined motion vector measurement regions for a reference frame (reference image) stored in the frame memory as a reference in order to calculate motion between the reference frame and a subject frame (subject image). The region setting unit 103 sets block regions (motion vector measurement blocks) in lattice form in the reference frame as motion vector measurement regions. A motion vector calculation unit 104 uses the image data of the reference frame and the subject frame stored in the frame memory and data relating to the block regions set by the region setting unit 103. Thus, the motion vector calculation unit 104 calculates a block region position of the subject frame having a high correlation with a block region of the reference frame using a correlation calculation of a sum of squared difference SSD, a sum of absolute difference SAD, a normalization cross-correlation NCC, and so on. A relative displacement between the block region of the reference frame and the block region of the subject frame is then calculated as a motion vector.
A motion vector reliability calculation unit 105 calculates the reliability of the motion vector. The main region setting unit 108 sets main region position information (centroid coordinate, size, and so on) on the basis of the position information (the reference frame block corresponding to the main region and so on) from the main region detection unit 113. A motion vector integration processing unit 106 calculates a representative value (correction vector) of an inter-frame motion vector by integrating motion vector data in accordance with a positional relationship between the block regions and the main region of the reference frame. A frame addition unit 109 performs frame addition using the image data of the reference frame and the subject frame stored in the frame memory and data relating to the correction vector.
Next, referring to
In the example shown in
When the exposure immediately before the start of continuous shooting is detected to be equal to or smaller than the threshold in the above description, the main controller 100 may control the strobo-light emitting unit 111 to emit strobo-light during pickup of the first image at the start of the continuous shooting.
In the example shown in
Further, when the difference in exposure (luminance value) between the seventh image and the other images is large, the main region position information is propagated to an image other than the seventh image, similarly to the example shown in
When the exposure immediately before the start of continuous shooting is detected to be equal to or smaller than the threshold, the main controller 100 may perform advance setting such that strobo-light is emitted during pickup of a predetermined image (the seventh image). Alternatively, when the exposure immediately before pickup of the predetermined image (the seventh image) is detected to be equal to or smaller than the threshold midway through the continuous shooting, the main controller 100 may cause strobo-light to be emitted during pickup of the predetermined image (the seventh image).
Next, an outline of an operation for calculating the reliability of the motion vector, which is performed by the motion vector reliability calculation unit 105, will be described.
A method of determining the reliability of the motion vector on the basis of the statistical property of an inter-frame (inter-image) correlation value in block units and a method of determining the reliability of the motion vector on the basis of the statistical property of a correlation value within a frame are known.
When the reliability is determined on the basis of the statistical property of the inter-frame correlation value, a sum of squares SSD (expressed by the following Equation (5)) of a difference between pixel values included in a block Ii of the reference frame (reference image) and a block Ij of the subject frame (subject image), for example, is used as a correlation value between the motion vector measurement region of the reference frame and a corresponding image region of the subject frame.
Here, coordinates (bxi, byi) denote a centroid position (or a central coordinate) of an ith block set by the region setting unit 103, and are prepared in a number corresponding to the number of blocks Ii. The symbols “h”, “v” represent the dimension of the block in a horizontal direction and a vertical direction, respectively. Coordinates (bxj, byj) denote a centroid position of a jth subject block Ij, and are prepared in accordance with a block matching search range.
The SSD (i, j) of the ith block takes various values depending on the number j of the subject block, whereas a reliability Si of the ith block is determined on the basis of a difference between a minimum value and an average value of the SSD (i, j). The reliability Si may simply be considered as the difference between the minimum value and the average value of the SSD (i, j).
The reliability based on the statistical property of the correlation value SSD corresponds to the structural features of the region through the following concepts. (i) In a region having a sharp edge structure, the reliability of the motion vector is high, and as a result, few errors occur in the subject block position exhibiting the minimum value of the SSD. When a histogram of the SSD is created, small SSD values are concentrated in the vicinity of the position exhibiting the minimum value. Accordingly, the difference between the minimum value and average value of the SSD is large. (ii) In the case of a textured or flat structure, the SSD histogram is flat, and as a result, the difference between the minimum value and average value of the SSD is small. Hence, the reliability is low. (iii) In the case of a repeating structure, the positions exhibiting the minimum value and a maximum value of the SSD are close, and positions exhibiting a small SSD value are dispersed. As a result, the difference between the minimum value and the average value is small, and the reliability is low. Thus, a highly reliable motion vector for the ith block is selected on the basis of the difference between the minimum value and the average value of the SSD (i, j).
When the reliability is determined on the basis of the statistical property of a correlation value within a frame, a correlation value between one motion vector measurement region of the reference image and another motion vector measurement region of the reference image is calculated, and the reliability Si is calculated on the basis of a minimum value of the correlation value (see JP2005-260481A).
It should be noted that the reliability may also be determined in accordance with an edge quantity of each block, as described in JP3164121B.
When an affirmative result is obtained, 1 is set as a contribution Ki (Ki=1) (S12), and when a negative result is obtained, 0 is set as the contribution Ki (Ki=0) (S13).
Further, as a modified example of the contribution calculation described above, threshold processing may be performed in accordance with an area of overlap between the main region and the ith motion vector measurement region. More specifically, if the area of overlap between the main region and the ith motion vector measurement block is equal to or greater than a predetermined value, Ki=1 is set, and if not, Ki=0 is set.
A frame correction vector Vframe is calculated by performing weighted addition on (or calculating a weighted average of) the motion vectors of the plurality of motion vector measurement regions using the final reliability STi, the contribution Ki, and a measurement result Vi of the motion vector of the ith motion vector measurement region in accordance with Equation (9) (S34).
Here, the denominator on the right side is a normalization coefficient. A weighting coefficient STiKi is set in accordance with the product of the reliability STi and the contribution Ki.
It should be noted that in the above description, the main region setting unit 108 sets the main region position in the image obtained when strobo-light is emitted using main object position information, which is obtained by the main region detection unit 113 on the basis of object recognition (well-known face recognition, for example) or contrast intensity.
As another modified example, a motion vector may be calculated in relation to a pre-selected region using the information from the main region setting unit 108 and the information from the motion vector measurement region setting unit 103, and the correction vector may be calculated by integrating the data relating to the motion vector in accordance with the reliability of the region.
Next, a second embodiment will be described with reference to
Here, a bin is a dividing region or class in the histogram (or frequency distribution). A width of the bin in an x axis direction is bin_x, and a width of the bin in a y axis direction is bin_y.
As shown in
Here, floor is a floor function. Further, “1” denotes a horizontal direction range in which the histogram is created, and “m” denotes a vertical direction range in which the histogram is created.
The bin frequency is counted by increasing a frequency Hist(s) of the sth bin every time the motion vector Vi enters the sth bin, as shown in Equation (12).
Hist(s)=Hist(s)+1 (12)
This count is performed in relation to all of the motion vectors Vi for which Si is equal to or greater than S_Thr and Ki is equal to or greater than K_Thr.
The inter-frame correction vector Vframe is set as a representative vector (for example, a centroid vector of a bin) representing the bin s having the highest frequency, as shown in Equation (13).
V
frame
=V
bin
s
|s=sup
s(Hist(s)) (13)
Here, Vbin
Next, referring to
Next, referring to
This invention is not limited to the embodiments described above, and may of course be subjected to various modifications within the scope of the technical spirit thereof.
The entire contents of JP2008-28029A, filed on Feb. 7, 2008, are incorporated into this specification by reference.
Number | Date | Country | Kind |
---|---|---|---|
2008-28029 | Feb 2008 | JP | national |