Linear Scanner

The Linear Scanner module provides a way to stitch together images being produced in a linear manner. This is a common task in conveyor type systems that need to scan in objects that are larger than the field of view of a camera. Either the camera or the object can be moved in a single direction to effectively scan in the object by combining successive images into a single large image to be later processed by other modules.

The module works to stitch together images using various techniques. In the most basic version, a single offset in terms of pixels is used to move one image in relation to the next to place it in the appropriate location so as to create a smooth transition from one image to the next. This only works well if your sample rate is very steady and can create images that are very evenly spaced. For example, if you have the camera or object moving using very precise encoders and have perfectly aligned the camera with respect to the object, you can use a simple offset to create a stitched image. In most cases, even when using encoders, this will still create stitch marks between images. Thus in most cases, regardless of the precision of your scanner, you will still need to enable the Automatic Alignment in order to create a seamless image.

The Linear Scanner module is not a generic module in that it will NOT stitch together images that are related but might be in arbitrary locations with respect to the first image being scanned. Instead, this module assumes:

  1. There is a single direction of movement with somewhat constant speed in that direction.
  2. There is at least 25% overlap between one image and the next.
  3. There is some texture in the object that can be used when Automatic Alignment is selected.

Note, there is a current limitation of 100 images that can be stiched. This is to ensure your machine does not accidentally run out of memory. If this limitation is a problem please contact us.



1. Direction of Camera Movement - Specify how the camera is moving relative to the object. If the camera is stationary and the object is moving, you will need to select the 'opposite' movement. This parameter helps the module understand how one image will be offset from the next. This parameter should be as close as possible to an estimate as to how much the camera will move with respect to the object being scanned.

2. Approximate Movement - Specify how many pixels the next image needs to be shifted in the Direction of Camera Movement in order to overlap with the current image as best as possible. This provides a "ballpark" estimate of how the stitching should be done that can then be further automatically refined.

3. Add Image Trigger - To avoid overloading the module with too many similar images, its best to stitch images that only overlap each other by about 25%. Because of this, you should avoid stitching images at full frame rate since 30 frames a second on a typical camera would be largely redundant. Instead, try to time the frames added to the module such that only when images have 25% overlap with previous images is the image added to the stitch. To enable this, the module has various ways to trigger a "capture" and addition to the final stitched image.

  1. New Image - Used when you are triggering the image capture externally where RoboRealm will only receive images that are to be added to the stitch. This setting will compare the current image with the previous image and if the current image is different from the previous image by at least 1 pixel, it will add the current image into the stitch.
  2. Time - You can specify how frequently an image is added to the stitch. For example, if you move the camera or object at a steady rate, you can specify a timing parameter which when exceeded will add that image to the stitch. For example, if your view of the object takes 1 second to completely move to a new section of the object you can set the timing to be 750 milliseconds to ensure that at least 25% of the image overlaps with the previous image during the scan. This setting only works if the camera or object movement is very consistent.
  3. Variable - If you have external triggers like microswitches or other PLC triggers, you can specify a variable that when it contains a non-zero value will issue a "capture" and addition to the stitched image. When a trigger happens, the variable will be automatically reset to zero to avoid a successive capture until that variable is again set to true. This allows you to control very precisely what images should be added to the stitch.
4. Maximum Frames - Knowing when to stop the stitching process is also required. You can simply specify a maximum number of images that each stitch should take. Once this limit is reached the active scanning and stitching process will stop.

5. Enable Immediate Parameter Tuning - As the Linear Scanner module has many parameters to configure that change how each image is combined into the final stitch it can become tedious to rescan the object again and again in order to tune the parameters correctly. When the Immediate Parameter Tuning is enabled, the module will save the raw image in memory such that any change to the parameters will initiate a complete regeneration of the stitch to allow you to quickly see the changes. During production it is recommended that this option is NOT selected as it will significantly increase memory requirements during each scan.

6. Export / Import - Select the appropriate button to export or import individual frames (for testing purposes) that create the stitch. These buttons are ONLY enabled when the Immediate Parameter Tuning is specified otherwise there are no frames to save. You can use these buttons to save or load a copy of all files that create the stitch in order to explore other refinements at a later date or to send RoboRealm a copy of those images files such that we can explore any unsolved issues.

7. Rotate - Unless the camera is perfectly aligned in the direction of motion, you will need to rotate the image slightly in order to create a better alignment. Remember that rotation affects both sides of the movement so small incremental changes are best to avoid over rotating.

8. Automatic Alignment - Even with very precise movements images will not be perfectly aligned. Because of this some local alignment of the image at overlapping pixels is needed. The Automatic Alignment will perform this check in both X and Y directions for the specified number of pixels. Thus, each image is first shifted by the movement amount and then searched plus and minus the specified X and Y pixels to find the best possible match between the two images. This localized search helps improve the stitching areas of the overlapping images and can provide a much smoother and less noticeable transition between images.

  • Limits - Specifies the number of pixels checked in the X and Y direction for a good match. Larger numbers will require more CPU processing and may find local matches that are not ideal. Try to keep the numbers as small as possible to provide reasonable joins using low CPU processing.
  • Threshold - Since images may have constant lighting (i.e. reflections) that do not move the automatic alignment process may become confused by these lighting areas. If this happens, try decreasing the Max Threshold to below those bright lights which will cause the automatic matching to avoid using those pixels as part of the alignment process.

9. Composite Method - Specifies how the images are combined with each other.

  1. Last - Overlays the most current image ontop of the stitch such that the last image will always overlap previous images. This is the fastest method of combining images but can lead to obvious stitch marks.
  2. Max - Overlays the stitch with the current image by only replacing pixels in the current stitched image with the maximum intensity value. This can help indicate lighter areas of images regardless of the stitch overlap.
  3. Min - Overlays the stitch with the current image by only replacing pixels in the current stitched image with the minimum intensity value. This can help indicate lighter areas of images regardless of the stitch overlap.
  4. Average - Overlays the stitch by averaging the images. This can create a less distinct stitch mark but can create blurring along the stitch lines.
  5. Blend - Overlays the stitch by blending the images based on distance to the stitch. This creates the smoothest transition from one image to the next as the pixels values are adjusted according to their location. This is also the most CPU intensive compositing technique but achieves the best results.
10. Start/Stop Trigger Variable - You can specify a variable to start and/or stop a scanning process. This allows you to automatically start creating a stitched image under variable control. By specifying a nonzero value in the variable, that will initiate images being added to the stitch. Changing that value to zero will then stop that process.

11. Indicate Individual Frames - Sometimes its hard to understand how the individual frames are overlapped. Use this selection to draw a red square around each frame to better show how things are stitched together.


LINEAR_SCANNER_ACTIVE - Indicates if the Linear Scanner module is actively capturing and stitching image frames.

See Also


 New Post 

Linear_Scanner Related Forum PostsLast postPostsViews