Table Of Contents

Previous topic

ecto_opencv.calib

Next topic

ecto_opencv.imgproc

This Page

Highgui Cells

Common opencv image input and out, plus display.

Tricks

Saving images on a key stroke

imshow accepts an optional dict of string to key value, that it will output as trigger bools, useful with the ecto::if cell.

See Saving images

Reference

ecto_opencv.highgui

V4LCapture

Brief doc

Read images from a directory.

Parameters

  • height   type: unsigned int    not required   default: 480

    Height

  • video_device   type: std::string    not required   default: /dev/video0

    The device path to open.

  • width   type: unsigned int    not required   default: 640

    Width

Outputs

  • frame_number   type: int   

    The number of frames captured.

  • image   type: cv::Mat   

    A video frame.

ImageJpgWriter

Brief doc

Writes jpg to a file like object

Parameters

  • file   type: boost::shared_ptr<std::ostream>    not required   no default value

    A filelike object

Inputs

  • image   type: cv::Mat   

    An image to write.

Outputs

  • file   type: boost::shared_ptr<std::ostream>   

    A filelike object

MatWriter

Brief doc

Write a cv::Mat to a yaml or xml file.

Parameters

  • filename   type: std::string    required   default:

    Name of mat to write.

Inputs

  • mat   type: cv::Mat   

    A mat to print.

imread

Brief doc

Reads a single image, const cell.

Parameters

  • image_file   type: std::string    not required   default: lena.jpg

    The path to the image to read.

  • lock_name   type: std::string    not required   default:

    If set to something, an flock will be created for that file

  • mode   type: ecto_opencv::Image::Modes    not required   default: COLOR

    Legal Values: GRAYSCALE (0)   COLOR (1)   ANYDEPTH (2)   ANYCOLOR (4)   UNCHANGED (-1)  

    The image read mode.

  • refresh   type: bool    not required   default: False

    If true, the image is re-read every time

Outputs

  • image   type: cv::Mat   

    The image in full color.

FPSDrawer

Brief doc

Draw the Hz on an image.

Inputs

  • image   type: cv::Mat   

    The original image to draw the pose onto.

Outputs

  • image   type: cv::Mat   

    The image with fps drawn on it.

ImageSaver

Brief doc

An file saver for images.

Parameters

  • filename_format   type: std::string    not required   default: ./image_%04d.png

    The filename format string. Must accept one integer, %d. This integer will monotonically increase. The extension determines the image format to write.

  • filename_param   type: std::string    not required   default:

    A single filename, set this for single file output.

  • lock_name   type: std::string    not required   default:

    If set to something, an flock will be created for that file

  • start   type: int    not required   default: 0

    The starting integer value, that will be inserted into the filename format string

Inputs

  • filename   type: std::string   

    A single filename, set this for single file output.

  • image   type: cv::Mat   

    The image to save.

Outputs

  • filename   type: std::string   

    The filename that was used for saving the last frame.

imshow

Brief doc

Displays an image. If a dictionary is defined in triggers, each key is defined as an output, the value being a bool of whether it’s been pressed

Parameters

  • autoSize   type: bool    not required   default: True

    Autosize the window.

  • maximize   type: bool    not required   default: False

    Fullscreen the window, takes precedence over autoSize.

  • name   type: std::string    not required   default: image

    The window name

  • triggers   type: boost::python::api::object    not required   no default value

    A dict of trigger keys, e.g. {‘x_key’:ord(‘x’)}

  • waitKey   type: int    not required   default: -1

    Number of millis to wait, -1 for not at all, 0 for infinity.

Inputs

  • image   type: cv::Mat   

    The image to show

VideoCapture

Brief doc

Read images from a directory.

Parameters

  • height   type: unsigned int    not required   default: 480

    Set width to this after opening device

  • video_device   type: int    not required   default: 0

    The device ID to open.

  • video_file   type: std::string    not required   default:

    A video file to read, leave empty to open a video device.

  • width   type: unsigned int    not required   default: 640

    Set width to this after opening device

Outputs

  • frame_number   type: int   

    The number of frames captured.

  • image   type: cv::Mat   

    A video frame.

MatReader

Brief doc

Read a cv::Mat from a yaml or xml file.

Parameters

  • filename   type: std::string    required   default:

    Name of mat to read.

Outputs

  • mat   type: cv::Mat   

    A mat to print.

VideoWriter

Brief doc

Writes images to motion jpeg file.

Parameters

  • command   type: ecto_opencv::Record::RecordCommands    not required   default: START

    Legal Values: START (0)   RESUME (1)   PAUSE (2)   STOP (3)  

    The video recorder command

  • fps   type: double    not required   default: 30.0

    Framerate of the created video stream.

  • video_file   type: std::string    not required   default: video.mpg

    A video file name.

Inputs

  • image   type: cv::Mat   

    Frame to record.

NiConverter

Brief doc

Read images from a directory.

Parameters

  • rescale   type: bool    not required   default: False

    Convert depth to floating point and rescale.

Inputs

  • depth_buffer   type: boost::shared_ptr<std::vector<unsigned short, std::allocator<unsigned short> > const>   

  • depth_height   type: int   

    Depth frame height.

  • depth_width   type: int   

    Depth frame width.

  • image_buffer   type: boost::shared_ptr<std::vector<unsigned char, std::allocator<unsigned char> > const>   

  • image_channels   type: int   

    Number of image channels.

  • image_height   type: int   

    Image frame height.

  • image_width   type: int   

    Image frame width.

Outputs

  • depth   type: cv::Mat   

  • image   type: cv::Mat   

MatPrinter

Brief doc

Print a cv::Mat to the console.

Parameters

  • name   type: std::string    required   no default value

    Name of mat to print.

Inputs

  • mat   type: cv::Mat   

    A mat to print.

ImageReader

Brief doc

Read images from a directory.

Parameters

  • file_list   type: std::vector<std::string, std::allocator<std::string> >    not required   default: <ecto.ecto_main.VectorString object at 0x37f5d50>

    A list of images to read.

  • lock_name   type: std::string    not required   default:

    If set to something, an flock will be created for that file

  • loop   type: bool    not required   default: False

    Loop over the list

  • match   type: std::string    not required   default: .*\.(bmp|jpg|png)

    Use images matching this regex (regex. not glob.)

  • path   type: std::string    not required   default: /tmp/ecto/rules

    The path to read images from.

Inputs

  • step   type: int   

    The set at which to read the images.

Outputs

  • frame_number   type: int   

    The number of frames captured.

  • image   type: cv::Mat   

    A video frame.

  • image_file   type: std::string   

    The current image file being read

DoubleDrawer

Brief doc

Draw a double and legend on an image.

Parameters

  • format   type: std::string    not required   default: %f

    boost::format string. Will be passed a double

  • x   type: unsigned int    not required   default: 0

    x offset

  • y   type: unsigned int    not required   default: 0

    y offset

Inputs

  • image   type: cv::Mat   

    The original image to draw the pose onto.

  • value   type: double   

    Value to be drawn

Outputs

  • image   type: cv::Mat   

    The image with fps drawn on it.