Forum

Author Topic: Python with PhotoScan.RasterTransformValue  (Read 4967 times)

ruadi

  • Newbie
  • *
  • Posts: 16
    • View Profile
Python with PhotoScan.RasterTransformValue
« on: January 03, 2018, 03:14:53 PM »
Hi there,
I try to use raster-transforms, actually to export NDVI-Orthos.
When I run my script, a RunTimeError occurs, when exporting the ortho
Without "raster_transform = PhotoScan.RasterTransformValue", everything works fine.
Do I use the wrong syntax ?

Thanks, Ruedi


...
               self.chunk.raster_transform.formula = ["(B4-B2)/(B4+B2)"]
               self.chunk.raster_transform.calibrateRange()
               self.chunk.raster_transform.enabled = True
               self.chunk.exportOrthomosaic(saveOrtho, image_format = PhotoScan.ImageFormatTIFF, raster_transform = PhotoScan.RasterTransformValue)
...
Log:
2018-01-03 10:46:00 Agisoft PhotoScan Professional Version: 1.4.0 build 5650 (64 bit)
2018-01-03 10:46:00 Platform: Mac OS
2018-01-03 10:46:00 CPU: Intel(R) Xeon(R) CPU           X5670  @ 2.93GHz (server)
...
2018-01-03 12:43:33     self.chunk.exportOrthomosaic(saveOrtho, image_format = PhotoScan.ImageFormatTIFF, raster_transform = PhotoScan.RasterTransformValue)
2018-01-03 12:43:33 RuntimeError: Invalid data type
2018-01-03 12:43:33 Error: Invalid data type


Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: Python with PhotoScan.RasterTransformValue
« Reply #1 on: January 03, 2018, 04:28:33 PM »
Hello Ruedi,

Can you please specify, which filename is used in saveOrtho variable?

I'm not able to reproduce the issue on random project with the orthomosaic, executing the lines from your post:

chunk = PhotoScan.app.document.chunk
chunk.raster_transform.formula = ["(B4-B2)/(B4+B2)"]
chunk.raster_transform.calibrateRange()
chunk.raster_transform.enabled = True
saveOrtho = "D:/ortho.tif"
chunk.exportOrthomosaic(saveOrtho, image_format = PhotoScan.ImageFormatTIFF, raster_transform = PhotoScan.RasterTransformValue)

everything worked fine.
Best regards,
Alexey Pasumansky,
Agisoft LLC

ruadi

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Python with PhotoScan.RasterTransformValue
« Reply #2 on: January 04, 2018, 03:26:26 PM »
Hi Alexey,

variable "saveOrtho" contains: /Volumes/FastWork/PGResults/WSL/eBee/Sequoia/Sequoia_2017_11_01_v1.4.0_hMatch_proj_v1.4.0_hMatch_hDens_moFilt_ortho.tif


I used the same scripting classes for hundreds of successful process results.
When I use "raster_transform = ...", the export always fails,  without  "raster_transform = ...", everything works without RunTimeError and I get a correct exported orthophoto-product, exported report, exported points.
Using the saved project and afterwards manual export of the ortho with NDVI colors (via raster calculator) works!

??
Ruedi

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15086
    • View Profile
Re: Python with PhotoScan.RasterTransformValue
« Reply #3 on: January 05, 2018, 06:55:02 PM »
Hello Ruedi,

Is this issue reproducible on the single dataset only?
Best regards,
Alexey Pasumansky,
Agisoft LLC