c++ - Is it possible to have a cv::Mat that contains pointers to scalars rather than scalars? -
i attempting bridge between vtk (3d visualization library) , opencv (image processing library).
currently, doing following:
vtkwindowtoimagefilter
converts vtkrenderwindow
(scene) vtkimagedata
(pixels of render window).
i have copy each pixel of vtkimagedata
cv::mat
processing , display opencv.
this process needs run in real time, redundant copy (scene pixels imagedata
mat
) severely impacts performance. map directly scene pixels cv::mat
.
as scene changes, cv::mat
automatically reference scene. essentially, cv::mat<uchar *>
, rather cv::mat<uchar>
. make sense? or overcomplicating it?
vtksmartpointer<vtkimagedata> image = vtksmartpointer<vtkimagedata>::new(); int dims[3]; image->getimagedata()->getdimensions(dims); cv::mat matimage(cv::size(dims[0], dims[1]), cv_8uc3, image->getimagedata()->getscalarpointer());`
i succeeded implementing vtkimagedata*
directly cv::mat
pointer array..
some functions such cv::flip
or matimage -= cv::scalar(255,0,0)
directly working on vtkimagedata.
but functions cv::resize
or cv::canny
doesn't work.
Comments
Post a Comment