UV mapping textures onto Pointcloud?


#1

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.


#2

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


#3

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


#4

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


(Willem Derks) #5

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


#6

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


(Willem Derks) #7

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


#8

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


#9

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


(Willem Derks) #10

Glad I could help, as for

Just pay it forward!

Cheers
-Willem


#11

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.


(Willem Derks) #12

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


#13

That makes sense now. Okay, sounds good.


(Willem Derks) #14

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


#15

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

-Meng