UV mapping textures onto Pointcloud?

Continuing the discussion from Texture mapped Pointcloud?:

Hi Helvetosaur,
I downloaded your python script for mapping an image onto a pointcloud and tried it out. It’s exactly what I’ve been looking for except I cant manually resize/crop the image onto the pointcloud. Is there a 2nd version in the works? I’ve been looking for something like this for a long time and your script is the only one that comes close to doing this. Any help would greatly be appreciated.

Ooof… now I have to remember what my idea to remap stuff was… :cold_sweat: So, how do you want to be able to crop your image…? I don’t really have a way to do an image editor for this function, but it should be possible to map the image to part of the point cloud or part of the image to the point cloud keeping the correct image ratio (not stretching or shrinking)…

–Mitch

What I’d like to do is insert the photo in as a picture frame and orient my view to a top view for example. Scale that photo and move it to the desired position. Use your script and three end points from the reference photo for orientation; texture the area of the pointcloud inside the region.

Thanks,
Meng

OK, that sounds like it might be doable. I have a ton of things on right now but I’ll start looking at it… So if I understand what you want, it’s to size and position the image over the point cloud in Top view and then “project” it onto the cloud?

Something that will complicate things considerably would be if the picture frame was cropped (trimmed), as scriptwise it’s difficult to get at the part of the image remaining; the other thing would be if the image is rotated (no longer parallel to the XY axis)… But I may have an idea or two about that, need to try some stuff.

–Mitch

Hi Mitch
If the texture UV of a surface UV can be queried via python; a closest point check would suffice to get to it. No need to worry about cropping or rotating.
I’m on my phone now but maybe I find some time tomorrow.

Willem

It doesn’t neccesarily have to be in the top view. Something that’s view dependant would work better for me since we do alot of camera matching to orient photos. I don’t want to be too burdensome, check it out at your convinience.

-Meng

Hi Meng,

Here’s what I came up with, by editing @Helvetosaur his script.
MapPictureframeToPointCloud.py (3.1 KB)

Please find a new version below with support for perspective views:

You can select a pointcloud (with or without colors).
Next select a pictureframe in the view you want it to be projected in.
For cropped images you can trim the pictureframe to the desired shape.

HTH
-Willem

Hey, thanks Willem for doing this! - I wouldn’t have had time to look at it until the weekend, and I’m sure you probably figured out a better way than I would have… I will have a look at the script later…

Cheers, --Mitch

1 Like

WOW!!! It worked. I’ve been looking for this type of feature for the longest time. It does takes a long time to generate with larger pointcloud but thats something I can live with. Thank you Mitch & Willem for taking the time to help me with this. I don’t know if I’ll be much help but I’d like to return the favor if you guys ever need anything.

-Meng

Glad I could help, as for

Just pay it forward!

Cheers
-Willem

Hi Willem,
I tried a camera matching project and got the photos oriented with respect to the pointcloud of the vehicle. When I use the script, it’s not projecting with repsect to the view. Can you check it out and see if I’m using the script correctly. It’s projecting to a small area vs the entire vehicle. Let me know if I’m not being too clear.

This shows the view from the camera with the image showing.


This shows the same view but with the pointcloud showing and the photo with 100% transparency.

This shows the image projected on the vehicle after executing the script.

This shows a perspective view of where the camera position and image is with respect to the vehicle.

Hi Meng,
The script works with a parallel projector.
So perspective views are not working as you expected. It can added, yet I’m not sure when I will have time for it afain.

-Willem

That makes sense now. Okay, sounds good.

Hi Meng,

I found some time and it was quicker than I thought:
Now supporting Perspective views.
Not that you need so select the picture-frame in the view you want it to be projected from.

MapPictureframeToPointCloud.py (3.5 KB)

HTH
-Willem

Hi Willem,
It works great!!! Again thanks for all the help Willem and Mitch.

-Meng

1 Like

Hello, Is there a working link to the ‘mapPictureframeToPointCloud’ script? It’s looks very useful but the links lead to 'oops, this page doesn’t exist or is private…

Thank you,
Jed

Hi jedhammerman,

Unfortunately these old attachments are often no longer accessible.
I fired up my old laptop and found the script:

MapPictureframeToPointCloud.py (3.5 KB)

-Willem

Perfect!

thank you,

Apologies for reviving a 5 year old conversation!

Jed

1 Like