Abstract:
A rolling shutter digital camera. Each photographic image of a given exposure duration is captured as a multi-frame burst of frames each having a shorter exposure duration to minimize motion blur and to reduce sensor noise by averaging. Each frame is quantized into swaths, captured sequentially by the rolling shutter. Swaths of the first frames are analyzed to select a set of best motion detection reference regions. Swaths of subsequent frames are analyzed versus only those regions, to reduce required computation, and are re-registered accordingly. Corresponding swaths of each frame are accumulated. The accumulator is normalized to the desired bit depth and written as the final image. Averaging of the multiple frames is improved by re-registering swaths rather than entire frames, because of the time delta caused by the rolling shutter. Computation is further reduced by selecting candidate points only along a key line of each swath of the first frame, and still further by pre-limiting the search by using a thumbnail version of the first frame to cull most candidate points. Thresholds are used to ensure adequate motion detection regions are used for each swath.

Description:
BACKGROUND OF THE INVENTION 
     1. Technical Field of the Invention 
     This invention relates generally to deblurring of still images such as those captured by digital cameras, and more specifically to deblurring still images generated as a multi-frame full resolution image and especially those produced by a camera having a rolling shutter, meaning that the pixels of the frame are captured at different times. 
     2. Background Art 
     A digital camera includes a lens mechanism having a fixed or variable shutter and a fixed or variable aperture, and a sensor having a fixed or variable sensitivity. The terms ISO and SOS refer to different but related methods of measuring the effective, useable speed of a sensor. This disclosure will refer simply to these as “sensor speed” so as to not specifically distinguish between ISO and SOS characteristics. The term “shutter speed” will refer to the duration of the opening of the shutter. 
     Adjusting a digital camera&#39;s sensor speed upward enables the use of a faster shutter speed but tends to increase the noisiness of the resulting image, and adjusting it downward tends to decrease the noisiness but increases the required exposure duration. 
     Slow shutter speeds tend to result in blurred images, caused by motion of the camera and/or the photographed subject. This motion causes a time-dependent smearing in which the photons captured from a specific subject location fall upon different sensor locations. This will be referred to as “motion blur”. 
     Some cameras have been adapted to reduce noise and motion blur by using what may be termed “multi-frame compositing”. Rather than capturing a photograph by taking a single frame at e.g. 1/30 second shutter duration, which is likely to produce significant motion blur, an extremely rapid burst of e.g. three frames is taken at 1/90 second each, and the three frames are overlayed to produce the final image. 
     In the simplistic case, the frames are simply directly overlayed and the corresponding pixel values are added or perhaps averaged, depending upon the camera. While this helps reduce noise in a sqrt(n) manner for n averaged frames, it does not reduce motion blur. 
     To reduce motion blur, some cameras apply motion compensation to the burst frames, attempting to move each to the same registration versus the sensor. Typically, this is done using edge detection techniques which identify object edges and other localized regions in the image which exhibit high “activity levels”, meaning lots of difference from surrounding pixels. Most edge detection is done primarily or exclusively with the luminance (Y′) values of the pixels in a YUV or Y′CbCr color space, ignoring the chrominance values. Brightness differences are generally a much better indicator of an edge than are color differences. In these cameras, the motion vector estimation is performed on the entire image (or, more exactly, the entire N th  frame versus the entire 1 st  frame), or perhaps a portion of the image, to determine a single motion vector, and the entire N th  frame is moved in the opposite vector and composited with the 1 st  frame. 
     Most cameras, especially higher priced ones, use a “full frame” shutter which effectively exposes the entire sensor from the same opening time to the same closing time (except of course for the extremely small time differences caused by the motion of the aperture mechanism, which is so small as compared to the exposure duration as to be ignorable for these purposes). 
     More recently, some inexpensive cameras have been equipped with a “rolling shutter” mechanism which exposes different regions of the sensor at meaningfully different times. For example, a rolling shutter may expose each pixel for 1/90 second but take 1/9 second to expose the entire sensor. In other words, it takes 1/9 second to travel from the first line of the sensor to the last line of the sensor. Because each pixel is exposed for only 1/90 second, each pixel will not have significant motion blur. However, because there is 1/9 second between when the first row of pixels is exposed and when the last row of pixels is exposed, the subject and/or camera may have moved significantly. 
     What is needed is an improved camera apparatus and method for recompositing multi-frame images, which compensate for the motion-induced de-registration caused by a rolling shutter. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         FIG. 1  shows an exemplary scene to be photographed using a digital camera. 
         FIG. 2  shows the first frame of a multi-frame digital photograph of the scene of  FIG. 1 , and the logical division of the frame into horizontal swaths for dealing with the rolling shutter. 
         FIG. 3  shows the frame of  FIG. 2  reduced to a thumbnail image. 
         FIG. 4  shows a candidate matrix identifying pixel locations in the thumbnail image that have a high activity level and are likely to be edges or the like. 
         FIG. 5  shows key lines and stride points used for selecting pixel regions that will be used in motion detection. 
         FIG. 6  shows a second frame of the multi-frame digital photograph, demonstrating (in a quantized manner) the effect of camera motion for a camera having a rolling shutter. 
         FIG. 7  shows corresponding swaths of the frames of  FIGS. 2 and 6 , demonstrating the de-registering effect of camera motion for a camera having a rolling shutter. 
         FIG. 8  shows-an analysis of the second frame of  FIG. 6 , using selected points along a key line of each frame. 
         FIG. 9  shows an edge matrix used to record a final selection of motion detection pixel regions. 
         FIG. 10  shows the second frame of  FIG. 7  after the swaths have been re-registered to correct for camera motion. 
         FIG. 11  shows a block diagram of a digital camera including means for performing the method of this invention. 
     
    
    
     DETAILED DESCRIPTION 
     The invention will be understood more fully from the detailed description given below and from the accompanying drawings of embodiments of the invention which, however, should not be taken to limit the invention to the specific embodiments described, but are for explanation and understanding only. 
       FIG. 11  illustrates a digital camera in which this invention may be practiced. For ease of illustration, various well-known components have been omitted from the drawing, such as lens elements, battery, user controls, body or frame, removable memory card and its slot, autofocus mechanism, and so forth. 
     The digital camera includes a sensor which may be a CCD charge coupled device, a CMOS circuit, or any other suitable means of digitally capturing photons (in or out of the visible spectrum) from a subject and from them generating an electronic representation of the subject. The sensor is equipped with a rolling shutter mechanism which, in this instance, scans the sensor from top to bottom. The camera includes a processor, which may be characterized as a digital signal processor, a microprocessor, a microcontroller, or the like. The processor may be constructed as a single, monolithic, integrated circuit, or as two or more separate ICs or other logic. 
     The processor is coupled to send control signals to the sensor and to receive pixel data from the sensor. The camera further includes a memory, which typically includes some amount of flash or other non-volatile memory, some of which may be removable, as well as a smaller amount of SRAM or DRAM configured as a high speed buffer for storing pixel data from the sensor as it is written to the slower non-volatile memory. Optionally, some or all of the buffer may be fabricated on the same IC as the processor, like an on-die cache memory. The details of the memory organization are not germane to this invention, so the memory is shown simply as a single entity. In some embodiments, the pixel data may travel from the sensor to the processor and then from the processor to the memory. In other embodiments, the sensor may be equipped with its own logic for performing direct memory access (DMA) to the memory, bypassing the processor. 
     The reader should continue to refer to  FIG. 11  throughout the remainder of this disclosure, as the method of the invention will be explained with reference to various memory structures and to routines which reside in memory. 
     At a high level, the camera captures an image (“takes a picture”) by capturing a rapid burst of images (“frames”) from the sensor, and then amalgamating them into a final image which is written to a multi-image storage area in the memory. 
     It is highly desirable to reduce or eliminate errors in registration of the multiple frames. 
     The designer may make a variety of tradeoffs in configuring the operational routines that are performed by the camera, according to the parameters of the application at hand. For example, the buffer memory (or total memory other than the multi-image storage area) may be small, forcing the programmer to optimize his code for memory footprint. Or, the processor may have only a small amount of computational power or throughput, forcing the programmer to adjust parameters so that image quality may be sacrificed for faster execution speed. 
     In order to reduce computation and simplify motion detection, it is preferable to perform motion detection in the Y′CbCr or other luminance-with-color color space, using only the Y′ luma component in calculating frame-to-frame motion. The alternative is to perform motion detection on each color, and then somehow decide which color represents the motion. The latter approach complicates processing for no real gain in final image quality. If the sensor produces e.g. an RGB image, the camera first converts the RGB image to Y′CbCr format for further processing. 
       FIG. 1  illustrates a scene to be photographed, including a girl and her soccer ball in the foreground and an out of focus background. 
       FIG. 2  illustrates the first frame of a multi-frame image captured by the camera, with its rolling shutter. The frame is logically divided into a plurality of horizontal swaths (in cases where the rolling shutter moves vertically), as a quantization compromise between treating the frame as though there were not a rolling shutter, and attempting to perform line-by-line motion correction. In the example shown, the frame is divided into ten equal swaths (Swath 0  to Swath 9 ). For convenience, the height of each swath may be identical. If the vertical resolution of the sensor does not conveniently lend itself to an integer number of swaths, a last swath may be padded suitably. The more swaths there are, the fewer lines of pixels each will contain, and the more reliable the motion statistics may be in many cases, but the more computation will be required. In many embodiments, swath heights of around 50 pixels may be suitable. It is desirable, if the processing power and memory size permit, to make the swaths narrow enough that adjacent swaths are unlikely to have more than one pixel of relative displacement. The designer will be able to select a suitable number of swaths based on the abilities of the processor. 
     Because of the rolling shutter, the first frame itself might well have registration errors of its various swaths with respect to its first swath (which, being closest in time to when the user activated the shutter, is by definition correct). In some embodiments, the camera could use a frame other than the first frame as the reference frame. In other embodiments, including the one described below, the first frame is taken as the reference frame, and other frames are aligned to it in order to reduce noise. 
     The camera copies the first frame to an accumulator, which is a memory structure which advantageously has more bits per pixel than does a given frame, to permit the accumulation (addition) of multiple frames of the image. If each image will arrive as four frames and has a conventional 8 bits per subpixel (color component of a pixel), the designer could choose to configure the accumulator to have 10 bits per pixel (4*2^8=2^10) which minimizes the memory footprint of the accumulator, or he could simply use the next power of 2 size (2^16) which uses more memory but may yield faster computation. Optionally, the processor may subsample the chroma components of the image, to reduce the accumulator&#39;s memory footprint. 
     The camera also saves a full resolution reference (FullResRef) copy of the Y′ luma component in another memory structure. The FullResRef serves as the reference against which subsequent images will be compared to detect motion. Thus, in one embodiment, motion detection is based solely on the Y′ luma values and not on the chroma values. In other embodiments, motion detection could be performed using the full color space, in which case the FullResRef storage would need to be made larger to accommodate also storing the Cb and Cr values for each pixel, rather than just the Y′ value. 
     In one embodiment, motion detection is limited to integer pixel displacements only. In other embodiments, finer-grained detection could be employed. 
       FIG. 3  illustrates a low resolution (LowRes) thumbnail version of the first full resolution frame, which is either received from the sensor or generated by the processor. The thumbnail is stored in another memory structure. In one embodiment, the LowRes image contains only Y′ luma values, but in other embodiments it may also contain chroma values. In some embodiments, the LowRes image has the same aspect ratio as the full resolution image, but in others it may take any suitable form factor as determined according to the needs of the application at hand. For example, in one embodiment, the full resolution image is a 5 Mpixel image having a resolution of 2600 horizontal pixels by 1950 vertical pixels and a 4:3 aspect ratio, while the LowRes image has a resolution of 64 horizontal pixels by 64 vertical pixels and a 1:1 aspect ratio. 
     This inventor has observed that a thumbnail of the FullResRef typically contains enough information that it can be used to greatly reduce the amount of work required to identify enough “interesting” pixel regions against which subsequent images can effectively be compared for motion detection. Well-known image decimation techniques can be used to create a LowRes image having the desired aspect ratio (and X and Y values) from the FullResRef image with its potentially independent aspect ratio (and X and Y values). 
       FIG. 4  illustrates a Candidate Matrix (CM) which the processor stores into another memory structure. For convenience only, the CM has been overlayed on top of the thumbnail in the drawing, simply to assist the reader in visualizing what is being described. The CM is an array whose entries can be used to identify locations in the thumbnail which are likely to correspond to edges or other features whose motion is most easily trackable from frame to frame. In one embodiment, these locations are identified by inspecting every pixel in the thumbnail, and for each pixel, comparing it against its four “nearest neighbors” (those directly up, down, left, and right of the pixel), and summing the absolute values of the Y′ differences between each neighbor and the pixel to determine an “activity level” of the pixel. In another embodiment, “next to nearest neighbors” or another such scheme could be used. 
     In one embodiment, pixels having an activity level above a predetermined threshold are marked as good candidates, and all others are marked as poor candidates. In another embodiment, the threshold is dynamically determined such that a predetermined percentage of the total pixels are marked as good candidates. In one such embodiment, this is done on a line by line basis. In the particular example shown, 1&#39;s mark pixels deemed good candidates, and the threshold has been dynamically adjusted on a line by line basis such that each line has between 3 and 8 of its 32 pixels marked as good candidates. The designer can select the threshold or range according to the parameters of the camera, such as the full resolution, size and speed of memory, computational throughput and latency of the processor, lens aperture, shutter speed, number of frames in a multi-frame image, and so forth. 
     In one embodiment, once the CM has been constructed and its values populated, the thumbnail is no longer needed and its memory can be released, and the CM is retained for the duration of the processing of the current multi-frame image. In another embodiment, the thumbnail is retained and the CM is recreated as needed, so the CM&#39;s storage may be periodically released. The designer can make many such tradeoffs, depending upon the dictates of the application at hand. 
     Once the CM has been completed, the processor can use it to perform a baseline analysis of the first frame. 
       FIG. 5  illustrates one method by which the processor can analyze the first frame. A key line is selected from each swath, and is used to represent the swath. In other words, only pixels on the key line are analyzed, to significantly reduce the amount of computation required. To still further reduce the required computation, only selected points along the key line are analyzed. In one embodiment, the key line is the horizontal line of pixels which is vertically half way between the top and bottom of the swath. In the example shown, there are fourteen points (P 0  through P 13 ) along the key line, spaced at even stride intervals. These may be termed “stride points”. The first and last stride points may advantageously be inset from the left and right ends of the line, such that there are pixels on all sides of the end points and they can be analyzed in the same way as the inner points on the key line. In other words, the stride value and an initial offset value are selected such-that dividing the line length (horizontal resolution) by the stride value, with the initial offset, produces the desired number of stride points and the end stride points are at desired offsets from the ends of the line. 
     For each swath in succession, the points on its key line are analyzed in a two-pass process. The first pass initializes then creates a histogram, and the second pass uses the histogram to identify the top N % most edge-like pixels and record them in an Edge Matrix (EM), where N is a predetermined value for example. 
     In the first pass, a stride point is analyzed by first converting its X,Y location in the frame into a corresponding position in the thumbnail—or, more precisely, in the CM. If the CM value at that position indicates that the pixel is not a good candidate (unlikely to be an edge), that point is simply skipped. If the CM value indicates that the pixel is a good edge candidate, then a more robust, fine-grain analysis is done in the full resolution frame. 
     In one mode, the fine-grain analysis includes all immediate neighbors of the pixel at the point in question. The immediate neighbors constitute a 3-by-3 array of pixels centered at the point. If the fine-grain analysis indicates that the pixel is still a good edge candidate, a histogram entry is incremented. In one embodiment, the histogram entry is selected by using the value max(3-by-3 array)−min(3-by-3 array) as an index into the histogram. 
     After all stride points in the key line have been analyzed, the histogram represents the swath. The processor inspects the histogram and identifies an index (CMI) such that a predetermined target activity level percentage (TAL) of the stride points in that swath have an activity level above that indexed by the CMI. For example, it may be desirable to perform re-registration using only the 10% most edge-like stride points. The value of TAL can be selected by the designer according to the processing power etc. constraints of the camera. 
     Then, once the CMI has been identified according to the TAL, the second pass can be made, to find the TAL % most edge-like stride points in the swath. A fine-grain (3-by-3) analysis is again made for each stride point whose CM counterpart indicates it to be a good candidate, and if the activity level is greater than Histogram[CMI], that stride point&#39;s entry in the Edge Matrix is set to indicate that it is actually an edge point against which future frames will be compared for motion. Alternatively, if memory permits, the results of the first pass fine-grain analysis could be saved and then simply read during the second pass, rather than being recalculated. 
       FIG. 6  illustrates an Edge Matrix corresponding to  FIG. 5 , with a TAL set to pick two stride points from each swath&#39;s key line as the only points that will be inspected in subsequent frames. The stride points in each swath&#39;s key line whose fine-grain analysis activity level was determined to be in the top two have been marked as 1&#39;s, with other entries cleared (to 0s). 
     The second pass is complete, the histogram memory can be released, and the Edge Matrix will be used for comparing future frames&#39; swaths against the FullResRef copy of the first image&#39;s Y′ luma values. 
       FIG. 7  illustrates the scene as captured by the sensor through the rolling shutter at a second (or subsequent) frame of the multi-frame image. Due to the rolling shutter, the frame has been distorted by camera movement. Some of the swaths have been de-registered versus the first frame, and slightly different portions of the scene have been captured. Swath 0  was correctly registered, by coincidence. Beginning with Swath 1 , the camera moved leftward, which shifts the swath to the right as shown by the small arrow. When Swath 2  was captured, the camera had moved even farther left, so Swath 2  is shifted even farther to the right than Swath 1  was. Beginning with Swath 3 , the camera began moving rightward, which shifts the swath to the left as shown by the small arrow. Swath 3  is shifted left as compared to Swath 2 , but is still father right than correct registration. Swath 4  is correctly registered by coincidence, but the camera continued moving rightward and Swath 5  is shifted left. Swath 6  is even farther left, but then the camera began moving leftward again and Swath 7  is out of registration but less far left than Swath 6 . Swath 8  happened to be correctly registered, but then Swath 9  was shifted to the right. 
     The amount of shift will depend on the amount of camera movement and the speed of the rolling shutter. The amounts shown in the drawings are for illustration only. And, for ease of illustration, the drawings illustrate a simplistic example in which the camera movement is only in the horizontal plane. In reality, the camera may also move vertically, and may even twist. 
       FIG. 8  illustrates the reason that motion detection and re-registration is important in amalgamating a multi-frame image.  FIG. 8  shows Swath 7  from the first frame and from the second frame, aligned vertically according to the sensor alignment, showing de-registration according to the scene. The camera shifted to the right, causing the second frame&#39;s Swath 7  to be shifted left. If the two swaths were blindly added together in the accumulator, each pixel in the first image (already in the accumulator) would be significantly blurred by having its value ultimate averaged with a value captured from an entirely different portion of the scene. For example, consider the “pixel value error” location circled in each of the swaths. While in the first swath that sensor location captured the image value for a spot on the girl&#39;s relatively white shirt sleeve, in the second swath that same sensor location captured the image value for a spot in the much darker (and probably different chroma) background. 
     This is the significance of de-registration. Unless frames/swaths are correctly re-registered, averaging them with the original frame will blur the image in unpredictable degrees dependent upon the amount of camera motion and the scene itself. 
       FIG. 9  illustrates the method by which swaths of second and subsequent frames are re-registered before being added to the accumulator. The same key line and stride point system is used as for the first frame (but not for populating an edge matrix), such that the same sensor points are used for comparison. 
     For each swath, the corresponding row of the Edge Matrix is consulted. For any stride point of the FullResRef identified as being in the top TAL % (by being marked as a 1), the same location is selected in the new frame. Any suitable pattern matching/motion estimation methodology can be used, to find the pixels in the new frame&#39;s swath which most closely resemble (by having the best pattern match of their neighbors versus the FullResRef) the first frame&#39;s corresponding swath. The searching may advantageously start from the displacement vector found on the previous swath, if this is not the first swath. A search may also be centered around a zero displacement in case the previous swath&#39;s motion vector is unreliable. If this swath is the first swath, then a wider search around the zero displacement may be needed in order to establish frame-to-frame motion. Searching then progresses systematically outward from the point in either case, because likelihood decreases as the distance from the center increases. For each match found, a motion vector is calculated, which describes how that stride point&#39;s pixel region moved from the first frame to the current frame. After all the EM-identified pixels have been thus examined, their resulting motion vectors are compared, to generate a single motion vector ascribed to the whole swath. Any suitable algorithm may be used in doing so. For example, preferably the mode (most common) motion vector would be selected. 
     In one mode, the new frame&#39;s swath may individually be re-registered in the inverse of the swath&#39;s overall motion vector, and the result added to the corresponding swath of the accumulator. 
     In another mode, overall motion vectors are calculated for all of the swaths of the current frame, and then some intelligence is applied against them as a set, before doing any re-registration and accumulation. For example, it is extremely unlikely that consecutive swaths would be correctly found to have moved “left 2 pixels”, “left 2 pixels”, “left 2 pixels”, “right 17 pixels”, and “left 2 pixels”. In that case, it may be determined that the “right 17 pixels” vector is simply an error, and that swath&#39;s overall motion vector may be changed to e.g. the average of those above and below it. 
       FIG. 10  illustrates the re-registration of the swaths after the overall motion vectors have been made sane. Swath 0  had not moved, so it is already in correct registration. Swath 1  had moved slightly to the right, so it is re-registered slightly to the left. Note that this is, in effect, a shift operation. As in many familiar mathematical operations, the “what to shift in” question is important. In the case of a photograph, it would nearly always be catastrophic to shift in any particular, predetermined value such as black or white. The blank regions labeled “SP” contain the “shift pixel” locations which may be thought of as “missing pixels” behind the shift. It should be noted that this issue impacts not only the Y′ luma values, but also the corresponding locations&#39; CbCr chroma values. 
     In one embodiment, the missing pixels are filled by accumulating the corresponding pixel values from the FullResRef first frame. Alternatively, the missing pixel filling can be done by scaling the corresponding pixel locations in the accumulator by the value F/(F−1), where F is the number of frames received so far (and the reference first frame is at F=1), and where averaging starts with frame F=2 so no divide-by-zero occurs. The first method is preferable in order to avoid magnifying errors in the accumulator. When using only Y for motion calculations, chrominance reference frame data is not usually kept in order to save memory, so the alternative method must be used in this case. 
     After all of the frames have been thus processed, the accumulator represents a scaled version of the final image. The accumulator is normalized by dividing its pixel values by F, the total number of frames in the multi-frame image. Then the accumulator contents can be written to the camera&#39;s multi-image storage, after being converted back to RGB space if necessary. In some cameras, it may also be desirable to first perform other conventional operations such as automatic white balancing, sharpening, cropping, generating EXIF information, and so forth, before storing the result as the final image. 
     Motion blur has been reduced by shooting a multi-frame burst of short-exposure frames rather than a single long-exposure frame. Noise has been reduced by having been averaged out, as random noise is unlikely to affect the same pixel in the same manner multiple times, and sensor pixel specific noise will be spread around the final image by the re-registration process. And rolling shutter artifacts have been reduced by re-registering swaths of the second and later images. 
     In one embodiment, the second and subsequent frame are compared against a saved copy of the first frame, rather than against the accumulator, to avoid motion detection errors caused by accumulation (of errors). 
     Tables 1-4 list pseudo-code such as may be used in performing one embodiment of the method of this invention, which may differ in some respects from that described above. 
     
       
         
               
             
               
               
             
           
               
                 TABLE 1 
               
               
                   
               
               
                 MAIN ROUTINE 
               
               
                   
               
             
             
               
                   
               
             
          
           
               
                   
                 // main routine for building composite image 
               
               
                   
                 main 
               
               
                   
                 { setup 
               
               
                   
                   change color space to Y′CbCr or YUV 
               
               
                   
                   FirstImage 
               
               
                   
                   for each subsequent image 
               
               
                   
                   { NthImage 
               
               
                   
                   } 
               
               
                   
                   weight Accumulator for N images 
               
               
                   
                   optionally change color space back 
               
               
                   
                   output Accumulator to final image storage 
               
               
                   
                 } // main 
               
               
                   
               
             
          
         
       
     
     
       
         
               
             
               
             
           
               
                 TABLE 2 
               
               
                   
               
               
                 HANDLE FIRST IMAGE 
               
               
                   
               
             
             
               
                   
               
             
          
           
               
                 // handle first image 
               
               
                 FirstImage 
               
               
                 { validate image 
               
               
                   receive FullRes image 
               
               
                   make or receive LowRes thumbnail 
               
               
                   copy FullRes image to Accumulator 
               
               
                   copy FullRes image to FullResRef reference copy 
               
               
                   course grain edge check of LowRes image 
               
               
                   adaptively get % of pixels needed for performance/speed tradeoff 
               
               
                   save CM candidate matrix identifying active pixels in LowRes image 
               
               
                   BuildEdgeMatrix 
               
               
                 } // FirstImage 
               
               
                   
               
             
          
         
       
     
     
       
         
               
             
               
             
           
               
                 TABLE 3 
               
               
                   
               
               
                 BUILD EDGE MATRIX 
               
               
                   
               
             
             
               
                   
               
             
          
           
               
                 // build EM edge matrix listing most edge-like pixels in each swath 
               
               
                 // of first image 
               
               
                 BuildEdgeMatrix 
               
               
                 { for each swath in FullResRef 
               
               
                   { clear EM[swath] edge matrix 
               
               
                    // first pass makes activity histogram of differentness around 
               
               
                    // strided pixels along KeyLine of swath 
               
               
                    clear AH[ ] activity histogram 
               
               
                    map KeyLine line of FullResRef to line CML of CM candidate 
               
               
                    matrix for each pixel in CM[CML] 
               
               
                    { if CM[CML,pixel] is edge candidate 
               
               
                      { fine grain edge check in FullResRef 
               
               
                       if edge pixel in FullResRef 
               
               
                       { find max value of pixel and neighbors 
               
               
                         find min value of pixel and neighbors 
               
               
                         increment AH[max-min] 
               
               
                       } // if edge pixel 
               
               
                      } // if edge candidate 
               
               
                    } // for pixel 
               
               
                    select CMI CM index encompassing TAL target activity level 
               
               
                    // second pass finds TAL% most edge-like pixels 
               
               
                    for each pixel in CM[CML] 
               
               
                    { if CM[CML,pixel] is edge candidate 
               
               
                      find max value of pixel and neighbors 
               
               
                      find min value of pixel and neighbors 
               
               
                      if (max-min) &gt;= TAL 
               
               
                      { set EM[swath,pixel] // marks this pixel as in top TAL% 
               
               
                      } // if TAL 
               
               
                    } // for pixel 
               
               
                    // after second pass, EM[swath] lists pixels to compare against 
               
               
                    // in subsequent frames 
               
               
                   } // for swath 
               
               
                 } // BuildEdgeMatrix 
               
               
                   
               
             
          
         
       
     
     
       
         
               
             
               
             
           
               
                 TABLE 4 
               
               
                   
               
               
                 HANDLE SUBSEQUENT FRAME 
               
               
                   
               
             
             
               
                   
               
             
          
           
               
                 // handle second etc. frame 
               
               
                 NthFrame 
               
               
                 { receive NextFrame 
               
               
                   for each swath in NthFrame 
               
               
                   { map swath to SL line in EM 
               
               
                    for each pixel listed in EM[SL] 
               
               
                    { find FullResRef pixel region most closely matching NextImage 
               
               
                         pixel region around EM[SL,pixel] 
               
               
                      save movement vector 
               
               
                    } // for pixel 
               
               
                    use histogram to find most common movement vector for swath 
               
               
                    save common movement vector to MV[swath] 
               
               
                   } // for swath 
               
               
                   fix aberationally unlikely movement vectors 
               
               
                   for each swath in NthFrame 
               
               
                   { add swath to Accumulator with movement vector adjustment 
               
               
                    weight Accumulator areas in “black bars” outside movement 
               
               
                   } // for swath 
               
               
                 } // NthFrame 
               
               
                   
               
             
          
         
       
     
     CONCLUSION 
     When one component is said to be adjacent another component, it should not be interpreted to mean that there is absolutely nothing between the two components, only that they are in the order indicated. 
     The various features illustrated in the figures may be combined in many ways, and should not be interpreted as though limited to the specific embodiments in which they were explained and shown. 
     Those skilled in the art, having the benefit of this disclosure, will appreciate that many other variations from the foregoing description and drawings may be made within the scope of the present invention. Indeed, the invention is not limited to the details described above. Rather, it is the following claims including any amendments thereto that define the scope of the invention. 
     In the claims, numbering and lettering is for convenience and clarity, and should not be interpreted as requiring any particular order of steps in a method. Ordering, if any, should be implied only where it is implicit in the recitation. For example, “(1) obtain a chicken, and (2) cook the chicken” does require an ordering, but “(1) set the table, and (2) cook dinner” does not; in the latter case, the two steps may be performed in either order or even in parallel.