Texture mapped Pointcloud?

Hello,

I have a highly detailed pointcloud of a terrain together with hires orthophotos, is it possible to map those on the pointcloud so each point would acquire a certain color?

like here:

http://images.vizworld.com/wp-content/uploads/2009/09/studio-clouds-1.jpg

best regards

Andy

push…

Well, there used to be some scripting tools for Rhino 4 called Rhinoscript Image Extension which allowed access to image data in a script, which could then be mapped to a point color. I do not know if this works in Rhino 5 64 bit, it might only work in 32 bit Rhino 4 or 5…

Otherwise it might be possible with the image mapper component in Grasshopper, the problem is that object colors are normally things that cannot be assigned in basic Grasshopper, but with an extension you might be able to…

–Mitch

thanks Mitch, sounds interesting but probably to complicated for me :wink:

I thought there might be an easier solution without scripting …

thanks anyway

Andy

Point clouds in Rhino support RGB colors. If you application can write out an x,y,z,r,g,b file, then Rhino will import it and display these colors.

Hi Dale,

I already have that part… I wrote an XYZRGB importer for scan data awhile back in Python. What I need is to be able to open an image file with the script and extract colors from the pixels… I guess I (also the end user of the script) might need something like this?

–Mitch

Hi Mitch,

one of the few python scripts I wrote does read image/pixel color data:

readimageTest_02.py(1.3 KB)

HTH
-Willem

I have not been able to import a point cloud with RGB colors using the Import command.

In a thread I started about this problem Helvetosaur/Mitch provided Python scripts to import, export, explode and create point clouds with RGB colors. Point Colors: Import, Disply & Export - How?

Well, here is a first draft of a Python script for applying (or rather mapping) an image to a point cloud. It should work with any image and any point cloud, whether ordered or not (let me know if it doesn’t)… However, in this version the image is strictly mapped onto the point cloud (XY domain to XY domain), so if the point cloud is not the same proportions as the image, the image will be stretched or shrunk in one direction. I have an idea for a second version that will allow you to crop the image to fit the point cloud, but that is more work… no time now… Here it took about 30 seconds to map an HD image to a 1 million point random 3D point cloud so for high density point clouds, it may take some time… the algorithm is not all that fast.

Many thanks to @Willem for providing the link to System.Drawing.Bitmap for “mining” the image’s pixels - that will help for a few other things I want to do later as well !

Anyway, presented here FWIW… --Mitch

MapImageToPointCloud.py(2.6 KB)

Hello Helvetosaur & Willem -> thank you very much for the awesome script it works like a charm !

best regards and thanks again

Andy

No Thanks!
Glad it worked out.

I just now realized you are Andreas Walther; last time I emailed, you were in “Elternzeit” did you get that email? Hope all is well.

-Willem

Hello Willem,

yes, its me :wink:

I am now back to work (“Elternzeit” was great thank you) - I got your last mail thanks - everything is cool.

best regards

Andreas

Incidentally, I just tested this, and it still works - as David originally coded this in vb.net, it is bit independent and loads in either Rhino V5 32 or 64 bit. Just FYI if anyone’s interested…
–Mitch

Hi all,

I am trying to transform a 2d image into point clouds and later use the point clouds to create a mesh.
The second part can be done with the pointtool a rhino plug-in.
Do you have any idea on how I can do the first part? (either with rhino or grasshopper?)

Thank you for your help.

Best,
Harry

I have this script, which maps an image to an existing pointcloud. I don’t have one that actually creates the pointcloud though, but I think this one can be modified to do so if that’s what you need…

This can also be done in Grasshopper fairly easily.

–Mitch

MapImageToPointCloud.py (2.7 KB)

OK, now I do, it wasn’t hard to do… 1 pixel = 1 point (I have not done any re-sampling), choose an insertion point (lower left corner) and the overall width (X dimension). Will need a few seconds for large images.

–Mitch

CreateBitmappedPointCloud.py (1.6 KB)

Alright Mitch ! I will give it a try. Thanks a lot!

Hi Mitch, it works!!
but once I am in grasshopper and trying to change the bitmap to mesh I can not select the image/pointcloud as rub points separated and create my mesh.
I tried to split or extract the points from the point cloud image of rhino but it crashes.
…Sorry I am very new to scripting and grasshopper. Although I have made some examples on the image sampling.
Best,
Harry

Unfortunately, Grasshopper does not currently accept pointclouds as an input, only individual points. If you have a large pointcloud and you explode it, it will consume a lot of memory, so it might crash Rhino as you experienced…

I don’t have a real solution to that for the moment except to create the mesh directly from the image and just avoid the pointcloud step entirely. That can probably also be done with a script (not much time today), but one thing you could try “manually”:

1 - from the image file properties, get the pixel dimensions
2 - In Rhino, create a mesh plane with the same number of faces in X and Y as the pixel dimensions.
Mesh>Polygon Mesh Primitives> Plane, check the command line options
3 - Select the mesh, in Properties, go to the material tab, assign a material per object, and in the textures section under “color” assign your image to the mesh as a texture.

You now have a colored mesh with your image on it, and each pixel has been mapped to one face… don’t know if that is what you need though.

–Mitch

OK, here’s another script that makes a mesh directly from an image. The image pixel colors are mapped to the mesh vertex colors 1:1. I’m a bit out of my league here, I don’t know if this is the correct way to do this, but it seems to work…

Edit: I guess I should add here that if you have a very large image, adding the mesh will take a long time and use a lot of memory. For example a 6000 x 4000 pixel image such as the one you might get from a 24 megapixel camera will make a mesh with 24 million polygons… So beware time/memory/filesize issues…

–Mitch

CreateBitmappedMesh.py (2.2 KB)