Forum

Author Topic: Masking  (Read 25402 times)

scr1tch

  • Newbie
  • *
  • Posts: 10
    • View Profile
Masking
« on: November 20, 2017, 01:00:34 AM »
Hello. I saw in a YouTube video how to create a mask and apply it to all the other images so that a mask was automatically created from each image. I would also like to do that, because so later after the generation of point clouds no longer the background needs to be edited and cut away. But this does not work for me. How should I proceed exactly? Unfortunately, the video I saw referred to an older version of PhotoScan.

SAV

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
Re: Masking
« Reply #1 on: November 20, 2017, 03:57:52 AM »
Hi scr1tch,

Here is the workflow.
1. Generate the mask you want for one single picture in PhotoScan using the SELECTION TOOLS in the main icon bar

2. Then TOOLS > EXPORT > EXPORT MASKS. Save as a single channel mask image.

3. TOOLS > IMPORT > IMPORT MASK. Choose these settings: FROM FILE, REPLACEMENT and APPLY TO ALL CAMERAS. You then have to enter the filename of the mask you stored in step 1, e.g. mask.jpg. Then press OK.

4. A window will pop up asking you to select the FOLDER where the mask.jpg file is stored in. Navigate to that folder an then click the SELECT FOLDER button.

DONE. Your mask should now have been applied to all images. Note that this workflow will apply the same mask to every picture, e.g. very useful to ignore 'overlays' in images.

Regards,
SAV
« Last Edit: November 20, 2017, 03:59:23 AM by SAV »

scr1tch

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Masking
« Reply #2 on: November 20, 2017, 10:07:52 AM »
Thank you for the speedy response. Sounds comprehensible so far, even if that deviates significantly from the video. I'll try it out today, but it looks promising :)

scr1tch

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Masking
« Reply #3 on: November 21, 2017, 11:18:03 PM »
Hello. I tested a little bit again, but was not successful. How do I get that, what does this in the video?
https://youtu.be/NuJCRIkmn60?t=171

cadm8

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
Re: Masking
« Reply #4 on: March 26, 2018, 05:24:15 PM »
Hi scr1tch,

Here is the workflow.
1. Generate the mask you want for one single picture in PhotoScan using the SELECTION TOOLS in the main icon bar

2. Then TOOLS > EXPORT > EXPORT MASKS. Save as a single channel mask image.

3. TOOLS > IMPORT > IMPORT MASK. Choose these settings: FROM FILE, REPLACEMENT and APPLY TO ALL CAMERAS. You then have to enter the filename of the mask you stored in step 1, e.g. mask.jpg. Then press OK.

4. A window will pop up asking you to select the FOLDER where the mask.jpg file is stored in. Navigate to that folder an then click the SELECT FOLDER button.

DONE. Your mask should now have been applied to all images. Note that this workflow will apply the same mask to every picture, e.g. very useful to ignore 'overlays' in images.

Regards,
SAV

Hey SAV, I must be doing something wrong, I'm exporting the mask from one photo and importing it by applying to all cameras, yet the mask isn't orientating to the photos...

Steve003

  • Full Member
  • ***
  • Posts: 169
    • View Profile
Re: Masking
« Reply #5 on: October 14, 2021, 06:52:00 PM »
Hi
Did this ever get solved ?

Thats incredibly clever and a game changer, days of masking is not feasible, if it works, here for you it didnt.
Can anyone shed more light on how it works and how I can use a mask made in photoshop ?

How can Agisoft know exactly where the mask would be on all 155 photos from just one mask image ?

There is also mask from model, which is best, thats also very clever. if I can find out how to do it.

I am very interested in saving days of work by having agisoft metashape apply mask to all 155 images if I mask just one, using photoshop as the tools are more precise and I am familiar with them, so I would save as a .bmp that supports alpha channel, and import it and then not sure what to do then, apply to all cameras I think.


Steve

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Masking
« Reply #6 on: October 15, 2021, 12:36:31 AM »
Hello Steve,

If you create a mask in external application, it's recommended to save it as a transparency to alpha-channel, then in Metashape window use File Menu -> Import -> Import Masks option and choose From Alpha. TIFF format is recommended, as it allows to keep the original EXIF.

Alternatively you can export masks as B&W images following the original filenames convention and use Import Masks -> From File option in Metashape.

Best regards,
Alexey Pasumansky,
Agisoft LLC

Steve003

  • Full Member
  • ***
  • Posts: 169
    • View Profile
Re: Masking
« Reply #7 on: October 15, 2021, 03:08:31 AM »
Hi Alexey,
 I cannot believe metashape can mask up 155 images if I mask up one as a tiff.
Thats very clever indeed, incredible in fact, saves days of work masking each one.

I have a tractor wheel with four holes in the hub, so if I paint a mask around it, getting rid of grass, and paint in the four holes, it will then apply that to all the images whatever the angle , as I have photographed the front and back of the wheel whilst it was on the tractor at a show.

Yet to see a video anywhere on this, .

See also please my post about mask from model method :-
https://www.agisoft.com/forum/index.php?topic=13828.0

I foresee a catch 22 situation if model cant form as it needs a mask,  as masking that way is also a lifesaver and I wonder how its done if so.

Are there any videos made to show these potential life saving methods, by Agisoft ?...or anyone ?

Steve
« Last Edit: October 15, 2021, 03:12:58 AM by Steve003 »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Masking
« Reply #8 on: October 15, 2021, 05:50:54 PM »
Hello Steve,

Actually, I have meant, that you can import the masks from the external source using alpha-band or B&W images. Following this approach, Metashape wouldn't create new masks that are different from the existing shape of the external masks. But if you need to mask out the same area on multiple images (for example, some fixed element in the image corner, that moves together with the camera), then it can be done with the single mask applied to multiple cameras.

We are planning to publish some tutorials related to different masking approaches, not sure, though, that it would be videos - mot likely text with the screenshots and, maybe, animated illustrations.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Steve003

  • Full Member
  • ***
  • Posts: 169
    • View Profile
Re: Masking
« Reply #9 on: October 15, 2021, 06:11:32 PM »
Oh I see, only of use then from one mask made in photoshop or with your tools, if the same masked area was needed and common to all photos.

So to save having to individually mask up 155 images where each one is a bit different as one moves round it with camera, mask from model is the way, am I right ?

I have yet to see enough videos to see and understand, also believe, how this is done and achieved.

I can envisage a situation where the model cant be made without features in images that are upsetting the process being masked off, so then what, hours if not days of masking. With many such cluttered backgrounds one might need a second lifespan !

ways to overcome such are essential to know of.

Videos are best but anything is welcome, there is a lack of instruction on this and I am floundering a bit. and maybe others as well.

Thought I had seen a youtube video of a statue where she masks one and applies to all cameras.

Steve

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Masking
« Reply #10 on: October 15, 2021, 07:07:24 PM »
Hello Steve,

Would it be possible for you to share some screenshots (if not a Metashape project itself), that demonstrate the result of default model reconstruction and also show the model that you would like to get (maybe with some rough manual editing of the mesh you can give an idea, of what you are trying to get). Also the overview of the thumbnails for the original images would be helpful to understand better the project specifics.

Quote
Thought I had seen a youtube video of a statue where she masks one and applies to all cameras.
If it was our old tutorial regarding 3D Model Generation (for PhotoScan Standard 0.9), then it showed how to draw the masks manually and how to import the masks (from B&W images) for all the images. But some users were confused and thought that after drawing the single mask, the same object has been masked out on all the other photos (however, those masks have been just imported from the files - and it has been actually mentioned in the video).
Best regards,
Alexey Pasumansky,
Agisoft LLC

Steve003

  • Full Member
  • ***
  • Posts: 169
    • View Profile
Re: Masking
« Reply #11 on: October 15, 2021, 07:14:04 PM »
Hi,
 I will send over to you my tractor project, taken on a sunny day when the forecast said cloudy bright, so I am worried !
and the earlier tractor wheel where overlaps found 93 images when I saw perhaps 20, 93 making massive gaps in my coverage  :'(
Allow me a few days.
remind me what is best way of getting project to you with all the associated images ?

update both now sent, tractor exterior even showed parts of interior and ignored reflections, no images failed, I WAS AMAZED, means dont worry about reflections and shadows, FANTASTIC IF THAT HAPPENS EACH TIME !
 but then the cab interior Chunk rejected quite a few, they being those that were NOT rejected in the exterior shots !
This is a pain and needs sorting out, surely that shouldnt be, it was all going so well.

Steve
« Last Edit: October 18, 2021, 04:10:13 PM by Steve003 »