Patent Description:
Stereopsis is the process by which the human brain interprets an object's depth based on the relative displacement of the object as seen from the left and right eyes. The stereoscopic effect may be artificially induced by taking first and second images of a scene from first and second laterally offset viewing positions and presenting the images separately to each of the left and right eyes. By capturing a succession of stereoscopic image pairs in time, the image pairs may be successively presented to the eyes to form a stereoscopic movie that appears to the user as having three-dimensions.

Two traditional cameras may be used to acquire each of the images of a stereoscopic image pair. A traditional camera may be properly focused using an autofocus procedure which captures a plurality of images at different focal depths. The focal depth corresponding to the highest frequency content is then used for subsequent image captures. Traditional movie cameras may use this method to autofocus during video capture. However, the capture of frames will need to be periodically delayed while the autofocus functionality is performed.

While suitable for capturing 2D images with a single traditional camera, this autofocus technique may be unsuitable for stereoscopic image capture. In particular, the technique may disrupt the video stream and may be affected by camera movement, such as by the user's hand motions.

<CIT> concerns a device capable of executing automatic focusing processing or automatic exposing processing to a common range and obtaining stable stereoscopic video information which is easy to view and hardly fatigues an observer as a stereoscopic image pickup device using binocular parallax.

<CIT> relates to an electronic camera for producing an output image of a scene from a captured image signal includes a first imaging stage comprising a first image sensor for generating a first sensor output and a first lens for forming a first image of the scene on the first image sensor, and a second imaging stage comprising a second image sensor for generating a second sensor output and a second lens for forming a second image of
the scene on the second image sensor, where the lenses have different focal lengths. <CIT> relates to a three-dimensional shape computing apparatus and a three dimensional shape computing method. More specifically, the document relates to a three dimensional shape calculation apparatus and a three dimensional shape calculation method which eliminate an influence of lens aberration included in a stereo image taken by a camera (including a zoom camera) which performs photographing by changing an optical condition, and can accurately and efficiently perform three dimensional shape calculation by measuring a stereo image.

<CIT> relates to an image processing method and an image processing apparatus for restoring a <NUM>-dimensional scene from a stereo image. It is described that it is possible to use the disclosed invention in a wide range of fields using distance information, such as vision of an industrial machine or an intelligent robot and automatic focus detection of a camera.

<CIT> concerns a two dimensional/three dimensional (2D/3D) digital acquisition and display device for enabling users to capture 3D information using a single device.

<CIT> concerns a method of determining the distance between a surface patch of a <NUM>-D spatial scene and a camera system (<NUM>).

<CIT> concerns a computer vision/image processing method that generates a depth map useful in producing a foreground depth mask for 2D/3D image editing.

<CIT> relates to an image processing apparatus and method which perform stereo image processing for a plurality of images obtained by image-sensing a moving object from different points and detect the moving object on the image.

Certain embodiments contemplate a method in an electronic device for determining a focal depth for an image sensor. They method may comprise: receiving a first image associated with a first viewpoint; receiving a second image associated with a second viewpoint; determining a first plurality of keypoints based on the first image; correlating keypoints from the first plurality of keypoints with positions in the second image; determining a plurality of disparities associated with each of the first plurality of keypoints; and determining a focal depth based upon the plurality of disparities, the position of the first viewpoint and the position of the second viewpoint.

In certain embodiments, the method may further comprise determining a second plurality of keypoints based on the second image. In some embodiments, correlating keypoints from the first plurality of keypoints with positions in the second image comprises correlating keypoints from the first plurality of keypoints with keypoints from the second plurality of keypoints. In some embodiments, correlating keypoints from the first plurality of keypoints with positions in the second image comprises iterating over pixels within a search range in the second image. In some embodiments, correlating keypoints from the first plurality of keypoints with positions in the second image comprises determining the mean square error between pixels in the first image and the second image. In some embodiments, determining a first plurality of keypoints based on the first image comprises determining Scale Invariant Feature Transform (SIFT) keypoints based on the first image. In some embodiments, determining a first plurality of keypoints based on the first image comprises sub-sampling the first image, applying a high-pass filter to the first image, calculating the power of the first image, and thresholding the first image. In some embodiments, correlating keypoints from the first plurality of keypoints with positions.

The invention is defined by the claims and is not limited by embodiments given in the description. Where the description refers to embodiments that do not fall under the claimed subject-matter, these are to be understood as illustrative examples for illustrating the invention. in the second image occurs in realtime. In some embodiments, the electronic device comprises a mobile phone.

Certain embodiments contemplate a computer readable medium comprising instructions configured to cause a computer to perform the steps of: receiving a first image associated with a first viewpoint; receiving a second image associated with a second viewpoint; determining a first plurality of keypoints based on the first image; correlating keypoints from the first plurality of keypoints with positions in the second image; determining a plurality of disparities associated with each of the first plurality of keypoints; and determining a focal depth based upon the plurality of disparities, the position of the first viewpoint and the position of the second viewpoint.

In some embodiments, the instructions are also configured to cause the processor to determine a second plurality of keypoints based on the second image. In some embodiments, correlating keypoints from the first plurality of keypoints with positions in the second image comprises correlating keypoints from the first plurality of keypoints with keypoints from the second plurality of keypoints. In some embodiments, correlating keypoints from the first plurality of keypoints with positions in the second image comprises iterating over pixels within a search range in the second image. In some embodiments, correlating keypoints from the first plurality of keypoints with positions in the second image comprises determining the mean square error between pixels in the first image and the second image. In some embodiments, determining a first plurality of keypoints based on the first image comprises determining Scale Invariant Feature Transform (SIFT) keypoints based on the first image. In some embodiments, determining a first plurality of keypoints based on the first image comprises sub-sampling the first image, applying a high-pass filter to the first image, calculating the power of the first image, and thresholding the first image. In some embodiments, correlating keypoints from the first plurality of keypoints with positions in the second image occurs in realtime. In some embodiments, the computer is located in a mobile phone.

Certain embodiments contemplate a system for focusing a stereoscopic capture device. The system may comprise a first image sensor configured to generate a first image associated with a first viewpoint; a second image sensor configured to generate a second image associated with a second viewpoint; a feature generation module configured to determine a first plurality of keypoints based on the first image; a keypoint correlation module configured to correlate keypoints from the first plurality of keypoints with positions in the second image; a disparity determination module configured to determine a plurality of disparities associated with each of the first plurality of keypoints; and a depth determination module configured to determine a focal depth based upon the plurality of disparities, the position of the first viewpoint and the position of the second viewpoint.

In some embodiments, the feature generation module may be configured to determine a second plurality of keypoints based on the second image. In some embodiments, the software module configured to correlate keypoints is configured to correlate keypoints from the first plurality of keypoints with keypoints from the second plurality of keypoints. In some embodiments, the software module configured to correlate keypoints is configured to iterate over pixels within a search range in the second image. In some embodiments, correlating keypoints from the first plurality of keypoints with positions in the second image comprises determining the mean square error between pixels in the first image and the second image.

In some embodiments, the feature generation module is configured to determine Scale Invariant Feature Transform (SIFT) keypoints based on the first image. In some embodiments, the feature generation module is configured to sub-sample the first image, apply a high-pass filter to the first image, calculate the power of the first image, and threshold the first image.

In some embodiments, the software module configured to correlate keypoints correlates keypoints from the first plurality of keypoints with positions in the second image in realtime. In some embodiments, the stereoscopic capture device is located on a mobile phone. In some embodiments, the software module configured to determine a focal depth comprises a disparity histogram.

Certain embodiments contemplate a system for focusing a stereoscopic capture device, the system comprising: means for receiving a first image associated with a first viewpoint; means for receiving a second image associated with a second viewpoint; means for determining a first plurality of keypoints based on the first image; means for correlating keypoints from the first plurality of keypoints with positions in the second image; means for determining a plurality of disparities associated with each of the first plurality of keypoints; and means for determining a focal depth based upon the plurality of disparities, the position of the first viewpoint and the position of the second viewpoint.

In some embodiments the means for receiving a first image comprises a first sensor, the means for receiving a second image comprises a second sensor, the means for determining a first plurality of keypoints comprises a feature generation module, the means for correlating comprises a keypoint correlation module, the means for determining a plurality of disparities comprises a disparity determination module, and the means for determining a focal depth comprises a depth determination module. In some embodiments, the means for determining a first plurality of keypoints is configured to determine a second plurality of keypoints based on the second image. In some embodiments, the means for correlating keypoints from the first plurality of keypoints with positions in the second image is configured to correlate keypoints from the first plurality of keypoints with keypoints from the second plurality of keypoints. In some embodiments, the means for correlating keypoints from the first plurality of keypoints with positions in the second image is configured to iterate over pixels within a search range in the second image. In some embodiments, the means for correlating keypoints from the first plurality of keypoints with positions in the second image is configured to determine the mean square error between pixels in the first image and the second image. In some embodiments, the means for determining a first plurality of keypoints is configured to determine Scale Invariant Feature Transform (SIFT) keypoints based on the first image. In some embodiments, the means for determining a first plurality of keypoints is configured to sub-sample the first image, apply a high-pass filter to the first image, calculate the power of the first image, and threshold the first image. In some embodiments, the means for correlating keypoints correlates the keypoints from the first plurality of keypoints with positions in the second image in realtime. In some embodiments, the stereoscopic capture device is located on a mobile phone.

Embodiments relate to systems and methods of determining or setting configuration data in a stereoscopic camera. In one embodiment, the configuration data relates to the proper focal depth of the two lenses of the stereoscopic camera. In one embodiment, a first camera receives a first image from a scene and a second camera receives a second image of the same scene. A set of keypoints are determined from analysis of the first image. The keypoints, can be, for example, Keypoints may comprise any data structure which can be consistently replicated from a portion of an image and thereby permit unique identification of the image portion. In some embodiments, a keypoint may comprise a plurality of pixels corresponding to a portion of an image. The keypoint may be associated with a position in the image. After determining a keypoint in the first image, the system looks for a similar position in the second image. Once the similar position in the second image is identified, the system calculates the difference between the keypoints in the first image, and the corresponding position in the second image. This allows the system to determine the focal depth of the scene by knowing the disparity between the same keypoint positions in both frames, along with the positions of the stereoscopic lenses.

Present embodiments contemplate systems, apparatus, and methods to determine an appropriate focal depth for a sensor based upon at least a pair of stereoscopic images. Particularly, certain of the embodiments contemplate determining keypoints for each image, identifying correlations between the keypoints, and deriving object distances from the correlations. One skilled in the art will recognize that these embodiments may be implemented in hardware, software, firmware, or any combination thereof. The stereoscopic system may be implemented on a wide range of electronic devices, including mobile wireless communication devices, personal digital assistants (PDAs), laptop computers, desktop computers, digital cameras, digital recording devices, and the like.

<FIG> depicts a mobile device <NUM> comprising a sensor arrangement facilitating the capture of stereoscopic images, or other means for receiving an image. Such a device may be a mobile phone, personal digital assistant, gaming device, or the like. The device <NUM> may comprise a first sensor 101a and a second sensor 101b separated by a distance d. The device may also comprise user input controls <NUM> and a display <NUM>. In some embodiments, the sensors 101a and 101b may be situated such that they are horizontally, but not vertically, offset when the users holds device <NUM> so as to capture a stereoscopic picture or movie.

Although this particular device depicts two sensors 101a and 101b one skilled in the art may readily conceive of a stereoscopic image capture device which comprises more or less than two image sensors. For example, a device with only a single sensor may operate in combination with a series of lenses or reflecting surfaces to acquire two images at the positions of sensors 101a and 101b in rapid succession. This arrangement would likewise be able to acquire a stereoscopic image pair for use with the methods described below and the single sensor could be focused accordingly. Thus, the methods and systems discussed in this application will be applicable to any system which acquires two images from a first and second viewpoint, so long as those viewpoints facilitate a stereoscopic depiction of the image scene. Thus, reference to a pair of image sensors should not be considered to exclude the possibility of a single image sensor receiving images from two viewpoints.

<FIG> is a block diagram of certain of the components in a mobile device, such as the mobile device <NUM> depicted in <FIG>. Sensor 101a receives a first image of the stereoscopic image pair and sensor 101b receives a second image of the stereoscopic image pair. In some embodiments, the sensors may receive the images simultaneously. The device may comprise a video front end <NUM> and memory <NUM>. Video front end <NUM> may process incoming raw image data from sensors 101a and 101b and store the data in memory <NUM>. Memory <NUM> may also comprise various applications and software drivers for the mobile device <NUM>. For example, a display driver module <NUM> may be in communication with the display <NUM>. A user input module <NUM> may similarly be in communication with a user interface <NUM>. A wireless communication driver module <NUM> may be in communication with wireless communications hardware <NUM>.

The memory may also be in communication with a General Processor <NUM>. The General Processor <NUM> may comprise sub-processing units, or subprocessors, such as an Advanced RISC Machine (ARM), digital signal processor (DSP), or graphical processing unit (GPU). These processors may communicate with local memory <NUM> when handling various operations.

Certain of the present embodiments contemplate the addition of a "Focal Depth Analysis Module" 115a, 115b to the system architecture. In some embodiments, the module may take the form of a dedicated processor 115a, or a portion of a processor located on the general processor. In some embodiments the module may comprise software code 115b stored in a computer readable medium such as memory <NUM>. Some embodiments may place portions of the module at a dedicated processor 115a and memory 115b as firmware, or as a software-hardware combination. In some embodiments, the module may reside at any location in <FIG> which permits access to a feature generation system, such as a SIFT feature generation system, and to sensors 101a and 101b. Thus, the module may take advantage of preexisting hardware or software configured for feature generation and/or detection. One skilled in the art will recognize that the embodiments described below could be implemented using a subprocessor on the General Processor <NUM>, or could be stored as a separate application in memory <NUM>. In some embodiments the SIFT feature generation system may be found in software, whereas in other embodiments the SIFT feature generation system may be found in hardware.

Certain of the present embodiments provide auto-focus functionality which takes advantage of geometric properties of stereoscopic image capture. <FIG> depicts, via a top-down view, the stereoscopic image capture of an object <NUM> at a first position 300a and second position 300b using a stereoscopic camera arrangement. A first image capture device 301a may be located at a first position laterally separated from a second capture device 301b located at a second position. The first capture device 301a may capture a first image of the scene from the first position and the second capture device 301b may capture a second image of the scene from the second position. The first and second images will accordingly be associated with first and second viewpoints of the scene based on the positions and orientations of capture devices 301a and 301b. Object <NUM> may appear in both images. In some embodiments, capture device 301a and capture device 301b may be the same as sensors 101a and 101b of <FIG> respectively. Capture devices 301a, 301b may be calibrated to have no vertical disparity and to possess fairly close focal distances.

The center of device 301a's viewpoint passes along line 302a. Similarly, the center of device 301b's viewpoint passes along line 302b. These two centerlines intersect at the position <NUM>. As mentioned, the object <NUM> appears in each of the first and second images. With regard to position 300a, however, the object <NUM> appears to the right of centerline 302a, by an amount 305a and to the left of centerline 302b by an amount 305b. Conversely, in position 300b, the object <NUM> appears to the left of centerline 302a by an amount 306a, and to the right of centerline 302b, by an amount 306b. In this manner, the relative position of the object in the z-direction is reflected by the relative displacement in each of the left and right images.

Object disparity may be defined as the difference between an object's position in the first image as compared to the object's position in the second image. Where there is no vertical disparity between the capture devices, the disparity may comprise only the lateral offset from the position in one image to the position in another. One may arbitrarily take the disparity as the difference between the left and right, or right and left images. For the purposes of this description, the disparity is defined as the position of the object in the image from sensor 301b minus the position of the object in the image from sensor 301a (with the x-direction positive as indicated in <FIG>). Thus, negative disparity results from the depiction of object <NUM> in the position 300a and positive disparity results from the depiction of object <NUM> in the position 300b.

With knowledge of the sensor positions and relative orientations one can construct a graph of the relationship between the observed disparity and an object's distance, or depth, from the camera arrangement. <FIG>, for example, is a graph of this relationship for one particular sensor arrangement. As the disparity <NUM> increases, the object distance <NUM> increases as well. An initial negative disparity may be present for objects very near the camera arrangement, i.e. those having little depth <NUM> in the z-direction of <FIG>. As the object is moved further from the camera arrangement (i.e. the depth increases) the disparity becomes increasingly positive, beginning to plateau for objects at a considerable distance. One may recognize that the chart of <FIG> may depend upon the angles at which sensors 301a, 301b are oriented. Similarly, though the sensors may be parallel to one another as in <FIG> and <FIG>, displacement in the z and y directions between the sensors may also result in modifications to the graph. Such a graph may be stored in memory on the device, or in a similar storage structure for quick reference.

<FIG> is a top-down view of a scene comprising several objects. Again, image capture devices 301a and 301b may be used to acquire images 501a and 501b respectively. Objects <NUM>-<NUM>, are located at various depths within the scene. Consequently, disparities between the object positions in images 501a and 501b will be observed. <FIG> depicts the image 501a with certain of the disparity magnitudes and directions indicated at the pixel positions for which they occur. For example, a plurality of positive disparities <NUM> emerge for the distant object <NUM>, and a plurality of negative disparities <NUM> appear for the closer object <NUM>. With reference to the graph of <FIG>, an automated system may determine the depth associated with each disparity. For example, as shown in <FIG>, disparities of the same magnitude have been accumulated and plotted to form the disparity histogram <NUM>. The corresponding depths <NUM> may be derived from the relationship of the sensors to generate depth histogram <NUM>. The depth histogram <NUM> would suggest the presence of one or more objects in the region of each maximum at the indicated depth.

An autofocus operation comprises the determination of the proper focal depth for one or both of the sensors 101a, 101b. In some embodiments, the proper focal depth may be determined by taking the mean, median, or similar statistic of object depth histogram (or the object disparity histogram in conjunction with a graph such as <FIG>). The median statistic provides some robustness to outlying value while a special order statistic filter may be used to accommodate a particular application. The statistic selected may depend upon the relative weights to be given very distant and very close objects. For example, focal quality may be roughly the same through one range of depths, but vary dramatically in a second range. These variations are discussed in greater detail below.

While one could generate the disparity histogram <NUM> by determining the disparity of every pixel for every object found in each of the first and second images, this may be computationally expensive and impractical on a mobile device. Not only would the correlation of every pixel require iterating through a substantial number of pixels, but each image may comprise multiple pixels of the same value, making identification of an individual pixel and its correlation to an object in each image difficult.

In lieu of analyzing every pixel, the invention concerns creating a "sparse" disparity map or "sparse" corresponding depth map of the image contents. Keypoints may be determined in each of the images and the disparities between keypoints, or between keypoints and pixels, rather than between all or most of the pixels in the images, may be used to infer object depth. Since there are fewer keypoints than pixels, the consequent disparity or depth map is "sparse". Keypoints may comprise any data structure which can be consistently replicated from a portion of an image and thereby permit unique identification of the image portion. The keypoint may be associated with a position in the image. The keypoint's unique determination permits the keypoints to be identified from similar or identical portions in a second image. In some embodiments, keypoints may comprise Scale Invariant Feature Transform (SIFT) keypoints, or keypoints of a similar feature generation module. In some embodiments, the system may reuse machine vision components preexisting in the general processor <NUM> or subprocessors to determine keypoints. For example, high pass filtering blocks may be reused for keypoint detection. Alternatively, software libraries for performing machine vision operations stored in memory <NUM> may be used to generate keypoints. In this manner, certain implementations may economically take advantage of functionality associated with other applications to generate keypoints for performing autofocus. Alternative means for determining a plurality of keypoints, such as feature generation modules employing algorithms other than SIFT, are described in greater detail below.

<FIG> is a flow diagram depicting an autofocus process <NUM> for stereoscopic image capture, which may be implemented by certain of the present embodiments. The process begins <NUM> by acquiring, or receiving, at least a pair of stereoscopic images <NUM>. Certain embodiments contemplate cropping a region of interest from each of the images, so as to reduce computation time. Once the images are received, the system determines keypoints from the first image <NUM>. As mentioned, in some embodiments these keypoints may be determined using SIFT or other feature detection hardware, firmware, or software. In some embodiments, the system may also determine keypoints in the second image. The system may then correlate keypoints from the first image with pixel regions (such as a particular pixel position) in the second image <NUM>. A "keypoint correlation" software, firmware, or hardware module may be configured to perform this operation. Certain portions of the operation may distributed among other modules (firmware, hardware, or software), creating other means for correlating keypoints. This operation may serve to identify the same image region in the first image in the second image.

Disparities D may then be calculated between each keypoint position of the first image and the correlated pixel positions of the second image <NUM>. Where keypoints have been calculated for both images, the disparities between the keypoints may be determined by subtracting the relative positions of each of the correlated keypoints. The disparities may then be organized as a disparity histogram similar to <NUM> of <FIG> and a corresponding depth histogram, similar to histogram <NUM>, may be determined. The depth histogram may then be used to determine the optimal focal depth for the sensor based on the selected statistic. A "disparity determination" software, firmware, or hardware module may be configured to perform this operation. Certain portions of the operation may distributed among other modules (firmware, hardware, or software), creating other means for determining disparities.

In the embodiments implementing process <NUM>, to improve computation efficiency, the process <NUM> determines the statistic (in this case, the average) of the disparities <NUM> rather than converting to a depth for each disparity and then determining the average of the depths. Only the depth of the single statistical value need then be determined <NUM> with reference to a graph similar to that of <FIG>. This depth may then be used as the new camera focus depth <NUM> during subsequent image captures. As mentioned, other embodiments may instead convert each of the disparities to a depth and then average the depths. Other embodiments may alternatively take the mean, median, or some other statistic to determine the desired focal depth. A "depth determination" software, firmware, or hardware module may be configured to perform this operation. The module may operate in conjunction with a disparity histogram. Certain portions of the operation may distributed among other modules (firmware, hardware, or software), creating other means for determining a focal depth. Once the focus depth has been determined, image sensor 101a may be adjusted. Sensor 101b may also be adjusted by the processor <NUM>, or sensor 101b may track the focal depth of sensor 101a independently. As mentioned above, in certain embodiments, only a single sensor may be adjusted based upon the determined focal depth.

In variations of these embodiments, the system may alternatively use information from the scene to determine the depth, rather than simply take the average of the disparities. For example, in lieu of taking the average, keypoint disparities may be weighted based upon their presence in a single object and upon lighting conditions. For example, the histograms may be enhanced by weighting each point from the histogram by the focal quality associated with a certain focus distance. In certain camera arrangements if the focal point was set to <NUM> meters, objects between <NUM> and infinity may have good focus, objects between <NUM>-<NUM> may have fair focus, and objects between <NUM>-<NUM> may have bad focus. The histograms of <FIG> would accordingly be weighted so that a preferred focal range was selected more often than the other ranges. This may be referred to as a "region weighted saliency" in certain embodiments. In other variations, frequency information from the image may be incorporated into the keypoints selection. Objects comprising textures may generate more keypoints than objects without textures or with little texture, and thereby affect the average. Accordingly, keypoints associated with textured objects may receive different weights from non-textured objects. In one variation, regions within a texture may be detected and these regions then used so as to lower the weight for keypoints in that region.

When capturing a stereoscopic movie, the process <NUM> may be applied to a single frame, i.e. a single pair of stereoscopic images. The determined focal depth may then be used by the image sensors during subsequent image captures until the camera arrangement or scene is modified so as to necessitate reassessment of the proper focus. The operation <NUM> therefore has the benefit that there need not be any state dependency. That is, a traditional auto-focus system would need to periodically timeout the movie capture process and capture multiple focal depths to reassess the focus. Process <NUM>, in contrast, may be "instantaneous" in that it produces no frame delay. This facilitates seamless focus tracking. The process may further guarantee system stability, as there is no feedback (or dependency) between the current focus position and the focus position estimation. Additionally, since the focus operation may be accomplished with a single frame, the user's hand motion will be less likely to generate any blur.

As mentioned, the keypoints generated in steps <NUM> and <NUM> of process <NUM> may comprise any data structure which can assign an identity to a portion of the image and be consistently recognized when applied to the second image. As mentioned, in some embodiments the keypoints may comprise Scale Invariant Feature Transform (SIFT) keypoints generated from a SIFT feature generation module. <FIG> depicts another possible process for generating keypoints in a feature generation module.

The process <NUM> begins <NUM> by receiving <NUM> one of the pair of raw stereoscopic images. The image may then be subsampled <NUM>, possibly to improve the algorithm's robustness to noise and to decrease computational demands. The image may then be passed through a horizontal high pass filter <NUM>. In some embodiments, the filter may comprise a 3x4 kernel with a response given by <MAT>.

The process may then calculate the power <NUM> of the image, i.e. by taking the square of each value. Finally, the process may threshold the values <NUM> to eliminate noise and low-power values. From among the remaining values which exceeded the threshold, the system will identify "maximum values". In some embodiments the maximum values may be those image portions which exceeded the threshold, while in other embodiments the maximum values may be defined relative to their local neighbors. For example, the delta between neighboring pixels exceeding the threshold may be used to identify a maximum value. The identified maximum values represent keypoint positions which may be used for the disparity determination steps described above. The system may store these keypoint positions <NUM> before ending <NUM>. By subsampling and thresholding the image in this manner the computation time required to determine pixel locations which may serve as keypoints may be reduced. As a keypoint in these embodiments comprises a pixel position, the pixel position may occasionally be referred to as a "keypoint". However, one will readily recognize variations, wherein keypoints comprise both a position and an array of the neighboring pixel values and positions. Keypoints may also refer to frequency content of an image portion or to gradients in pixel value, rather than to pixel values or pixel positions directly. SIFT keypoints, for example, may comprise a vector indicating the pixel gradient.

Once the keypoints in the first image have been determined, it may still remain to correlate the keypoints with positions in the second image so that the disparities between image portions may be determined. A possible method for determining whether keypoints, such as the keypoints generated by the process <NUM> of <FIG>, are correlated with a position in an image will now be described with respect to <FIG> depicts stereoscopic image pair 900a and 900b. Based on the configuration of the two sensors used to capture images 900a and 900b, a search region <NUM> around each keypoint <NUM> may be determined. The search region <NUM> may specify the maximum distance a keypoint may be displaced in the left and right images (i.e., a maximum expected disparity) as a consequence of the capture device configuration. In some embodiments, as the image sensors may lack vertical disparity, keypoints <NUM> may generally lie on vertical edges in the scene.

Search region <NUM> is located in the same absolute position of each of images 900a and 900b. In <FIG>, search region <NUM> comprises a rectangle having the height of a single pixel, since it is assumed that no vertical disparity between images 900a and 900b exists (i.e. only pixels in a same row are considered). The height of the region <NUM> may be increased in relation to the amount of vertical disparity that may be present between images 900a and 900b. The system may iterate through each pixel in the search region <NUM> of the second image 900b and determine the pixel's correspondence with the portions of image 900a surrounding the keypoint <NUM>. This may be accomplished in some embodiments using a correlation metric described in further detail below.

In certain embodiments, keypoints may have been determined for both image 900a and image 900b, rather than simply for image 900a. When attempting to correlate keypoints between the images, the system may identify keypoints within the search region <NUM> in the second image 900b. If only one keypoint of image 900b is found in search region <NUM>, this keypoint may be correlated with the keypoint <NUM> from the first image. Where more than one keypoint of image 900b is present in the region <NUM>, the system may apply a correlation metric to each keypoint of image 900b in the search region <NUM> to determine which keypoint best corresponds with the keypoint <NUM> from the first image. As with metrics applied when keypoints are taken for only one image, the metric may consider pixel values neighboring the pixel positions of keypoints <NUM> and 901b to verify that keypoints <NUM> and 901b are more likely to refer to the same portion of the scene in each of images 900a and 900b. Where keypoints are created for both images, it may be necessary only to iterate between keypoints in the region <NUM> rather than between each pixel within the region.

In the embodiments described above, the system iterates through certain of the pixels in the search region <NUM> corresponding to the determined keypoint <NUM>. The system may apply a correlation metric to each pixel in the region <NUM>. The pixel in the region <NUM> having the maximum correlation with the region surrounding the position of keypoint <NUM> may then be correlated with the keypoint <NUM>. The computational cost to iterate through each pixel of image 900b in the range <NUM> may be less than the cost to compute keypoints for all of image 900b and to then determine the correlations between each keypoint. In some embodiments, however, where only a few keypoints have been generated, the system may determine correlations between all the keypoints directly, rather than iterate between regions <NUM> associated with the keypoints of one image.

In certain embodiments, the correlation metric used to identify a keypoint or pixel position in image 900b corresponding to a keypoint in 900a may comprise the calculation of the mean square error for pixels surrounding a position in image 900b under consideration and the pixels surrounding the keypoint position in image 900a. That is, the mean square error of pixels neighboring keypoint <NUM> of the first image and the neighboring pixels for positions in search region <NUM> in image 900b may be used as a correlation metric. The mean square error may be calculated as: <MAT> where R is the mean squared error, Sleft comprises the pixel values in the image 900a, Sright comprises the pixel values in the image 900b, M and N comprise the horizontal and vertical offsets into the image to the region <NUM> for the current keypoint or pixel position of region <NUM> under investigation, and Δ comprises the horizontal shift applied for the current position in the search region <NUM> (the first parameter to Sleft and Sright is a column position/x-axis and the second a row position/y-axis). Although the mean squared error is within a 7x7 window in the above example, one may readily envision a range of window dimensions depending upon the resolution of the image and the subsampling applied. Furthermore, as sensors 101a and 101b are presumed not to have any vertical disparity in the above example, the search region <NUM> extends only horizontally and Δ appears only in the x-axis/column direction. More robust systems may compensate for errors in sensor positioning by increasing the height of the search region <NUM> and including a Δ in the vertical direction. As the image has been downsampled, sub pixel resolution may be determined using interpolation, such as polynomial interpolation, in some embodiments to facilitate more accurate determinations of the pixel in region <NUM> of image 900b correlated with the keypoint <NUM>. That is, the displacement of sensor 101b relative to sensor 101a may not be an exact, integer number of pixels. Thus, particularly after sub-sampling, accurate correlation of the keypoint <NUM> may require including locations between pixels in the search region <NUM>. The, position in region <NUM> of image 900b maximally correlated with keypoint <NUM> may fall between pixel positions, at an interpolated point.

The various illustrative logical blocks, modules, and circuits described in connection with the implementations disclosed herein may be implemented or performed with a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein.

The steps of a method or process described in connection with the implementations disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of non-transitory storage medium known in the art. An exemplary computer-readable storage medium is coupled to the processor such the processor can read information from, and write information to, the computer-readable storage medium. The ASIC may reside in a user terminal, camera, or other device. In the alternative, the processor and the storage medium may reside as discrete components in a user terminal, camera, or other device.

Headings are included herein for reference and to aid in locating various sections. These headings are not intended to limit the scope of the concepts described with respect thereto. Such concepts may have applicability throughout the entire specification.

Claim 1:
An autofocus method in an electronic device for determining a depth to focus at for an image sensor, comprising:
receiving (<NUM>) a first image associated with a first viewpoint;
receiving (<NUM>) a second image associated with a second viewpoint;
determining (<NUM>) a first plurality of keypoints based on the first image, wherein the determined plurality of keypoints is less than a total number of pixels in the first image;
correlating (<NUM>) keypoints from the first plurality of keypoints with positions in the second image;
determining (<NUM>) a plurality of disparities associated with the first plurality of keypoints;
determining (<NUM>) a statistical value of the plurality of disparities;
determining (<NUM>) a depth to focus at based on the statistical value of the plurality of disparities and a relationship between pixel disparities and object distances, and
wherein the determined depth to focus at is for use by the image sensor during subsequent image captures.