Motion-Based Image Stitching
This disclosure relates generally to the field of image processing. More particularly, but not by way of limitation, this disclosure relates to techniques for improving real-time panoramic photography processing using motion data (e.g., gyroscopic sensor input). Panoramic photography may be defined generally as a photographic technique for capturing images with elongated fields of view. An image showing a field of view approximating, or greater than, that of the human eye, e.g., about 160° wide by 75° high, is usually termed “panoramic.” Thus, panoramic images generally have an aspect ratio of at least 2:1, meaning that the image is at least twice as wide as it is high (or, conversely, twice as high as it is wide, in the case of vertical panoramic images). In some embodiments, panoramic images may even cover fields of view of up to 360 degrees, i.e., a “full rotation” panoramic image. There are many challenges associated with taking visually appealing panoramic images. These challenges include photographic problems such as: difficulty in determining appropriate exposure settings caused by differences in lighting conditions across the panoramic scene; blurring across the seams of images caused by motion of objects within the panoramic scene; parallax problems (i.e., problems caused by the apparent displacement or difference in the apparent position of an object in the panoramic scene as the image capture device is panned); properly aligning the various images used to construct the overall panoramic image; blending between the overlapping regions of various images used to construct the overall panoramic image; choosing an image projection correction that does not distort photographically important parts of the panoramic photograph (e.g., rectangular, cylindrical, Mercator); and correcting for perspective changes between subsequently captured images. Some prior art panoramic photography systems may utilize gyroscopic information to assist in image analysis and registration. As the number of images within a given time period that are aligned to generate a panoramic image increases, however, the computational costs of performing image analysis and registration can become prohibitive. This may be particularly true for image capture devices embedded in handheld electronic devices such as mobile phones, personal data assistants (PDAs), portable music players, digital cameras, as well as laptop and tablet computer systems. In one embodiment the invention provides a method to align or stitch together digital images without analyzing the image or performing standard image registration (both computationally expensive operations). The method includes obtaining a first image from an image capture device (e.g., a digital camera), the image capture device having one or more image capture parameters (e.g., focal length and principal point), the image capture parameters having first values for the first image. At substantially the same time, motion information for the first image may be obtained (e.g., from a gyroscopic and/or accelerometer sensors). A second image may then be obtained having second image capture parameter values. As with the first image, motion data for the second image may be obtained at substantially the same time that the second image is obtained. Relative motion between the two images (i.e., due to motion of the image capture device) may be determined. The second image may then be aligned with the first image using the first and second image capture parameter values and the determined relative motion. It is significant that the two images may be aligned without the need to analyze the images. When motion data comes from a gyroscopic sensor, the motion data for each image may be integrated to obtain instantaneous position information. This position information may be used to determine the relative motion between the two images. In another embodiment, the image capture parameter values may be used to determine intrinsic matrices for each image. These matrices, and the determined relative motion between the two images, may be used to generate a perspective transform matrix. Applying the perspective transform to the second image permits it to be aligned with the first image The disclosed methods may be embodied in program code and stored on a non-transitory storage medium. The stored program code may be executed by a programmable control device that is part of, or controls, an image capture device. This disclosure pertains to systems, methods, and computer readable media for stitching or aligning multiple images (or portions of images) to generate a panoramic image. In general, techniques are disclosed for using motion data (captured at substantially the same time as image data) to align images rather than performing image analysis and/or registration operations. More particularly, motion data may be used to identify the rotational change between successive images. The identified rotational change, in turn, may be used to generate a transform that, when applied to an image allows it to be aligned with a previously captured image. In this way, images may be aligned in real-time using only motion data. In the following description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the inventive concept. As part of this description, some structures and devices may be shown in block diagram form in order to avoid obscuring the invention. Moreover, the language used in this disclosure has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter, resort to the claims being necessary to determine such inventive subject matter. Reference in the specification to “one embodiment” or to “an embodiment” means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the invention, and multiple references to “one embodiment” or “an embodiment” should not be understood as necessarily all referring to the same embodiment. It will be appreciated that in the development of any actual implementation (as in any development project), numerous decisions must be made to achieve the developers' specific goals (e.g., compliance with system- and business-related constraints), and that these goals will vary from one implementation to another. It will also be appreciated that such development efforts might be complex and time-consuming, but would nevertheless be a routine undertaking for those of ordinary skill in the image processing field having the benefit of this disclosure. Referring to Referring to It will be understood that images captured in accordance with block 110 (e.g., by sensor array 200) and motion data captured in accordance with block 120 (e.g., by gyro sensor 205) should be correlated. It is important that an image captured at time t0be synchronized with motion data captured at substantially the same time. In the embodiment illustrated in Referring to Referring to Referring to A perspective transform matrix for a given image may be derived as follows. First, it will be recognized by those of skill in the art that the 2D projection of real-space (which is 3D) onto a sensor array (which is 2D) may be given as— where represents a point in real-space, Π represents the image capture device's intrinsic matrix and represents the 2D projection of the real-space point onto the sensor array's plane using homogeneous coordinates. In essence, EQ. 1 represents a 3D-to-2D transformation. A novel use of this known relationship was to recognize that— where is as described above represents an estimate of where that point is in real-space, and Π−1represents the inverse of the image capture device's intrinsic matrix. Thus, EQ. 2 represents a 3D-to-2D transformation estimator. Based on the discussion above regarding where represents the real-space location of a point at time t0(as reflected in the image captured at time t0), [R01] represents the rotation matrix for image-1 from time t0(and image I0) to time t1, and represents the location of the same point after being rotated as characterized by [R01]. From EQ. 1 we may obtain— where Π1represents the image capture device's intrinsic matrix at time t1. Substituting EQ. 3 into EQ. 4 yields— From EQ. 2, we have— Substituting EQ. 6 into EQ. 5 gives— which may be rewritten as— where [P01] represents the perspective transform matrix for image-1. Equations 7 and 8 describe how a point in an image captured at time t0moved to a new position at time t1due to rotation of the image capture device as represented by rotation matrix [R01]. (It is also noted [P01] incorporates the image capture device's parameters (e.g., focal length) at times t0and t1.) It is significant to note, perspective transform [P01] permits alignment of image-1 with image-0 without any image processing operations (i.e., analysis and/or registration). More particularly, perspective transform [P01] is based solely on the image capture device's parameter values (e.g., focal length) and rotational information (e.g., from a gyro) for each image. It will be recognized that this information is computationally inexpensive to obtain and process, allowing image stitching operations in accordance with this disclosure to be performed quickly and at low computational cost. This, in turn, may support high image capture rates. It is also noted that the methodologies disclosed herein may be used to complement traditional image registration methods. Referring to Image stitching operations have, so far, been described in terms of whole images. That is, a first image stitched to, or aligned with, another image. The disclosed techniques, however, are equally applicable to portions of images. Referring to Referring to Referring to Referring to Referring now to Processor 1005 may be any suitable programmable control device and may control the operation of many functions, such as the generation and/or processing of image metadata, as well as other functions performed by electronic device 1000. Processor 1005 may drive display 1010 and may receive user input from user interface 1045. An embedded processor, such a Cortex® A8 with the ARM® v7-A architecture, may provide a versatile and robust programmable control device that may be utilized for carrying out the disclosed techniques. (CORTEX® and ARM® are registered trademarks of the ARM Limited Company of the United Kingdom.) Memory 1050 may include one or more different types of storage media used by processor 1005 to perform device functions. Memory 1050 may include cache, read-only memory (ROM), and/or random access memory (RAM). Communications bus 1060 may provide a data transfer path for transferring data to, from, or between at least storage device 1055, memory 1050, processor 1005, and camera circuitry 1040. User interface 1045 may allow a user to interact with electronic device 1000 through a variety of forms, such as a button, keypad, dial, click wheel, or a touch screen. Non-transitory storage device 1055 may store media (e.g., image and video files), computer program instructions or software, preference information, device profile information, and any other suitable data. Storage device 1055 may include one more storage mediums including, for example, magnetic disks (fixed, floppy, and removable) and tape, optical media such as CD-ROMs and digital video disks (DVDs), and semiconductor memory devices such as Electrically Programmable Read-Only Memory (EPROM), and Electrically Erasable Programmable Read-Only Memory (EEPROM). Software may be organized into one or more modules and be written in any suitable computer programming language (or more than one language). When executed by, for example, processor 1005 such computer program code or software may implement one or more of the methods described herein. Each module may be stored in a different storage device or memory and may be executed by one or more processors. Various changes in the materials, components, circuit elements, as well as in the details of the illustrated operational methods are possible without departing from the scope of the following claims. For instance, processor 1005 may be implemented using two or more program control devices or processing units communicatively coupled. Each program control device may include the above-cited processors, special purpose processors such as graphics processing units (GPUs) and custom designed state machines that may be embodied in a hardware device such as an application specific integrated circuit (ASIC) or a field programmable gate array (FPGA). Finally, it is to be understood that the above description is intended to be illustrative, and not restrictive. For example, the above-described embodiments may be used in combination with each other. Many other embodiments will be apparent to those of skill in the art upon reviewing the above description. The scope of the invention therefore should be determined with reference to the appended claims, along with the full scope of equivalents to which such claims are entitled. In the appended claims, the terms “including” and “in which” are used as the plain-English equivalents of the respective terms “comprising” and “wherein.” Systems, methods, and computer readable media for stitching or aligning multiple images (or portions of images) to generate a panoramic image are described. In general, techniques are disclosed for using motion data (captured at substantially the same time as image data) to align images rather than performing image analysis and/or registration operations. More particularly, motion data may be used to identify the rotational change between successive images. The identified rotational change, in turn, may be used to generate a transform that, when applied to an image allows it to be aligned with a previously captured image. In this way, images may be aligned in real-time using only motion data. 1. A non-transitory storage device, comprising:
computer code to obtain a first image from a device having one or more image capture parameters, the image capture parameters having first values for the first image; computer code to obtain first motion data for the first image; computer code to obtain a second image from the device, the image capture parameters having second values for the second image; computer code to obtain second motion data for the second image; computer code to determine a relative motion between the first and second images based on the first and second motion data; and computer code to align the second image with the first image in a memory based solely on the first and second values and the relative motion between the first and second images. 2. The non-transitory storage device of computer code to obtain motion information from the device at substantially the same time as the first image is obtained; computer code to determine position information for the first image based on the motion information; and computer code to attach the position information for the first image to the first image. 3. The non-transitory storage device of the computer code to obtain motion information for the device comprises computer code to obtain gyroscopic sensor data; and the computer code to determine position information comprises computer code to integrate the gyroscopic sensor data. 4. The non-transitory storage device of 5. The non-transitory storage device of computer code to determine a first intrinsic matrix for the first image based on the first values; and computer code to determine a second intrinsic matrix for the second image based on the second values. 6. The non-transitory storage device of 7. The non-transitory storage device of 8. A digital image stitching method, comprising:
obtaining a first image from a device having one or more image capture parameters, the image capture parameters having first values for the first image; obtaining first motion data for the first image; obtaining a second image from the device, the image capture parameters having second values for the second image; obtaining second motion data for the second image; determining a relative motion between the first and second images based on the first and second motion data; and aligning the second image with the first image in a memory based solely on the first and second values and the relative motion between the first and second images. 9. The method of obtaining motion information from the device at substantially the same time as the act of obtaining the first image is performed; determining position information for the first image based on the motion information; and attaching the position information for the first image to the first image. 10. The method of the act of obtaining motion information from the device comprises obtaining gyroscopic sensor data; and the act of determining location information comprises integrating the gyroscopic sensor data. 11. The method of 12. The method of determining a first intrinsic matrix for the first image based on the first values; and determining a second intrinsic matrix for the second image based on the second values. 13. The method of 14. The method of 15. An digital image capture device having one or more image capture parameters, comprising:
an image sensor; a motion sensor operatively coupled to the motion sensor; a memory operatively coupled to the image and motion sensors; and a programmable control device communicatively coupled to the image sensor, motion sensor and memory, the programmable control device adapted to execute program code stored in the memory to—
obtain a first image from the image sensor, the image capture parameters having first values for the first image, obtain first motion data from the motion sensor for the first image, obtain a second image from the image sensor, the image capture parameters having second values for the second image, obtain second motion data from the motion sensor for the second image, determine a relative motion between the first and second images based on the first and second motion data, and align the second image with the first image in a memory based solely on the first and second values and the relative motion between the first and second images. 16. The digital image capture device of 17. The digital image capture device of computer code to obtain motion information from the digital image capture device at substantially the same time as the first image is obtained; computer code to determine position information for the first image based on the motion information; and computer code to attach the position information for the first image to the first image. 18. The digital image capture device of 19. The digital image capture device of 20. The digital image capture device of computer code to determine a first intrinsic matrix for the first image based on the first values; and computer code to determine a second intrinsic matrix for the second image based on the second values. 21. The digital image capture device of 22. The digital image capture device of 23. A non-transitory storage device, comprising:
computer code to obtain a first image at a first time, the first image having first image capture parameter values; computer code to determine a first intrinsic matrix for the first image based at least in part on the first image capture parameter values; and computer code to obtain first motion data for the first image, at substantially the first time, from a gyroscopic sensor; computer code to obtain a second image at a second time, the second image having second image capture parameter values; computer code to determine a second intrinsic matrix for the second image based at least in part on the second image capture parameter values; computer code to obtain second motion data for the second image, at substantially the second time, from the gyroscopic sensor; computer code to determine a relative motion between the first and second images based on the first and second motion data; computer code to determine a perspective transform matrix for the second image based on the first and second intrinsic matrices and the relative motion between the first and second images; computer code to apply the perspective transform matrix to the second image; and computer code to align the second image with the first image in a memory after the perspective transform matrix has been applied to the second image. 24. The non-transitory storage device of BACKGROUND
SUMMARY
BRIEF DESCRIPTION OF THE DRAWINGS
DETAILED DESCRIPTION