Mon, 05/15/2017 - 18:26
Forums:
Hello,
Is there any way of passing from TopoDS_Shape to Mat(OpenCV) directly? I mean, without having to save images in external folders. Now, I'm doing it saving the content of the V3d_View as an image by the method::Dump and then reading it with OpenCV. However, the resolution of the saved image is very poor and this is not an efficient method. Any idea?
Thanks!
Mon, 05/15/2017 - 20:46
There is not need to save image to the file for dumping V3d_View - look onto V3d_View::ToPixmap() method taking Image_PixMap for storing image snapshot. You can then either wrap Image_PixMap into cv::Mat or in opposite way - both classes provide an interface for wrapping external memory pointer, you need to find the appropriate pixel format / CV array type pair suitable for your application. RGBA8 is a native format used by 3D Viewer by default.
Have no idea if TopoDS_Shape can be mapped somehow directly to cv::Mat.
Tue, 05/16/2017 - 13:04
It works! Thank you!