Stitching Ladybug images without using the Ladybug SDK

Last Revision Date: 6/5/2014

This article explains how to obtain stitched images from a Ladybug2 or Ladybug3 spherical camera on a system such as Linux that is not supported by the Ladybug SDK. 

To obtain stitched images without using the Ladybug SDK involves first using the Ladybug SDK on a Windows system to generate a 3D stitching mesh file for the camera system, then importing the file into your own application to perform the stitching.

The steps are as follows:

    1. Connect the Ladybug camera to a Windows computer with the Ladybug SDK installed. (Make sure it is the only camera connected.)
    2. Start the LadybugCap or LadybugCapPro applications.
    3. Adjust the blending width to suit your needs. This will generate alpha mask files. For more information about alpha mask files and their storage location, refer to the Ladybug SDK Help.  
    4. Close the application. You should now have six alpha mask files, stored in a zip file. Each file is in JPG format, and must be converted to PGM format using an image processing tool such as IrfanView. Finally, to allow the files to work with the stitching example program, rename them to 'alphamask.pgm'.
    5. From the Windows console, run the Ladybug SDK sample programladybugOutput3DMesh and redirect its output to a file, as in the following example. This program is installed in the \bin folder of the Ladybug installation path.
      ladybugOutput3DMesh.exe > mesh.txt
      This generates the mesh data needed to rectify and stitch a spherical image.
    6. Capture six images from each of the Ladybug's sensors. The images must be stored as color images in PPM format to work with the stitching example program. Capturing the images can be done using the LadybugCap application or by executing the ladybugSimpleGrab example program. To use LadybugCap, first record a stream file. Then, open the file in LadybugCap. Under the Image Index list, select one of the stitched images to process. Under the Process and Output to... drop-down list, select Color Processed Images. Specify an output directory, then click PROCESS. Six separate images are saved to the specified directory.

      Note:  Do not specify the Mono color processing algorithm when processing images. The image size produced by this algorithm is incompatible with the stitching program. Additionally, specifying the Down Sample algorithm may produce poor stitching results.

      Alternatively, execute ladybugSimpleGrab.exe from the \bin folder. This program saves six raw images to the \bin folder.

      In either case, images are saved in BMP format. They must be converted to PPM format using an image processing tool. Finally, name the individual images 'imagecameraID.ppm', with cameraID starting at zero (0).
    7. From the \bin folder, run ladybugStitchFrom3DMesh to stitch and display the six images without using the Ladybug SDK: 
      ladybugStitchFrom3DMesh.exe mesh.txt alphamask image
      This statement assumes the alpha mask and image files are prefixed by 'alphamask' and 'image' respectively.
    8. You should now see a window with the stitched and blended image. You can pan and tilt the images using your mouse. 
    9. ladybugStitchFrom3DMesh does not require the Ladybug SDK, so you can port the program and the mesh data file to another platform.

Note: If the ladybugOutput3DMesh and ladybugStitchFrom3DMesh executables are not installed in the \bin folder, you may be running an earlier version of the Ladybug SDK. Obtain a newer version from the downloads site. Alternatively, compile the programs from the source code in the \src directory.

Related Articles