Forum

Author Topic: Metashape.Chunk' object has no attribute 'camera'  (Read 1903 times)

Darshan

  • Newbie
  • *
  • Posts: 5
    • View Profile
Metashape.Chunk' object has no attribute 'camera'
« on: December 15, 2019, 02:51:32 PM »
Hi

i am trying to for the rotation matrix from the camera center and the camera position input and i am getting the below error

 <Chunk 'Chunk 3'>
2019-12-15 12:44:51 Traceback (most recent call last):
2019-12-15 12:44:51   File "C:/Users/Darshan Savanur/Downloads/project/py files/script2.py", line 13, in <module>
2019-12-15 12:44:51     for camera in ch_flir.camera:
2019-12-15 12:44:51 AttributeError: 'Metashape.Chunk' object has no attribute 'camera'
2019-12-15 12:44:51 Error: 'Metashape.Chunk' object has no attribute 'camera'

please help me on this .. I think there is something wrong with my labels in my other code which generates csv with camera co-ordinates and camera center ...please check the attached file which generates this csv


import Metashape
import numpy


doc = Metashape.app.document#active ch_flir

ch_flir = doc.chunks[2]
print(ch_flir)
cameracenter= numpy.loadtxt(open(r"C:\Users\Darshan Savanur\Downloads\project\py files\cameracenttermal.csv","rb"), delimiter=",")

R = []

for camera in ch_flir.camera:
   
    d = ch_flir.crs.project(ch_flir.transform.matrix.mulp(cameracenter))
    T = ch_flir.transform.matrix
   
    print (T)

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: Metashape.Chunk' object has no attribute 'camera'
« Reply #1 on: December 15, 2019, 03:57:36 PM »
Hello Darshan,

I think it should be:
Code: [Select]
for camera in ch_flir.cameras:
Best regards,
Alexey Pasumansky,
Agisoft LLC