XYZ Data to Mat
Hi,
i have a 3D picture, with x,y,z data for each point in a struct. Now i want to save this data into a Mat. But don't know how.
Mat depthimage
depthimage.create(data->with, data->height),CV_32F...) // do I need 3 channels for xyz or is that only for RGB values ?
int c = 0;
for( int y; y< depthimage.rows, y++)
{...
for(int x; x< depthimage.cols; x++, c++)
{
auto currentpoint = data->points.at(c);
//Here i have to fill the matrix, i think, but how? I only see examples for 2D matrizes
...
}}
I want a 3D PointCloud
it's unclear, what kind of
data
you have, so far, please show that.what are you trying to do later with that ? (e.g. for PCL, you would use their Pointcloud struct, not a Mat)
Well at least i can answer one of the comment from the source code : // do I need 3 channels for xyz or is that only for RGB values ? Yes these are for the rgb values only
Maybe a stupid idea - could you represent the depth via a vector or something? Sorry - i am still very new to computer vision conceps.
@holger: bw depth images are usually just a visualization of the z component(1 channel only). coloured depth images are mostly done by converting this channel back to CV_8U, and applying some color_map (LUT) . the result of that is indeed bgr, 3 channels.
oh well - still have much to learn i guess XD