Forum

Author Topic: Split in chunks : reuse depth map  (Read 4780 times)

nicokalo

  • Newbie
  • *
  • Posts: 27
    • View Profile
    • Photographe corporate paris
Split in chunks : reuse depth map
« on: April 07, 2019, 07:32:36 PM »
Hi all,

in the Split in Chunks script, there is an argument at line 272 that says
'if new_chunk.depth_maps:
reuse_depth = True

But i'm not sure how to tell the script that I want to reuse the depth map as there is no option for it.
Should I tell it when I call the script in the argument line ?

Thanks !
Best regards
My website as a professionnal photographer in Paris.
Photographe institutionnel paris
Photographe corporate paris

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Split in chunks : reuse depth map
« Reply #1 on: April 07, 2019, 08:17:16 PM »
Hello nicokalo,

The depth maps  would be re-used automatically, if they are present in the source chunk.
Best regards,
Alexey Pasumansky,
Agisoft LLC

nicokalo

  • Newbie
  • *
  • Posts: 27
    • View Profile
    • Photographe corporate paris
Re: Split in chunks : reuse depth map
« Reply #2 on: April 07, 2019, 09:28:57 PM »
Thanks Alexey,

I was wondering that it would be something like that but it seems that the depth map was not reused.

So i have a big chunk with a huge Tie point (3 000 photos).
I tried to build the dense cloud on high, it went well for the depth map then it stopped (not enough ram).

So I saved the file to keep the depth map (I can see it on the photos).

When I run the script, the first chunk starts by making a new depth map, and the pictures are shown as "no depth".

I might be doing something wrong but my guess is that the reuse depth did not work properly.
My website as a professionnal photographer in Paris.
Photographe institutionnel paris
Photographe corporate paris

nicokalo

  • Newbie
  • *
  • Posts: 27
    • View Profile
    • Photographe corporate paris
Re: Split in chunks : reuse depth map
« Reply #3 on: April 12, 2019, 08:44:25 AM »
Dear Alexey,

I have found what was happening.
Line 241 to 244, there is a condition before copying the Chunk.
If the user do not want to build a dense cloud, then Metashape makes a copy of the chunk with the dense cloud and the depth map.
If the user wants to build a dense cloud, then Metashape does not copy the previously existing dense cloud or dept map.

Or, in my case, I have enough RAM to make the Depth Maps but not enough to filter it and end the dense cloud.

So I update the script like that to force reusing the depth maps :

if not buildDense:
                    new_chunk = chunk.copy(items=[Metashape.DataSource.DenseCloudData, Metashape.DataSource.DepthMapsData])
                else:
                    new_chunk = chunk.copy(items=[Metashape.DataSource.DepthMapsData])
My website as a professionnal photographer in Paris.
Photographe institutionnel paris
Photographe corporate paris

nicokalo

  • Newbie
  • *
  • Posts: 27
    • View Profile
    • Photographe corporate paris
Re: Split in chunks : reuse depth map
« Reply #4 on: April 12, 2019, 08:50:57 AM »
I was to quick to rejoice !

It's now crashing because of the filtering argument :

2019-04-12 07:43:08   File "H:/split_in_chunks_dialog.py", line 278, in splitChunks
2019-04-12 07:43:08     new_chunk.buildDepthMaps(quality=quality, filter=filtering, reuse_depth=reuse_depth)
2019-04-12 07:43:08 UnboundLocalError: local variable 'filtering' referenced before assignment

That's new...
My website as a professionnal photographer in Paris.
Photographe institutionnel paris
Photographe corporate paris

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Split in chunks : reuse depth map
« Reply #5 on: April 12, 2019, 03:45:59 PM »
Hello nicokalo,

Which version of Metashape you are using?
Best regards,
Alexey Pasumansky,
Agisoft LLC

nicokalo

  • Newbie
  • *
  • Posts: 27
    • View Profile
    • Photographe corporate paris
Re: Split in chunks : reuse depth map
« Reply #6 on: April 12, 2019, 06:39:04 PM »
The last I guess, it's 1.5.2
My website as a professionnal photographer in Paris.
Photographe institutionnel paris
Photographe corporate paris

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Split in chunks : reuse depth map
« Reply #7 on: April 12, 2019, 06:45:14 PM »
Hello nicokalo,

OK, I think some corrections are required due to the changes in the meta information stored for the chunk instance and other processing result instances.

We'll try to apply them and update the script version.
Best regards,
Alexey Pasumansky,
Agisoft LLC

nicokalo

  • Newbie
  • *
  • Posts: 27
    • View Profile
    • Photographe corporate paris
Re: Split in chunks : reuse depth map
« Reply #8 on: April 12, 2019, 07:50:21 PM »
Thank you Alexey !

If you can warn me when it's working, I'll be happy !

My website as a professionnal photographer in Paris.
Photographe institutionnel paris
Photographe corporate paris

eltama

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Split in chunks : reuse depth map
« Reply #9 on: August 09, 2019, 07:46:16 PM »


Thanks Alexey,

I was wondering that it would be something like that but it seems that the depth map was not reused.

So i have a big chunk with a huge Tie point (3 000 photos).
I tried to build the dense cloud on high, it went well for the depth map then it stopped (not enough ram).

So I saved the file to keep the depth map (I can see it on the photos).

When I run the script, the first chunk starts by making a new depth map, and the pictures are shown as "no depth".

I might be doing something wrong but my guess is that the reuse depth did not work properly.

I all,
Same problem here, on Metashape 1.5.3,  I make a huge Tie point :o (30 000 photos 42Mb)

please fix that script

Thanks!
Best regards

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Split in chunks : reuse depth map
« Reply #10 on: August 09, 2019, 08:20:16 PM »
Hello eltama,

Have you checked the latest script version (updated yesterday) - https://github.com/agisoft-llc/metashape-scripts/blob/master/src/split_in_chunks_dialog.py

It should properly utilize fine-level task subdivision for build depth and dense cloud steps.
Best regards,
Alexey Pasumansky,
Agisoft LLC

eltama

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Split in chunks : reuse depth map
« Reply #11 on: August 11, 2019, 12:26:25 AM »
Hello Alexy
Thanks for quick reply, unfortunately it doesn't work, or it does but with a very low quality when I run the latest script.
to avoid some mistakes, I'll make again align photos, maybe the problem is due to a missing path for depth_maps.
I'll update you as soon as possible.


« Last Edit: August 11, 2019, 01:24:50 AM by eltama »

eltama

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Split in chunks : reuse depth map
« Reply #12 on: August 11, 2019, 02:28:37 AM »
I did align photos again, it doesn't work  :-\