Forum

Author Topic: cam.project, cam.calibration.project and cam.sensor.calibration.project  (Read 1144 times)

pts_and_clouds

  • Newbie
  • *
  • Posts: 10
    • View Profile
Are these three commands supposed to produce the same output, i.e. the 2D projection of a 3D point on an image?

I am getting the same output for cam.calibration.project and cam.sensor.calibration.project, but cam.sensor returns empty for the same exact point.

In [25]: cam.project(temp_b[0])

In [26]: cam.calibration.project(temp_b[0])
Out[26]: 2022-11-30 12:53:57 Vector([226.91737982171833, 3066.876461424863])

In [27]: cam.sensor.calibration.project(temp_b[0])
Out[27]: 2022-11-30 12:54:04 Vector([226.91737982171833, 3066.876461424863])

Thanks in advance for your help.

pts_and_clouds

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: cam.project, cam.calibration.project and cam.sensor.calibration.project
« Reply #1 on: November 30, 2022, 10:34:57 AM »
cam.project seems to be the recommended way now (see the last response from Alexey in the thread below), but doesn't seem to work here for some reason.

https://www.agisoft.com/forum/index.php?topic=12781.0

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14927
    • View Profile
Re: cam.project, cam.calibration.project and cam.sensor.calibration.project
« Reply #2 on: November 30, 2022, 05:05:18 PM »
Hello!

What is stored in temp_b[0]?

If you are trying to apply project method to the vector in the chunk's internal coordinate system, then there are two approaches, that should result in the same output for general case:
Code: [Select]
camera.project(vector)and
Code: [Select]
camera.sensor.calibration.project(camera.transform.inv().mulp(vector))Probably you have already applied inverted camera.transform matrix to the required vector, therefore it cannot be used with the first approach, although, camera.project is recommended compared to calibration.project approach.
Best regards,
Alexey Pasumansky,
Agisoft LLC

pts_and_clouds

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: cam.project, cam.calibration.project and cam.sensor.calibration.project
« Reply #3 on: December 01, 2022, 09:36:24 AM »
Alexey,

Thanks for the quick response and you hit the nail on the head, I had already converted into the internal coordinate system before passing it on cam.project, which was the problem.

I have a related question.  I am writing a script to understand the projections of my dense cloud points on all images.  I see two possibilities when I use cam.project on a 3D dense cloud point: a) the projection either lies within the image, in which case it is a legitimate projection or  b) it lies outside, in which case it is not a real projection and can be disregarded.

But, I see that sometimes there is a third outcome: cam.project returns nothing.  Is this expected behavior for this method?  When does this happen? 

pts_and_clouds

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: cam.project, cam.calibration.project and cam.sensor.calibration.project
« Reply #4 on: December 01, 2022, 10:18:35 AM »
I am guessing that this null outcome is when the 3d point happens to be BEHIND and not in front of the camera?