Julius Julius - 1 year ago 142
C++ Question

Gradient of brightness in polygon in opencv?

Can I use opencv to draw a greyscale polygon, where the brightness of the each pixel is determined by interpolation from the vertices?


cv::fillConvexPoly(frame, &draw[0], (int) draw.size(), color);

Instead of
I would like to add an array of colors/brightnesses for each vertex, and then the final drawn polygon should have colors/brightnesses linearly interpolated from the vertex values.

Answer Source


You can do this to edit a specific pixel: Vec3b pixel = image.at<Vec3b>( Point(x,y) ); and image.at<Vec3b>( Point(x,y) ) = pixel;

Now just go and implement whatever drawing functionality you want.

(If you are having a specific issue, then please edit your question to clarify so I can then update this answer to be more specific. )


Thank you for specifying what it is that you are actually asking. Really this is not something that OpenCV is meant for. (It is a computer vision library, not a image manipulation library. ) Take a look at http://www.imagemagick.org/Usage/canvas/ as this will likely have what you need.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download