opencvcamera/cameraviewer and simple opencv samples

✏️ Edit this page on GitHub

#contents

Please note that this sample is not included with the Python or Java editions of OpenRTM-aist. On Linux, build and install it according to Building OpenCV Sample Code on Linux.

Overview

By starting OpenCVCamera and CameraViewer, images captured from a USB camera can be displayed on a monitor. OpenCV image-processing sample RTC components can be connected between them to apply various effects.

Startup Screens

OpenCVCamera Component and CameraViewer Component Execution Example
OpenCVCamera Execution Example (RTSystemEditor)
CameraViewer Execution Example (Monitor)

Usage

OpenCVCamera is a sample component that acquires image data from a USB camera and displays it on a monitor through the CameraViewer component.

OpenCV RT sample components can also be inserted between them to apply image-processing effects.

  • Procedure

    • Start RTSystemEditor and open a new SystemEditor. For details on using RTSystemEditor, refer to RTSystemEditor.

    • Start both OpenCVCamera (openCVCamera.bat) and CameraViewer (CameraViewer.bat).

      • To use the sample OpenCV image-processing RT components, launch them after installation from: Start > OpenRTM-aist 1.2.1 x86_64 > C++_OpenCV-Examples (On a 32-bit environment: Start > OpenRTM-aist 1.2.1 x86 > C++_OpenCV-Examples)
    • These components will appear in the Name Service View of RTSystemEditor. Drag both of them onto the SystemEditor.

    • Connect the corresponding ports of the two components. (Refer to the RTSystemEditor execution example above.)

    • Right-click either component and select [Activate Systems].

Using OpenCV Flip

  • Start the Flip component from: Start > OpenRTM-aist 1.2.1 x86_64 > C++_OpenCV-Examples (On a 32-bit environment: Start > OpenRTM-aist 1.2.1 x86 > C++_OpenCV-Examples)

  • Drag it onto the SystemEditor, connect it between OpenCVCamera and CameraViewer, and activate it. (Refer to the Flip execution example below.)

  • The Flip component can also modify its output by changing the value of the Configuration parameter “flip_mode.” (Refer to the flip_mode example below.)

    • For detailed usage and explanations of Flip, see here.
Flip Execution Example (RTSystemEditor)
Changing flip_mode (RTSystemEditor and Monitor)

Other OpenCV-Based Samples

Startup Command Function Configuration Parameters
Affine.bat Performs affine transformation on the input image. Affine transformation matrix
BackgroundSubtractionSimple.bat Outputs changes relative to the image captured when a key input is received. Parameters specifying the image change detection method
Binarization.bat Converts the input image into a black-and-white binary image. Binarization threshold
DialationErosion.bat Performs dilation/erosion processing. Binarization threshold
Edge.bat Outputs first-derivative images in the X and Y directions and a Laplacian (second-derivative) image. Aperture size
Findcontour.bat Extracts contours and displays them in the image. Pre-processing binarization threshold, hierarchy level, contour line size for display, contour approximation method
Histgram.bat Displays histogram changes while adjusting image brightness and contrast. Brightness and contrast
Startup Command Function Configuration Parameters
Hough.bat Detects straight lines using the Hough Transform. Parameters for the Hough Transform and drawing parameters for detected lines.
Perspective.bat Performs a perspective transformation on the image (as if viewed from below at an angle). None
RockPaperScissors.bat Recognizes rock, paper, and scissors gestures from an image. Thresholds for gesture classification based on solidity and parameters for compensating missing regions through dilation/erosion processing.
Rotate.bat Performs image rotation and scaling. Counterclockwise rotation angle and scaling factor.
Scale.bat Performs image scaling. Scaling factors in the X and Y directions.
Sepia.bat Applies a sepia-tone effect to the image. Sepia-tone color adjustment.
Translate.bat Performs two-dimensional image translation. Translation direction.