Forum

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - jungeun

Pages: [1]
1
Camera Calibration / Re: Lens Calibration : How to improve estimation?
« on: February 02, 2023, 05:01:43 AM »
Thank you tazzo! I totally agree with you.

However, the blur is caused by Focus and I'm not sure could I change it during only calibration.

As a rule of tumb, [Metashape LensCalibration] works well only if the chessboard occupies the entire image and my monitor is quite small.
So I put the camera quite close from the monitor, and calibration image becomes blurry since the camera was set based on shooting distance object.

Do you think change Focus option for calibration is OK?
What can I do? I have no idea..

Thank you so much for your help.

2
Camera Calibration / Lens Calibration : How to improve estimation?
« on: January 26, 2023, 12:54:41 PM »
Dear.

I am using lens calibration for more accurate calibration than marker-based camera calibration.
I followed the tutorial below.
https://agisoft.freshdesk.com/support/solutions/articles/31000160059-lens-calibration-using-chessboard-pattern-in-metashape

Unfortunately, the reprojection error looks pretty big as shown in the attached picture, and I have no idea to how to improve this.

Here are my settings I used for :
- Camera used: Sony Corporation DSC-RX0M2
- Optimize f, Cx, Cy, K1~K3, P1, P2 with 100 images
- Since the monitor is quite small, the camera is placed 30 to 50 cm away from the monitor.
- To obtain 100 images, take a VIDEO first and get the frame with opencv. (exif information is lost)

So, I have two questions.

1. Is there any way to make better reprojection error?

2. I don't know if Lens Calibration is really better than marker-based camera calibration (which seems to uses exif data).
    Can the reprojection error be checked using the parameters obtained from marker-based camera calibration?
    How do I check which one is better?

You will be of great help. Thank you so much.
I spend so many time to here. Please help me  :'( :'( :'(

3
Camera Calibration / Re: Metashape : Calibrate Lens Problem
« on: August 03, 2022, 08:51:25 AM »
Dear Alexey,

I found the reason why my second calibration test ( 4 images, each containing one checkerboard ) failed.

In that test, 4 images were just cropped from 'first big image that I attached (imgA)'
Due to my mistake in the process, the size of 4 images set was different, so program recognize them to 4 different cameras' pictures.
after matching the size, calibration works.

But this case is not proper calibration for my camera because they are cropped images from 'imgA'
So I tried copy 'imgA'  4 times, and just remove(fill the area with gray color) other checker boards except one for each copied image, to make sure one image contains one checkerboard.
But it also failed, I guess it's because the checkerboard is too small for the image.

Is there any way to use calibration with imgA? or is it the only way that making checker board take a maximum area of each photo?

Thank you very much!

4
Camera Calibration / Metashape : Calibrate Lens Problem
« on: August 01, 2022, 11:13:48 AM »
Hi.

First, I made a calibration rocket to get a calibration result. In the rocket, there're lots of metashape markers and checkerboards. (You can see this rocket from first image. )
Thanks to the metashape marker, I could get Intrinsic and Extrinsic camera data from 9 view images.   
But I wanted to get more accurate Intrinsic data first, so tried to do [Metashape>Tools>Lens>Calibrate Lens..]. 
But it failed to find Checker board, and I have no idea why this happen... maybe the checker board size in image problem.
I attach my input and output(result) images.  (input image's resolution is reduced to attach)

Second, i attach another result that I tried.
I made a image which has 1 checker board for 1 image, and do  [Metashape>Tools>Lens>Calibrate Lens..] again.
In this case, meta shape find checker board but failed to get calibration data. (gray dots)
This works the same if I run it with 4 images  or increase the brightness with long exposure time.

I think I missed some options for Lens Calibration, because Opencv module can get calibration from those images,

Could you let me know why this is happening?
Thank you very much.

This is URL that I referenced.
https://agisoft.freshdesk.com/support/solutions/articles/31000160059-lens-calibration-using-chessboard-pattern-in-metashape#Load-Photos

5
It perfectly works after I change chunk matrix to [s*R | T] instead [R|T] .
I would never have thought of multiplying s to only R. Really appreciate it.

In the case of the dimension of the array, it was processed separately although it was omitted in the article.  ;)
Thank you very much!!!!!!!!  ;D

6
Hi , I have trouble projecting 3D points in to an raw image with xml format file .
First image's projection looks perfect, but other image's projection looks weird.

To make extrinsic and intrinsic matrix from xml file, I got help from this post "https://www.agisoft.com/forum/index.php?topic=12992.0"
difference with that post is I used component (maybe chunk) transformation too for get extrinsic matrix.

here's my result url. plt figure's range is just normalized to ([0,4000], [0,6000] -> [-1,1] , [-1,1])


https://docs.google.com/presentation/d/19i0ro8IG82ylNYUXxwDFh8J8Or3pAKzMbiPoO4iDtws/edit?usp=sharing


I think this happened because way that i used to make extrinsic  matrix (specifically translation part) is wrong, because after I apply extrinsic matrix from obj file (obj file that meta shape made), it translated from center xy in 3d space too, as you can see from the url.

but now I have no idea to fix extrinsic matrix.
Any help would be very very very appreciated. I used too much time for here. :'(
Thanks for your time !!!

* Here's my way to do projection.

Code: [Select]

 ext_transform = np.matmul(chunk_transform,camera_transform)
 Extrinsic =  np.linalg.inv(ext_transform)
 projection_mat = np.matmul(Intrinsic,Extrinsic)

 with this matrix, do opencv projection



chunk_transform is <component>< transform>'s  [rot | trans]  in XML file.
camera_transform is <camera>< transform>'s  in XML file.
Intrinsic is <sensor> <f>, <cx>, <cy> value in XML file.

here's my xml file and matrix for sure.

Code: [Select]

<components next_id="1" active_id="0">
<component id="0" label="Component 1">
<transform>
<rotation locked="true">-4.0000842670820230e-01 -1.5734843503078316e-01 9.0290349902732769e-01 1.9110407888160198e-02 -9.8637019650377589e-01 -1.6342774476645819e-01 9.1631220163914506e-01 -4.8117620914441349e-02 3.9756338322933804e-01</rotation>
<translation locked="true">3.2904539920717615e+00 -1.8702646000885890e+00 1.2696371691852406e+00</translation>
<scale locked="true">1.2753279589141573e+00</scale>
</transform>
<region>
<center>1.1102797740173276e-01 -1.8681378707747584e-01 -2.8371484315618511e+00</center>
<size>2.3905810713768005e+00 5.7288969755172747e-01 9.4771908521652215e-01</size>
<R>-6.8483242464340593e-02 9.5930334543824825e-01 2.7394732510567710e-01 -3.9456557709561146e-01 -2.7824770616937589e-01 8.7572610979842780e-01 9.1631220163914517e-01 -4.8117620914441078e-02 3.9756338322933699e-01</R>
</region>
<partition>
<camera_ids>0 1 2 3 4 5 6 7 8 9 10 11 12 13</camera_ids>
</partition>
</component>
</components>


<camera id="0" sensor_id="0" component_id="0" label="SSP_L17_1st_">
<transform>9.9989019305885085e-01 3.1326853264383977e-03 1.4484063911040377e-02 5.3838085029389166e-03 2.5733478592101107e-03 -9.9925620803875881e-01 3.8476077980954093e-02 -2.5820096998954243e-02 1.4593824225647072e-02 -3.8434580505665616e-02 -9.9915454426020855e-01 -4.1891819883547572e-02 0 0 0 1</transform>
<rotation_covariance>3.3690760850214915e-05 -2.8655228346104676e-06 2.0765386794765720e-05 -2.8655228346104680e-06 2.0896033454963796e-05 -8.7250725461524285e-06 2.0765386794765720e-05 -8.7250725461524302e-06 8.5295693752518732e-05</rotation_covariance>
<location_covariance>3.0046979288328115e-04 -7.9965393331102712e-05 3.2699651445831571e-05 -7.9965393331102712e-05 2.4640075563414816e-04 -3.3035204858024964e-05 3.2699651445831571e-05 -3.3035204858024964e-05 1.7833428418572984e-04</location_covariance>
<orientation>2</orientation>
</camera>

<camera id="1" sensor_id="1" component_id="0" label="SSP_L17_2nd_2">
<transform>3.2315182958907984e-01 -9.0921069075667355e-02 9.4196934888103856e-01 -2.6283049499955293e+00 -1.4862270882993905e-01 -9.8789816958817889e-01 -4.4367746667785007e-02 1.5221309812608544e-01 9.3460375852726019e-01 -1.2566051775503462e-01 -3.3275403652586294e-01 -1.7708344352327172e+00 0 0 0 1</transform>
<rotation_covariance>6.9188346207251671e-05 3.8657336742568942e-06 -3.3461144497649100e-05 3.8657336742568933e-06 2.0050704462952276e-05 -3.6855288024366330e-06 -3.3461144497649100e-05 -3.6855288024366334e-06 5.0405859802254651e-05</rotation_covariance>
<location_covariance>3.0712499188493430e-04 2.0662592833772486e-04 7.3567010783359092e-05 2.0662592833772486e-04 5.5535682375073474e-04 1.2483174959582446e-04 7.3567010783359092e-05 1.2483174959582446e-04 2.4186295188170692e-04</location_covariance>
<orientation>2</orientation>
</camera>


<sensor id="0" label="Canon EOS 200D II, EF-S18-55mm f/4-5.6 IS STM (24mm)" type="frame">
<resolution width="4000" height="6000"/>
<property name="pixel_width" value="0.0037211000000000002"/>
<property name="pixel_height" value="0.0037211000000000002"/>
<property name="focal_length" value="24"/>
<property name="layer_index" value="0"/>
<bands>
<band label="Red"/>
<band label="Green"/>
<band label="Blue"/>
</bands>
<data_type>uint8</data_type>
<calibration type="frame" class="adjusted">
<resolution width="4000" height="6000"/>
<f>6268.7417135633541</f>
<cx>-42.121378778566942</cx>
<cy>-136.38016191503107</cy>
<k1>-0.096948574201960791</k1>
<k2>0.32612459814959294</k2>
<k3>-0.47617087512721168</k3>
<p1>-0.0016501137249175922</p1>
<p2>-0.0013166070712920016</p2>
</calibration>
<covariance>
<params>f cx cy k1 k2 k3 p1 p2</params>
<coeffs>6.2266898591838116e+00 -1.1817357726592841e+00 -6.7850811513866622e+00 -5.4245864935081574e-03 3.6333477912751252e-02 -6.9388876100023159e-02 -4.6672961693054885e-05 -5.7791029801410488e-05 -1.1817357726592841e+00 1.2623904582211022e+01 6.6555547251095845e-02 9.6480593388115058e-04 -9.9126278634053041e-03 2.4241385273150551e-02 5.8730529886652451e-04 5.6777308739382633e-05 -6.7850811513866622e+00 6.6555547251095845e-02 3.7214137821871702e+01 2.6138982769990197e-05 2.4140826928457713e-03 -8.0175831609379106e-03 2.5761918039468267e-05 5.3870553043905596e-04 -5.4245864935081574e-03 9.6480593388115058e-04 2.6138982769990197e-05 1.3515156156380134e-05 -9.0694676681857923e-05 1.8480680746547185e-04 1.6479371500237986e-08 -1.2786405193345189e-08 3.6333477912751252e-02 -9.9126278634053041e-03 2.4140826928457713e-03 -9.0694676681857923e-05 6.4497209503383188e-04 -1.3645025984899901e-03 -2.4697906723543059e-07 1.3037508646489241e-07 -6.9388876100023159e-02 2.4241385273150551e-02 -8.0175831609379106e-03 1.8480680746547185e-04 -1.3645025984899901e-03 2.9884771129337082e-03 5.5494375728770076e-07 -3.5250720940152735e-07 -4.6672961693054885e-05 5.8730529886652451e-04 2.5761918039468267e-05 1.6479371500237986e-08 -2.4697906723543059e-07 5.5494375728770076e-07 3.1687646647244701e-08 1.4357625948766003e-09 -5.7791029801410488e-05 5.6777308739382633e-05 5.3870553043905596e-04 -1.2786405193345189e-08 1.3037508646489241e-07 -3.5250720940152735e-07 1.4357625948766003e-09 3.1852916864167610e-08</coeffs>
</covariance>
</sensor>

<sensor id="1" label="Canon EOS 200D II, EF-S18-55mm f/4-5.6 IS STM (25mm)" type="frame">
<resolution width="4000" height="6000"/>
<property name="pixel_width" value="0.0037211000000000002"/>
<property name="pixel_height" value="0.0037211000000000002"/>
<property name="focal_length" value="25"/>
<property name="layer_index" value="0"/>
<bands>
<band label="Red"/>
<band label="Green"/>
<band label="Blue"/>
</bands>
<data_type>uint8</data_type>
<calibration type="frame" class="adjusted">
<resolution width="4000" height="6000"/>
<f>6736.4734574874947</f>
<cx>-47.408453741129755</cx>
<cy>-159.8371889525549</cy>
<k1>-0.10092234606082934</k1>
<k2>0.44971968975065907</k2>
<k3>-0.56200764088241306</k3>
<p1>-0.0019806263234060204</p1>
<p2>-0.00012688410818793622</p2>
</calibration>
<covariance>
<params>f cx cy k1 k2 k3 p1 p2</params>
<coeffs>5.4956621533466237e+00 -6.0038039568943236e-01 -6.5544840324940603e+00 -4.3031618281647345e-03 3.2245294427993405e-02 -6.5399303962367927e-02 -2.9948025414546900e-05 -9.2822328790459729e-05 -6.0038039568943236e-01 1.1688816590997790e+01 -7.4820546554811573e-01 9.2918626142461354e-04 -7.3752261208181206e-03 1.3712045369149686e-02 5.7392942778724317e-04 -9.8327211602412058e-06 -6.5544840324940603e+00 -7.4820546554811573e-01 4.3617799922841485e+01 -1.8409220364205559e-03 2.1705650370708315e-02 -5.2182603024796409e-02 -3.0348125806527517e-05 6.3564045538338034e-04 -4.3031618281647345e-03 9.2918626142461354e-04 -1.8409220364205559e-03 1.4202361019538604e-05 -1.1064952256554250e-04 2.6627173737172130e-04 4.1306591286570337e-08 -3.1831830072314878e-08 3.2245294427993405e-02 -7.3752261208181206e-03 2.1705650370708315e-02 -1.1064952256554250e-04 9.2198360214500944e-04 -2.3126132536480113e-03 -3.4261105953989335e-07 3.7828580014534883e-07 -6.5399303962367927e-02 1.3712045369149686e-02 -5.2182603024796409e-02 2.6627173737172130e-04 -2.3126132536480113e-03 6.0581666948223692e-03 6.6263904122748835e-07 -9.6030861828633363e-07 -2.9948025414546900e-05 5.7392942778724317e-04 -3.0348125806527517e-05 4.1306591286570337e-08 -3.4261105953989335e-07 6.6263904122748835e-07 3.1086531077208177e-08 -1.1551649144677374e-09 -9.2822328790459729e-05 -9.8327211602412058e-06 6.3564045538338034e-04 -3.1831830072314878e-08 3.7828580014534883e-07 -9.6030861828633363e-07 -1.1551649144677374e-09 3.5706106706884163e-08</coeffs>
</covariance>
</sensor>

for detail and confirm, I attach matrix i made with that xml file

1. First Image's matrix
Code: [Select]
chunk_transform = np.matrix([[-4.0000842670820230e-01, -1.5734843503078316e-01 , 9.0290349902732769e-01, 3.2904539920717615e+00] ,
                   [1.9110407888160198e-02, -9.8637019650377589e-01, -1.6342774476645819e-01, -1.8702646000885890e+00] ,
                   [9.1631220163914506e-01 ,-4.8117620914441349e-02, 3.9756338322933804e-01, 1.2696371691852406e+00],
                   [0,0,0,1]])

Intrinsic = np.matrix([[6312.3568293358312, 0, 2000+105.50729729807456], [0, 6312.3568293358312, 3000-183.65292103661881], [0, 0, 1]])
Extrinsic = np.matrix([[ 9.9989019305885085e-01, 3.1326853264383977e-03, 1.4484063911040377e-02, 5.3838085029389166e-03 ],
                       [ 2.5733478592101107e-03, -9.9925620803875881e-01, 3.8476077980954093e-02, -2.5820096998954243e-02 ],
                       [ 1.4593824225647072e-02, -3.8434580505665616e-02, -9.9915454426020855e-01, -4.1891819883547572e-02 ],
                       [ 0,0,0,1 ]])



2. second Image's matrix
Code: [Select]
chunk_transform = np.matrix([[-4.0000842670820230e-01, -1.5734843503078316e-01 , 9.0290349902732769e-01, 3.2904539920717615e+00] ,
                   [1.9110407888160198e-02, -9.8637019650377589e-01, -1.6342774476645819e-01, -1.8702646000885890e+00] ,
                   [9.1631220163914506e-01 ,-4.8117620914441349e-02, 3.9756338322933804e-01, 1.2696371691852406e+00],
                   [0,0,0,1]])

Intrinsic = np.matrix([[6733.6864664607137, 0, 2000+111.00756885316275], [0, 6733.6864664607137, 3000-228.02990467572579], [0, 0, 1]])
Extrinsic = np.matrix([[3.2315182958907984e-01 ,-9.0921069075667355e-02 ,9.4196934888103856e-01, -2.6283049499955293e+00 ],
                       [-1.4862270882993905e-01 ,-9.8789816958817889e-01 ,-4.4367746667785007e-02 ,1.5221309812608544e-01 ],
                       [9.3460375852726019e-01 ,-1.2566051775503462e-01 ,-3.3275403652586294e-01 ,-1.7708344352327172e+00 ],
                       [0, 0, 0, 1]])


Thank you for your time again.


Pages: [1]