Forum

Author Topic: Cannot undistort single channel image via Python api  (Read 2939 times)

Gall

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Cannot undistort single channel image via Python api
« on: August 03, 2017, 03:34:23 PM »
Trying to undistort a single channel image via the Python API currently throws an error in version 1.3.2. FYI, my test image was 16 bit single channel.

Code: [Select]
cam = chunk.cameras[0]
img = cam.photo.image()
undistort = img.undistort(cam.sensor.calibration)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-26-89efc18f6ebf> in <module>()
----> 1 undistort = img.undistort(cam.sensor.calibration)

TypeError: source image should contain 3 color channels

I think it should be considered a bug now as most, it not all, of the available operations correctly handle single channel images in the recent versions and the workaround is cumbersome.
Code: [Select]
undistort = img.convert('___').undistort(cam.sensor.calibration).convert('_')

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14927
    • View Profile
Re: Cannot undistort single channel image via Python api
« Reply #1 on: August 03, 2017, 03:52:48 PM »
Hello Gall,

Thank you for reporting.

We were able to reproduce the issue and will try to fix it in the next version update (1.3.3).
Best regards,
Alexey Pasumansky,
Agisoft LLC