Forum

Author Topic: FASTER EXPORTS OF MASKED IMAGES  (Read 8479 times)

jkova96

  • Full Member
  • ***
  • Posts: 149
    • View Profile
FASTER EXPORTS OF MASKED IMAGES
« on: October 25, 2023, 12:20:41 AM »
Hi,
I just want to have faster exports of colored masks in future,
cause this is too slow...so far. I want to export about 270 masks of pictures, and
this is only supported by png file. PNG file is too heavy and it's not necessary to be so precize and accurate cause originally images are in JPEG/JPG format.
If I switch extension to jpg or jpeg format I got nothing, don't know this is maybe bug too.
I mean, I should expect that every feature of this software works perfect, cause cost is 'perfect' too.
Not loosing...Idk 30 minutes for exporting 250+ images. My processor is Intel i5, 16 GB RAM, SSD+HDD, Gtx 1060.
Thanks :)
« Last Edit: October 27, 2023, 12:57:41 AM by jkova96 »

jkova96

  • Full Member
  • ***
  • Posts: 149
    • View Profile
Re: FASTER EXPORTS OF MASKS IN COLOR
« Reply #1 on: October 25, 2023, 12:59:32 AM »
Just to inform you how is this slow on my machine...
See image below

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15032
    • View Profile
Re: FASTER EXPORTS OF MASKS IN COLOR
« Reply #2 on: October 25, 2023, 03:54:15 PM »
Hello jkova96,

What settings you are using for the mask export operation and whether the files are saved locally or to external/network drive?
Best regards,
Alexey Pasumansky,
Agisoft LLC

jkova96

  • Full Member
  • ***
  • Posts: 149
    • View Profile
Re: FASTER EXPORTS OF MASKS IN COLOR
« Reply #3 on: October 26, 2023, 12:58:29 AM »
Hi Alexey,
Files are saved locally.
There's screenshot below to inform you about used settings. There's two pictures showing same thing, but one is larger other one is smaller.
In text - used settings are: File type: Image with alpha channel; Filename template: {filename}_mask.png; Apply to: All cameras
I want to know why this does not working when overwrite extension .png with .jpg for example, so instead of {filename}_mask.png I wrote {filename}_mask.jpg.
Basically, when I use {filename}_mask.jpg under filename template, function work much faster but INSTEAD OF MASKED PICTURES I GET ORIGINAL PICTURES (like taken on the field)
Does that maybe BUG in software or what?
Please reply to me back when you get this message, cause it's nothing solved yet :/
Bye !
Josip :)
« Last Edit: October 26, 2023, 01:04:24 AM by jkova96 »

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15032
    • View Profile
Re: FASTER EXPORTS OF MASKED IMAGES
« Reply #4 on: October 27, 2023, 03:30:03 PM »
Hello Josip,

JPEG format doesn't support transparency in the alpha channel, that is why you do not get masks from alpha in this format. You may consider TIFF or JPEG2000 (.jp2) file formats for export, which should be faster than PNG.

However, is there any benefit for such export, compared to keeping original images and single-channel (black&white) masks separately? Because you are likely loosing all meta information when exporting masks to image+alpha files.
Best regards,
Alexey Pasumansky,
Agisoft LLC

tazzo

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: FASTER EXPORTS OF MASKED IMAGES
« Reply #5 on: October 27, 2023, 04:45:40 PM »
Have you tried disabling the antivirus (ex. Realtime Windows Defender) to see if things speed-up?
To me anyway seems something wrong with the pictures metadata. Are these .HEIC files?
Can you try to convert them to another format (ex. TIFF) before using them in Metashape?

jkova96

  • Full Member
  • ***
  • Posts: 149
    • View Profile
Re: FASTER EXPORTS OF MASKED IMAGES
« Reply #6 on: October 28, 2023, 06:03:38 AM »
Hello to Alexey, Hello tazzo,
I just want try to use them like pictures for 3D model processing on another software. The main issue of that software - I'm not sure if it uses masks on a way like Agisoft does. I work before with masks from Agisoft but only on a smaller dataset. Now is much larger and I don't want to wait so much.
I'll try to export masks in TIFF.
I hope this would run much faster cause exporting to PNG was exhausting...Thanks for answer.

I did not actually pay attention tazzo that Windows Defender can affect speed on how many masks will be generated.
I don't know even If I'm having this Real Time protection, I mean - I'm not sure about it. Thanks for advice by the way. I should definitely check that. Thanks for both of you. Really :)

Best regards,

J.K.

tazzo

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: FASTER EXPORTS OF MASKED IMAGES
« Reply #7 on: October 28, 2023, 06:05:48 PM »
Hello,
To try you should convert your source images (not the masks) to TIFF without deleting the camera metadata. If you can share your dataset I can try on my pc to export the masks and see how much time it takes.
Windows Defender is activated by Default on Windows 10/11 and turn on again at every restart.

jkova96

  • Full Member
  • ***
  • Posts: 149
    • View Profile
Re: FASTER EXPORTS OF MASKED IMAGES
« Reply #8 on: November 11, 2023, 03:39:39 AM »
Hi tazzo,
Sorry for being really late...
I did not convert original to TIFF images, but instead of that I can send you original files (all pictures, original files)
Hope you have 1.8.5 version or later.
I can send you link with the files and pictures too.
Here's the project link: https://mega.nz/folder/9HIXWKQQ#DYGvAuMF2U_m7JzsNYUY9Q
Don't know how fast it can be when you convert to TIFF but I can share with you few pictures to show you how fast it was with mine exports to PNG.
Check for attachments.
« Last Edit: November 11, 2023, 03:45:25 AM by jkova96 »

tazzo

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: FASTER EXPORTS OF MASKED IMAGES
« Reply #9 on: November 11, 2023, 07:39:14 PM »
Hello,

There is definitively something wrong on your side, without changing anything I got masks exported as PNG in less than 30 seconds.
Please see attached image.

Cheers

PS: I did the test on my laptop, nothing fancy: ssd disk, 16gb ddr5, intel i7-1260P, no dedicated graphics card
« Last Edit: November 11, 2023, 07:41:21 PM by tazzo »

jkova96

  • Full Member
  • ***
  • Posts: 149
    • View Profile
Re: FASTER EXPORTS OF MASKED IMAGES
« Reply #10 on: November 11, 2023, 11:19:28 PM »
Hi tazzo,
I'm sorry because of innactivity....
Did you export maybe black-white masks instead of "masks in color"? I mean on images with alpha channel when selecting type of masks?
Cause that's really fast from my perspective.
What Agisoft version did you used?

I'm having Agisoft version 1.8.5 on my laptop which have i5-7300HQ,
16 GB DDR4, Nvidia GTX 1060 (Mobile max Q) graphics, SSD 250 GB + 1 TB HDD. At the time I think that I export images while they were stored on SSD disk, Agisoft is also on SSD.

Don't know what might be a reason for this difference in performance, if you used images with alpha channel as export option for masks.

Bye :)

J.K.
« Last Edit: November 11, 2023, 11:22:25 PM by jkova96 »

tazzo

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: FASTER EXPORTS OF MASKED IMAGES
« Reply #11 on: November 12, 2023, 02:31:34 AM »
Hello JK
Sorry, was the B/W mask.
The masked color image take a while in PNG, but much less time if you export in TIFF.
The fastest way is probably to export the B/W mask and use a thirty party software to batch apply masks in parallel.

jkova96

  • Full Member
  • ***
  • Posts: 149
    • View Profile
Re: FASTER EXPORTS OF MASKED IMAGES
« Reply #12 on: November 12, 2023, 12:14:32 PM »
Hello tazzo,
In my case it was masks in color.
I hope that you really make also these,
Cause my times reffered to these masks - in color,
Images with alpha channels - don't know how they refer but it's shows you only object of interest without background.
What software does this? Is it maybe GIMP?
I could try that. Thanks for advice.
Have a nice day :)

tazzo

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: FASTER EXPORTS OF MASKED IMAGES
« Reply #13 on: November 12, 2023, 01:29:12 PM »
Hello,

I tested v.1.8.3.

Color mask export in TIFF takes less than 3 minutes (149 seconds) on your Andjeo dataset.

The export is using the CPU only, but is not worth to use another software because the computation is not so long.

I usually use Affinity Photo for batch processing or a script with ImageMagick.

Can you try to export in TIFF too?

jkova96

  • Full Member
  • ***
  • Posts: 149
    • View Profile
Re: FASTER EXPORTS OF MASKED IMAGES
« Reply #14 on: November 12, 2023, 05:37:35 PM »
Hi tazzo,

I did not tried anything so far, but you definitely encourage me for doing so. Did you get same pictures, but without background...if you know what I mean?

I should try on my laptop same, like you said - export to TIFF then compare processing time with yours. It's pretty OK when you done with processing under 5 minutes. It's much better than approx. half of hour.

I'll talk to you back when I try to do same thing...in addition with comparison in processing time.

PS. Thanks for writing to me back tazzo and thanks cause you do this research unlike me.

Bye :)

J.K.