leovandriel / cvplot

Graph plots, drawing, layout and windows in OpenCV
MIT License
124 stars 28 forks source link

converting figure to cv::Mat #9

Closed arrow53 closed 2 years ago

arrow53 commented 5 years ago

@leonardvandriel wow, this is a great addition to c++ plotting!

I'd like to be able to write the figure to an image buffer. Is there a way to plot to a cv::Mat or convert the figure to a Mat?

lgalardini commented 4 years ago

It is possible actually. The function Figure::show manage a cv::Mat object. After the function draw is called, in the sub variable you've your graph as a cv::Mat object. You can gen get directly from that.

I'm sorry for the late reply, I just used this library but I think this question was interesting!

leovandriel commented 2 years ago

It has been a while since you posted, but in case this is still relevant, #27 adds Figure::drawFit, which takes a cv::Mat and draws the figure. See Figure::drawFile for an example on how to use drawFit.