Forum

Author Topic: Masks and Memory  (Read 6812 times)

hanparker

  • Newbie
  • *
  • Posts: 25
    • View Profile
Masks and Memory
« on: September 23, 2015, 04:25:13 PM »
I have a chunk with 600 photos. This is made up of 6 sets of 100 photos. Each set of 100 photos has a different directory and a different mask. I have written some Python that gets the correct mask and applies to the photo. This seems to work fine and I check each photo and it has the correct mask - however when I try to save I get an Agisoft message saying "Not enough Memory". This isn't the physical limits of my PC as the task manager says I'm using about 6GB of the 32GB available. What's going on?

Here's the Python in case that is doing something obviously silly:

mask_list = list()
current_path = ""

chunk = doc.chunks[0]
#create a list of the 6 masks
for j in range(len(chunk.cameras)):
      camera = chunk.cameras[j]
      
      if current_path != os.path.dirname(camera.photo.path):         
         current_path = os.path.dirname(camera.photo.path)
         mask_name = os.path.join(os.path.dirname(camera.photo.path),"mask.png")
         print(mask_name)
         m = PhotoScan.Mask()
         m.load(mask_name)
         mask_list.append(m)
      
#apply the 6 masks depending on photo path
for i in range(len(doc.chunks)):
   print(i)
   current_path = ""
   mask_index = -1
   chunk = doc.chunks[ i ]
   for j in range(len(chunk.cameras)):
      camera = chunk.cameras[ j ]
      if current_path != os.path.dirname(camera.photo.path):      
         current_path = os.path.dirname(camera.photo.path)
         mask_index += 1   
      
      camera.mask = mask_list[mask_index]
   
      
print("applying masks finished")

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15420
    • View Profile
Re: Masks and Memory
« Reply #1 on: September 24, 2015, 12:54:47 AM »
Hello hanparker,

And are the masks correctly applied for all the images? Please also check if 64-bit version of PhotoScan is installed.
Best regards,
Alexey Pasumansky,
Agisoft LLC

hanparker

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Masks and Memory
« Reply #2 on: September 24, 2015, 10:37:39 AM »
Hi Alexey,

Yes It's 64 bit and yes the masks are applied correctly when I switch the masks on to view the area masked out - the output obj file looks great and all the bits I want to exclude, are excluded - it can happily export the obj file - it just won't save the .psz file.

I am running (in standalone mode) on 3 machines at the moment - I've just tried this on one machine. I am going to try on one of the other machines later this morning when it's free - to make sure it's not a problem with one of the machine's hardware.

Thanks,

Hannah

hanparker

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Masks and Memory
« Reply #3 on: September 24, 2015, 12:30:12 PM »
Ah! I think I've solved it. One of the sets of 100 photos didn't have a mask. It wasn't causing the Python to fail and it wasn't causing a problem with the obj export - however I have just made an empty mask for the last 100 photos and the *.psz file now saves!

Thanks for your time.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15420
    • View Profile
Re: Masks and Memory
« Reply #4 on: September 24, 2015, 12:35:31 PM »
Hello Hannah,

Thanks for the update on the issue.

Best regards,
Alexey Pasumansky,
Agisoft LLC