Julius Julius - 12 days ago 7x
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.



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.