South Webcam Media Plugin

The plugin keeps on taking a video frame from directory or webcam and saves into a directory. It also appends the name of the saved files in the reading generated.

config1

  • ‘assetName’: type: string default: ‘WebcamImages’:

    Name of Asset output.

  • ‘mediaType’: type: string default: ‘directory’:

    Source from which the media files are generated

  • ‘mediaDir’: type: string default: ‘webcam’:

    If the mediaType is camera then the directory where media will be stored. If the mediaType is directory then it is the name of directory inside FLIR_ROOT/data where images are stored.

  • ‘dataFormat’: type: enumeration default: ‘IMG’:

    Format of files in ‘mediaDir’

  • ‘repeatLoop’: type: boolean default: ‘false’:

    If the mediaType is directory is reload when you hit the end playing the images from directory.

  • ‘cameraNumber’: type: integer default: ‘0’:

    Number associated with /dev/video in your file system. for example /dev/video0 then use 0.

  • ‘fpm’: type: float default: ‘10.0’:

    frames to save per minute.

Execution

To run the south webcam media plugin you can either

  1. Copy some images inside some directory in FLIR_ROOT/data. Let’s say the directory name is pics. Run the following command.

    curl -sX POST http://localhost:8081/flir/service -d '{"name":"My_web_cam","type":"south","plugin":"webcam_media","enabled":true,"config":{"assetName":{"value":"WebcamImages"}, "imageDir":{"value":"pics"}, "mediaType":{"value":"directory"}, "fpm":{"value":"10.0"}}}' |
    
  2. Connect a camera to the machine and run the following command.

    $ v4l2-ctl --list-formats-ext --device /dev/video0
    You will see something like
    'YUYV' (YUYV 4:2:2)
      Size: Discrete 640x480
              Interval: Discrete 0.033s (30.000 fps)
      Size: Discrete 720x480
              Interval: Discrete 0.033s (30.000 fps)
      Size: Discrete 1280x720
              Interval: Discrete 0.033s (30.000 fps)
      Size: Discrete 1920x1080
              Interval: Discrete 0.067s (15.000 fps)
              Interval: Discrete 0.033s (30.000 fps)
      Size: Discrete 2592x1944
              Interval: Discrete 0.067s (15.000 fps)
      Size: Discrete 0x0
    

    Now we know that the id 0 is functional. If no output then try 1,2,3 and so on.

    Finally launch the plugin using

    curl -sX POST http://localhost:8081/flir/service -d '{"name":"My_web_cam","type":"south","plugin":"webcam_media","enabled":true,"config":{"assetName":{"value":"WebcamImages"}, "imageDir":{"value":"webcam"}, "mediaType":{"value":"camera"}, "cameraNumber":{"value":"0"}, "fpm":{"value":"10.0"}}}' |jq
    

See Also

flir-filter-edgeml - Filter which takes image data, calls out to ML process, and forwards the inference from ML as asset contents.

flir-filter-greyscale - Convert 24bit RGB images to greyscale images

flir-filter-image-bounding-box - Uses the output of an ML model to crop out or draw bounding boxes on an image.

flir-filter-image-resize - Python based plugin to resize images by scaling or cropping.

flir-filter-mirror - A filter plugin to mirror image type data points

flir-filter-rotate - Rotate all images found in datapoints within a reading

flir-north-png - A plugin to write an image type data points to PNG files in the local filesystem

flir-south-video4linux - A south plugin to ingests images from various devices using the Video4Linux API. Video4Linux supports a wide variety of video capture devices on Linux platforms.