Notifications
Clear all

[Closed] Intersect Ray Information-Creating Points

Hey all,

My first attempt at doing this was using a colour image and a depth map. My script worked but the resulting pointcloud that i generated was not accurate so i’m wondering if a new approach might work better using intersect ray. Anyway, what i want to do, essentially, is take a photo of a real world location ( all the camera parameters and location would be known) and then bring it into the 3d scene with my meshed pointcloud. Then the steps would be as follows:

-shoot rays from the camera through an image/photo (known location/camera settings)
-then each ray would go through each pixel in the image and return a distance and angle when it hits the geometry in the scene.
-then with the 3d coordinate i would write out the position x,y,z and then the pixel RGB value for colour (eg. 10 12 10 255 120 255)

Any help would be greatly appreciated…if more info is needed let me know. I can post the script that i adapted that sort of worked. Really stuck here!

2 Replies

Here is the code that i used for my first attempt.


    col_bmp =  openbitmap "C:\\DDE Stuff\Kingsville-Colour-400.jpg"		
    zdepth_bmp = openbitmap "C:\\DDE Stuff\Kingsville-Zdepth-400.jpg"
    progressstart "Rendering Voxels..."
    for y = 1 to col_bmp.height do
    (
     progressupdate (100.0 * y / col_bmp.height)
     pixel_line = getpixels col_bmp [0,y-1] col_bmp.width
     z_line = getpixels zdepth_bmp [0,y-1] col_bmp.width
    		
     for x = 1 to col_bmp.width do
     (
    	 camview_width = 94.366
    	 camview_length = 46.404
    	 img_pixel_width = 1920 as integer
    	 img_pixel_length = 1080 as integer
    	 z_min_dist = 0 as integer
    	 z_max_dist = 140 as integer
    	 col_min = 0
    	 col_max = 255
    	 pixel_line[x]
    	 z_line[x]
    	 
    	 --z_offset = (((z_max_dist - z_min_dist)/(col_max-col_min))*(z_line[x].red as integer))
    	 z_offset =(1.0 * z_line[x].red as integer)  --actual value of max dist divided by rgb limit  1.96078431372549
    	 -- x*-0.3700627450980392
    	 --y*0.1819764705882353
    	 format "% % % % % %
" ( x*-1.0) (y*1.0) z_offset (pixel_line[x].red as integer) (pixel_line[x].green as integer) (pixel_line[x].blue as integer)
    	 
    )--end y loop
    progressend()
    
Here are the images i was using:

[img] http://vehiclemetrics.com/dwayne/junk/Kingsville-Colour-400.jpg [/img]

[img] http://vehiclemetrics.com/dwayne/junk/Kingsville-Zdepth-400.jpg [/img]

...and my sample output file....
[ http://vehiclemetrics.com/dwayne/junk/sampleoutput.xyz ]( http://vehiclemetrics.com/dwayne/junk/sampleoutput.xyz) 

...and what my ouptu looked like as a pointcloud...

[img] http://vehiclemetrics.com/dwayne/junk/CC-capture-pointcloud.jpg [/img]

Again...any help is greatly appreciated!

Beginning to realize this is more complex then i had originally thought.