Forum

Author Topic: Set the height in camera.reference.location  (Read 8055 times)

doctorben

  • Newbie
  • *
  • Posts: 9
    • View Profile
Set the height in camera.reference.location
« on: April 22, 2016, 03:24:44 PM »
Hello there, i have a question,

how can i set/ replace only the height (Z) value in camera.reference.location?

Thanks.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15650
    • View Profile
Re: Set the height in camera.reference.location
« Reply #1 on: April 24, 2016, 07:09:37 PM »
Hello doctorben,

I suggest the following:
Code: [Select]
z = 1000
camera.reference.location = PhotoScan.Vector([camera.reference.location.x, camera.reference.location.y, z])
Best regards,
Alexey Pasumansky,
Agisoft LLC

Yoann Courtois

  • Sr. Member
  • ****
  • Posts: 316
  • Engineer in Geodesy, Cartography and Surveying
    • View Profile
Re: Set the height in camera.reference.location
« Reply #2 on: September 24, 2019, 10:17:32 AM »
Hi Alexey,

It looks that since PhotoScan became Metashape, camera.reference.location is read-only !
Indeed, I was not able to set camera location using scripting (I mean without any extern file), but only with file import.

Regards
--
Yoann COURTOIS
R&D Engineer in photogrammetric process and mobile application
Lyon, FRANCE
--

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15650
    • View Profile
Re: Set the height in camera.reference.location
« Reply #3 on: September 24, 2019, 09:48:45 PM »
Hello Yoann,

Can you please provide the code sample that I can use to reproduce the problem?

I've tried the following on some random project and got proper assignment:
Code: [Select]
chunk = Metashape.app.document.chunk
camera = chunk.cameras[0]
camera.reference.location = Metashape.Vector([1, 2, 3])

If you are to keep some of the original source reference values, make sure that camera.reference.location exists (in not None).
Best regards,
Alexey Pasumansky,
Agisoft LLC

Yoann Courtois

  • Sr. Member
  • ****
  • Posts: 316
  • Engineer in Geodesy, Cartography and Surveying
    • View Profile
Re: Set the height in camera.reference.location
« Reply #4 on: October 01, 2019, 05:20:27 PM »
Hi Alexey,

Thanks for your reply.
I have tried almost same code before. When I try your code sample I got an error (image 1)

I guess the most crazy thing is that I got different results from camera.reference.location and from reference panel (image 2)

Regards
--
Yoann COURTOIS
R&D Engineer in photogrammetric process and mobile application
Lyon, FRANCE
--

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15650
    • View Profile
Re: Set the height in camera.reference.location
« Reply #5 on: October 01, 2019, 05:55:11 PM »
Hello Yoann,

Is the problem reproducible, when you open new Metashape Pro instance, add the image via GUI and execute this three-lines code again?

I would rather think that some class or method definitions have been corrupted by accidental improper usage.
Best regards,
Alexey Pasumansky,
Agisoft LLC