cdcseacave / openMVS

open Multi-View Stereo reconstruction library
http://cdcseacave.github.io
GNU Affero General Public License v3.0
3.19k stars 892 forks source link

Black spots on the texture image #961

Open Sanheiii opened 1 year ago

Sanheiii commented 1 year ago

Undistorted images sometimes have black pixels at the edges, but OpenMVS still uses these parts to generate the texture. After seam leveling as if they were smeared, a large black spot is formed on the texture image. 图片

cdcseacave commented 1 year ago

Indeed, this can happen. This would be quite easy to fix. Pls contribute if you have time.

Sanheiii commented 1 year ago

I've made some attempts, without changing the MVS format, I think it's possible to give preference to views where the faces are projected closer to the center of the photo or to remove views based on color, but I don't think these are good solutions, they may reduce the quality of the textures and are not very accurate. I think I need to introduce distortion parameters for the MVS format. But you mentioned it's would be quite easy to fix, my programming and math skills are average, so I hope I can ask you for some ideas.

PxGluz commented 1 year ago

Hi! I'll give a shot to solving this issue. I'll try to create a mask that would match the image distortion so that TextureMesh would only use pixels from within the mask.

Sanheiii commented 1 year ago

Thanks for the suggestion, I misunderstood mask and thought it would only be used in dense restruction, I will try it.

Sanheiii commented 1 year ago

967 would require users to create masks to utilize the fix. Creating masks from distortion parameters is not a terrible idea. Using threshold might clip some of the image without detection of image border.

I filled a white picture and undistorted it, using it as a mask into TextureMesh, there was no significant improvement to the problem, I made the black part of the mask inflate a few pixels later, the black spots were completely gone.

cdcseacave commented 1 year ago

PR #968 is automatically generating valid image masks by removing black regions around the undistorted image