top bar

FakeCamera

Summary:Adapter for fake/virtual camera that loads images from disk. Can provide different images depending on stage postions.
Author:Lukas Lang
License:Apache License, Version 2.0
Platforms:Windows, 32 & 64-bit, Linux (see below)
Available since version:1.4.23, 1. November 2017

This camera adapter adds a virtual camera that can be configured to load arbitrary images from disk. Supported formats are all those supported by OpenCV's imread, in particular:

  • PNG
  • BMP
  • TIF/TIFF
  • JPG/JPEG
  • ...

The pixel type can be set to 8/16-bit grayscale and 8/16-bit RGB (16-bit RGB does currently not work due to a limitation in Micromanager). All images are converted to the selected type, regardless of their true pixel format.

The path mask can be set in the Device Property browser and supports the following placeholders:

??Position of focus stage
?{<prec>}?Position of focus stage, with precision <prec>
?[<stage>]Position of stage <stage>
?{<prec>}[<stage>]Position of stage <stage> with precision <prec>

The positions are rounded according to the specified precision (default is 0, i.e. integers). The resolved path (i.e. the path with the current positions inserted) is shown in the "Resolved path" property. Demo stages provided by the DemoCamera device adapter can be used in place of physical stages to fully work without hardware (to add multiple stages, add multiple DHub devices)

Example path mask

The examples assume the following stage positions:

  • Focus stage: 7.41um
  • "x-Axis" stage: 3.52um
  • "y-Axis" stage: -1.33um
Path maskResolved path
C:\imgs\img_??.pngC:\imgs\img_7.png
C:\imgs\img_??_?[x-Axis]_?[y-Axis].pngC:\imgs\img_7_3_-1.png
C:\imgs\img_?{1}?_?{2}[x-Axis]_?[y-Axis].pngC:\imgs\img_7.4_3.52_-1.png

Building on Linux

The device adapter can be used on Linux (RGB mode currently does not work). To build it, the instructions in Linux_installation_from_source_(Ubuntu) need to be adapted as follows (tested on Ubuntu 16):

  • During "Install Build programs & libraries", also install OpenCV 2.4.8.3, following the guide here. In short:
    • Dependencies
      Commandline
      
      sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev   libavformat-dev libswscale-dev tar
      
    • Download code & extract it
      Commandline
      
      wget https://github.com/opencv/opencv/archive/2.4.8.3.tar.gz
      tar -xvf 2.4.8.3.tar.gz
      
    • Build & install it
      Commandline
      
      cd opencv-2.4.8.3
      mkdir release
      cd release
      cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
      make
      sudo make install
      
  • During "Create the Autotools files" add --with-opencv to the configure call:
    Commandline
    
    cd ~/mm/micro-manager1.4
    ./autogen.sh
    ./configure --enable-imagej-plugin=/usr/local/ImageJ --with-opencv
    
  • Continue normally

Click here to search for FakeCamera on the Micro-Manager mailing list archive.

© Micro-Manager : Vale Lab, UCSF 2006-2011 | All Rights Reserved | Contact