Forum

Author Topic: Masking transparent parts of images  (Read 274 times)

jinjamu

  • Newbie
  • *
  • Posts: 33
    • View Profile
Masking transparent parts of images
« on: March 21, 2019, 09:27:22 AM »
Hi,
I am trying to eliminate a large amount of unwanted background noise in a model by changing specific colours to transparent in a batch process, saving the images as PNGs, and redirecting Photoscan to use those images to texture the model.  The workflow seems to work well, only the "transparent" areas are being rendered as white, whereas I wish to eliminate the areas totally.  I am using Photoscan 1.4.5.  Does anyone have any suggestions or indeed maybe a different approach? Maybe there is a process where one can automatically mask out the transparent areas, but I dont know how to do this.
Thanks!

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 10302
    • View Profile
Re: Masking transparent parts of images
« Reply #1 on: March 21, 2019, 12:59:33 PM »
Hello jinjamu,

If the imported PNGs do have transparency, you need to use File Menu -> Import Masks -> From Alpha option to load the masks from the transparency channel.
Best regards,
Alexey Pasumansky,
AgiSoft LLC

jinjamu

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Masking transparent parts of images
« Reply #2 on: March 21, 2019, 06:11:01 PM »
Thanks Alexey!  That worked perfect and i am now seeing the masks.

Would I then need to rebuild the mesh or can I go straight to the texturing?

Regards

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 10302
    • View Profile
Re: Masking transparent parts of images
« Reply #3 on: March 21, 2019, 06:33:38 PM »
Hello jinjamu,

If the mesh is fine for your needs, you can just generate the texture: masks will be automatically applied.
Best regards,
Alexey Pasumansky,
AgiSoft LLC

jinjamu

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Masking transparent parts of images
« Reply #4 on: March 21, 2019, 10:50:44 PM »
Hi Alexey. 

I did as you suggested, however the masked out pieces are ending up as white in the textured model. The masking worked 100%, as I mentioned before, and my hope was that the polygons generated from the masked out areas would simply disappear. 

I generated the PNGs with the transparencies from a program called IMBATCH.  I did the alignment with JPGs and Photoscan had no problem to accept PNGs instead.

Thanks for any advice

John

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 10302
    • View Profile
Re: Masking transparent parts of images
« Reply #5 on: March 22, 2019, 01:42:35 AM »
Hello John,

Texturing stage does not alter the mesh surface. If you need to correct the polygonal surface itself, you need to rebuild the mesh basing on the masked images.
Best regards,
Alexey Pasumansky,
AgiSoft LLC

jinjamu

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Masking transparent parts of images
« Reply #6 on: March 22, 2019, 08:25:09 AM »
OK I understand. 

So is it correct to say that when a "transparent texture" is encountered in a photo, which matches a mesh surface, then this is textured as white?  (Please excuse my possibly clumsy use of terminology)

Rgds

John

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 10302
    • View Profile
Re: Masking transparent parts of images
« Reply #7 on: March 22, 2019, 01:58:14 PM »
Hello John,

If you are not using "hole filling" option for the Build texture operation, the areas that are not seen from any enabled aligned cameras would be black.
Best regards,
Alexey Pasumansky,
AgiSoft LLC

jinjamu

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Masking transparent parts of images
« Reply #8 on: March 22, 2019, 08:53:20 PM »
OK that works

Is there any way not to render those "transparent" areas at all? 

Thanks

John