Thursday, January 30, 2020

matlab - How does resizing an image affect the intrinsic camera matrix?


I have a camera matrix (I know both intrinsic and extrinsic parameters) known for image of size HxW. (I use this matrix for some calculations I need).


I want to use a smaller image, say: H2×W2 (half the original). What changes do I need to make to the matrix, in order to keep the same relation ?



I have, K as the intrinsic parameters, (R,T rotation and translation)


cam=K[RT]


K=(ax0u00ayv0001)


K is 3*3, I thought on multiplying ax, ay, u0, and v0 by 0.5 (the factor the image was resized) , but I'm not sure.



Answer



Note: That depends on what coordinates you use in the resized image. I am assuming that you are using zero-based system (like C, unlike Matlab) and 0 is transformed to 0. Also, I am assuming that you have no skew between coordinates. If you do have a skew, it should be multiplied as well


Short answer: Assuming that you are using a coordinate system in which u=u2,v=v2, yes, you should multiply ax,ay,u0,v0 by 0.5.


Detailed answer The function that converts a point P in world coordinates to camera coordinates (x,y,z,1)>(u,v,S) is:


(ax0u00ayv0001)(R11R12R13TxR21R22R23TyR31R32R33Tz0001)(xyz1)


Where (u,v,S)>(u/S,v/S,1), since the coordinates are homogenous.



In short this can be written as u=m1Pm3P,v=m2Pm3P
where M is the product of the two matrixes mentioned above, and mi is the i'th row of the matrix M. (The product is scalar product).


Re-sizing the image can be thought of:


u=u/2,v=v/2


Thus


u=(1/2)M1PM3Pv=(1/2)M2PM3P


Converting back to matrix form gives us:


(0.50000.50001)(ax0u00ayv0001)(R11R12R13TxR21R22R23TyR31R32R33Tz0001)(xyz1)


Which is equal to


(0.5ax00.5u000.5ay0.5v0001)(R11R12R13TxR21R22R23TyR31R32R33Tz0001)(xyz1)



For additional information, refer to Forsyth, chapter 3 - Geometric camera calibration.


No comments:

Post a Comment

digital communications - Understanding the Matched Filter

I have a question about matched filtering. Does the matched filter maximise the SNR at the moment of decision only? As far as I understand, ...