0

In the past few days I have searched all over google for a clear explanation on how to face my project's last and great challenge in order to finish it.

I have an array of opencv colored Mat, each represents one slice of a 3d-model. And I need to be able to display a 3d-model build from these slices.

(I can undo the entire use of opencv because I have the rgb and (x,y,z)-values of all pixels , I just thought it would be easier to transform openCV::Mat to another external library's object in order to build the volume).

To be more clear, I have an RGB value and (x,y,z) position for every pixel that will construct the 3d-model and I need a way to display them all together as a 3d-model.(I think that means to build a volume but I'm not sure)...

Any use of external library is allowed and recommended.

I'm working on visual studio 2013(community version) and writing on C++.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Etay
  • 73
  • 7
  • 1
    I fail to see what this has to do with C++? Also you could be more clear about the structure of your 3D model. It *appears* (in order to be a sensible question) that the pixels can have only 2 colors, and that pixels of one particular color constitute some body that you want a mesh for or something like that, is that so? Anyway, can you be more clear? – Cheers and hth. - Alf May 10 '15 at 09:49
  • I'm sorry for not being clear enough. Let me elaborate: Lets say the size of my 3d-tray is 200X200X200(so eventually I want to display a 200X200X200 picture\volume\a more correct term). each pixel among these 200X200X200 has x,y,z position and RGB value(might be any RGB value and can be different from each other) which I calculated earlier. What I need to do, is exactly like building a 2d matrix pixel by pixel and then using imshow() only in 3d. About C++, I just wanted to be informative as I can(because maybe a certain external library doesn't support c++)... – Etay May 10 '15 at 10:21
  • did you google for "volume rendering"? afair there are 3 methods in basic literature: 1. indirect rendering: convert slices to 3d mesh and render with openGL. 2. direct rendering: create a camera model and shoot rays through your slices. 3. "efficient" method: use your slices as a 3D openGL texture and render it. – Micka May 10 '15 at 10:29
  • does each voxel of your 200x200x200 volume have a transparency/density value too? if not, how would you ever "see" the center voxel? – Micka May 10 '15 at 10:32
  • afair one often used library is VTK. google vtk volume rendering too – Micka May 10 '15 at 10:34
  • Can you please elaborate on options 1 and 3? I don't need lighting,camera or ray-tracing algorithm since I already have it's output - an RGB value of each pixel and it's (x,y,z) location. All I need is a library that implemented a data structure which contains 3d pixels and a method that renders this information and presents it to the screen. I wish openCV had a 3d-matrix object and imshow3d() , that could make me life a lot easier, but unfortunately, It's not exist. – Etay May 10 '15 at 10:41
  • "does each voxel of your 200x200x200 volume have a transparency/density value too? if not, how would you ever "see" the center voxel?" For simplicity, let's say there is no transparency and eventually I will see only the shell. – Etay May 10 '15 at 10:43
  • so the shell will be a colored 200x200x200 cube... in fact "volume rendering" is all about transparency/density... in method 1 you say that density=x is the target density/color you want to extract. then you use "marching cubes" algorithm to extract a 3D mesh from it. method 3 i dont remember completely but afair it's to use a 3d texture and then create a 2d polygon parallel to your camera plane (which is an arbitrary slice in your voxel cube) and render it. – Micka May 10 '15 at 11:51
  • You are right. So let's say each pixel has one of two transparency values: completely transparent or none at all. Given these transparency values do you know an external library that does what I ask? – Etay May 10 '15 at 12:08
  • never had to perform volume rendering but I would give VTK a try – Micka May 10 '15 at 12:28
  • Unlike forum sites, we don't use "Thanks", or "Any help appreciated", or signatures on [so]. See "[Should 'Hi', 'thanks,' taglines, and salutations be removed from posts?](http://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts). BTW, it's "Thanks in advance", not "Thanks in advanced". – John Saunders May 10 '15 at 16:50
  • @Etay Do you mean something like what Matlab does with its 3D plots? – a-Jays May 10 '15 at 18:46
  • John, I didn't know, but I'll know for the next time. a-Jays: Eventually I found someone who did it, so here is what I found: https://sites.google.com/site/pierrefillard/coding-blog/createa3dvolumefromseveral2dimages – Etay May 11 '15 at 16:59

0 Answers0