Table of Contents
Vision Convert Color
This block is currently a beta version. If you are using this block, we would appreciate any feedback at tech@quanser.com. |
Converts an image from one color space to another.
Library
MATLAB Command Line
Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:
qc_open_library('quarc_library_beta/Image Processing/Open Source Computer Vision')Description
The Vision Convert Color block performs color transformation on the input image.
In order to use this block, be sure to follow the instructions described on the Vision Capture Image page, and take careful note of the limitations.
Input Ports
src_image
A handle to a source image that uses OpenCV (Open Source Computer Vision) IplImage structure. The input must be a 24-bit color image in BGR (Blur-Green-Red) format.
Output Ports
dst_image
Converted destination image having three 8-bit color planes. If the output is a grayscale image, the color planes will have the same intensity values in the corresponding pixels.
err
An error signal which is negative in case of invalid memory allocation or usage of invalid parameter values.
Parameters and Dialog Box
Color space
Specifies the color space of output image. The options for color space are BGR2GRAY
, BGR2YCrCb
, and BGR2HSV
.
The options are described as follows:
BGR2GRAY: Gray intensity, Y = 0.299*R + 0.587*G + 0.114*B BGR2YCrCb: Gray intensity, Y = 0.299*R + 0.587*G + 0.114*B Chromatic red, Cr = (R-Y)*0.713 + 128 Chromatic blue, Cb = (B-Y)*0.564 + 128 BGR2HSV: Brightness intensity, V = max(R,G,B) Saturation intensity, S = (V-min(R,G,B))/V, if V≠0, 0, otherwise Hue intensity, H = (G - B)*60/S, if V=R 180+(B - R)*60/S, if V=G 240+(R - G)*60/S, if V=B If H<0 then H=H+360 On output 0≤V≤1, 0≤S≤1, and 0≤H≤360. The values are then converted to 8-bit destination image using V = V*255, S = S*255, and= H = H/2.
Sample time
The sample time of the block. A sample time of 0 indicates that the block will be treated as a continuous time block. A positive sample time indicates that the block is a discrete time block with the given sample time. A sample time of -1 indicates that the block inherits its sample time.
Targets
Target Name |
Compatible* |
Model Referencing |
Comments |
---|---|---|---|
No |
No |
Not supported. |
|
No |
No |
Not supported. |
|
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
Yes |
Yes |
||
No |
No |
Not supported. |
|
Rapid Simulation (RSIM) Target |
No |
No |
Not supported. |
S-Function Target |
No |
N/A |
Old technology. Use model referencing instead. |
Normal simulation |
Yes |
Yes |
See Also
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.