Forum

Author Topic: How to use color tuple in createDifferenceMask?  (Read 6219 times)

Fernando

  • Newbie
  • *
  • Posts: 16
    • View Profile
How to use color tuple in createDifferenceMask?
« on: June 22, 2014, 02:11:33 PM »
Hi, I've tried this:

photo_mask = utils.createDifferenceMask(original_photo, (200, 200, 200), tolerance=50, fit_colors=True)

but Python returns an error:

RuntimeError: invalid color format

What am I doing wrong?

Thanks!

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15177
    • View Profile
Re: How to use color tuple in createDifferenceMask?
« Reply #1 on: June 22, 2014, 02:38:04 PM »
Hello Fernando,

What version of PhotoScan you are using?

Please also check that original_photo variable is Image class (photo.image() method should be used).
Best regards,
Alexey Pasumansky,
Agisoft LLC

Fernando

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: How to use color tuple in createDifferenceMask?
« Reply #2 on: June 22, 2014, 02:39:39 PM »
Hi, I'm using version 1.0.3.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15177
    • View Profile
Re: How to use color tuple in createDifferenceMask?
« Reply #3 on: June 22, 2014, 02:42:21 PM »
Hello Fernando,

Please check the latest build (1.0.4). I've just tested the operation by myself and haven't encountered any problems.

Code: [Select]
chunk = PhotoScan.app.document.activeChunk
image = chunk.cameras[0].image()  #first photo image
mask = PhotoScan.utils.createDifferenceMask(image, (200, 200, 200), tolerance = 50, fit_colors = True)
this code has worked for me.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Fernando

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: How to use color tuple in createDifferenceMask?
« Reply #4 on: June 22, 2014, 03:11:40 PM »
Thank you Alexey. I still don't know what's wrong with my own script, but I have a working version now!