Forum

Author Topic: How to set camera calibration to created chunk?  (Read 11658 times)

Vadim3D

  • Newbie
  • *
  • Posts: 12
    • View Profile
How to set camera calibration to created chunk?
« on: March 06, 2018, 06:12:09 PM »
Hi ,

I would like to create new chunk, then load photos and then set a fixed calibration for each of the loaded photos.
1. How to do that?
2. Can you please explain me what have after i do - doc.addChunk() -> chunk.addPhotos(file_paths) ?


So i used:
#  ------------ load the calibration
calib = PhotoScan.Calibration()
calib.load(Calib2Use,format="xml")

#  ------------ load the calibration

Vadim3D

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: How to set camera calibration to created chunk?
« Reply #1 on: March 06, 2018, 06:13:52 PM »
Sorry, i unintentionally sent unfinished message.

 Hi ,

I would like to create new chunk, then load photos and then set a fixed calibration for each of the loaded photos.
1. How to do that?
2. Can you please explain me what have after i do - doc.addChunk() -> chunk.addPhotos(file_paths) ?
 

So i used:
#  ------------ load the calibration
calib = PhotoScan.Calibration()
calib.load(Calib2Use,format="xml")

#  ------------ load the calibration

Vadim3D

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: How to set camera calibration to created chunk?
« Reply #2 on: March 06, 2018, 06:22:39 PM »
Sorry, i unintentionally sent unfinished message.

 Hi ,

I would like to create new chunk, then load photos and then set a fixed calibration for each of the loaded photos.
1. How to do that?
2. Can you please explain me what have after i do - doc.addChunk() -> chunk.addPhotos(file_paths) ? do i have one group of many cameras?
 

So i used:
#  ------------ load the calibration
calib = PhotoScan.Calibration()
calib.load(Calib2Use,format="xml")

#  ------------creat new chunk
doc = PhotoScan.app.document
chunk = doc.addChunk()
chunk.addPhotos(file_paths)# add photos to chunk
sensor = chunk.addSensor() #

sensor.fixed = True
sensor.calibration = calib

sensor.width = chunk.cameras[0].photo.image().width
sensor.height = chunk.cameras[0].photo.image().height
for cam in chunk.cameras:
    cam.sensor = sensor

Now, i don't know how to update this calibration.
What else i need to do to set a fixed calibration for all the cameras?

Many Thanks,
Sorry for the 2 unfinished massages above,
Vadim



Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15420
    • View Profile
Re: How to set camera calibration to created chunk?
« Reply #3 on: March 06, 2018, 10:01:05 PM »
Hello Vadim,

I suggest to assign sensor width and height before loading the calibration. Also note that in order to load the calibration values to the Initial tab you need to use sensor.user_calib = calib assignment.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Vadim3D

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: How to set camera calibration to created chunk?
« Reply #4 on: March 07, 2018, 12:46:21 PM »
Thanks Alexey,
Now it is working.
i have three more questions:
1. what happens when i do
> sensor.user_calib = calib
and then
> sensor.fixed = True
Does alignment process initialized by this calibration, and then can optimize that? or it is fixed and will not changed during the process?
What is your recommendation about this (to use fixed or something else?), considering that the calibration i did with Lens software?

2.  how to set "Frame" or "Fisheye" type to the sensor?

3. Is there a way to get some feedback from agisoft if my calibration is good enough? for example visual feedback as render the images back from the point cloud using this calibration and estimated extrinsic parameters of the cameras.

Many Thanks,
Vadim

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15420
    • View Profile
Re: How to set camera calibration to created chunk?
« Reply #5 on: March 07, 2018, 12:50:34 PM »
Hello Vadim,

Setting user_calib and fixing the calibration means that during the consecutive alignment (or optimization) procedure PhotoScan will use the imported calibration values and wouldn't reine them.

To change the sensor type use:
Code: [Select]
sensor.type = PhotoScan.Sensor.Type.Fisheye
You can look at residuals graph to see the reprojection errors of the tie points averaged across the images in the chunk to get some general idea on the quality of the alignment.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Vadim3D

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: How to set camera calibration to created chunk?
« Reply #6 on: March 07, 2018, 01:50:15 PM »
Thanks,

when i use
> sensor.type = PhotoScan.Sensor.Type.Fisheye

it gives me an Error

'str' object has no attribute 'Type'

What i need to do in advance in order to use
> sensor.type = PhotoScan.Sensor.Type.Fisheye

I not sure if i understood your note about the  "residuals graph to see the reprojection errors" i attached a figure that described what i did.
Is that what you meant?


Thank you very much,
Vadim

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15420
    • View Profile
Re: How to set camera calibration to created chunk?
« Reply #7 on: March 07, 2018, 02:08:57 PM »
Hello Vadim,

I assume that you have accidentally used some kind of assignment to PhotoScan.Sensor, thus invalidating the access to this class, something like PhotoScan.Sensor = "sensor".

As for the graph - yes, I have meant it. The current picture is indicating that there are severe problems. Usually the scale of the error vectors is about 1 pixel, whereas on picture it is at least 10-20 pixels, also the pattern usually should be non-uniform.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Vadim3D

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: How to set camera calibration to created chunk?
« Reply #8 on: March 07, 2018, 04:34:39 PM »
Thanks Alexey,
You were right, I accidentally made an assignment to PhotoScan.Sensor.
Now, the command
> sensor.type = PhotoScan.Sensor.Type.Fisheye
is working.

About the  "residuals graph to see the reprojection errors", I attached a new figure that shows more reasonable projection errors.
Please tell me if you have any notes about the new projection errors.

Many thanks,
Vadim

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15420
    • View Profile
Re: How to set camera calibration to created chunk?
« Reply #9 on: March 28, 2018, 01:28:42 PM »
Hello Vadim,

If the length of the averaged residual vectors on the picture is small (according to the scale bar in the bottom) and there's no systematic error observed, then the calibration results may be considered good. On contrary, when there's some systematic error pattern of the errors are high, it usually menas that the alignment can be improved.
Best regards,
Alexey Pasumansky,
Agisoft LLC

geodet1994

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: How to set camera calibration to created chunk?
« Reply #10 on: September 25, 2021, 09:43:39 PM »
i have the same problem. I would like to enable a fisheye lens in the attached script.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15420
    • View Profile
Re: How to set camera calibration to created chunk?
« Reply #11 on: September 27, 2021, 04:33:29 PM »
Hello geodet1994,

Please check the answer in the related thread:
https://www.agisoft.com/forum/index.php?topic=3363.msg60792#msg60792
Best regards,
Alexey Pasumansky,
Agisoft LLC