Author Topic: Locate reflectance panels fails in my Python script  (Read 1517 times)


  • Newbie
  • *
  • Posts: 4
    • View Profile
Locate reflectance panels fails in my Python script
« on: April 23, 2020, 11:48:20 PM »

I've been struggling with multispectral MicaSense reflectance calibration from script and a total obstacle occurs on this command line:


TypeError: descriptor 'locateReflectancePanels' of 'Metashape.Metashape.Chunk' object needs an argument

I have learned the API manual, but I just can't get it how to make it.
If I remove parenthesis at the end the sript goes through without syntax errors, but unfortunately nothing happens for calibration images.
I checked and opened a project .psx and there were no values for bands and neither any images selected as calibration images. So reflectance calibration stage fails.
Instead, everything goes well at GUI. Then it reads QR codes automatically, so data is valid.

Here a part of my script:

chunk.importReference(files[0], Metashape.ReferenceFormatCSV, columns='nyxz', delimiter=',')

Metashape.chunk.calibrateReflectance(use_reflectance_panels=True, use_sun_sensor=True)
feedback.pushInfo('  * Micasense normalized and calibrated')

chunk.matchPhotos(downscale=1, tiepoint_limit=0)

Does anyone here have got a same problem and managed to fix it?
Do I have missed something important?
Should I import a reflectance data file (.csv) from path? But it should go automatically, because it is valid data with QR:s visible and it works at GUI.
I think Chunk.locateReflectancePanels must have been there because without it whole reflectance calibration is completely igonred.


Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14927
    • View Profile
Re: Locate reflectance panels fails in my Python script
« Reply #1 on: April 24, 2020, 02:03:46 AM »
Hello pilot-A,

You are not using chunks concept properly. In your example the methods are applied to the Metashape module classes (such as Metashape.Chunk or Metashape.Sensor) themselves, whereas you need to use project specific elements, like you are doing that for image matching, for example:
Code: [Select]
for sensor in chunk.sensors: #applying to all the sensors in the chunk
chunk.calibrateReflectance(use_reflectance_panels=True, use_sun_sensor=True)
Best regards,
Alexey Pasumansky,
Agisoft LLC