public void setTransformFromLinesSquare ( QrCode qr ) { // clear old points storagePairs2D . reset ( ) ; storagePairs3D . reset ( ) ; // use 3 of the corners to set the coordinate system // set(0, 0, qr.ppCorner,0); <-- prone to damage. Significantly degrades results if used set ( 0 , 7 , qr . ppCorner , 1 ) ; set ( 7 , 7 , qr . ppCorner , 2 ) ; set ( 7 , 0 , qr . ppCorner , 3 ) ; // Use 4 lines to make it more robust errors in these corners // We just need to get the direction right for the lines. the exact grid to image doesn't matter setLine ( 0 , 7 , 0 , 14 , qr . ppCorner , 1 , qr . ppRight , 0 ) ; setLine ( 7 , 7 , 7 , 14 , qr . ppCorner , 2 , qr . ppRight , 3 ) ; setLine ( 7 , 7 , 14 , 7 , qr . ppCorner , 2 , qr . ppDown , 1 ) ; setLine ( 7 , 0 , 14 , 0 , qr . ppCorner , 3 , qr . ppDown , 0 ) ; DMatrixRMaj HH = new DMatrixRMaj ( 3 , 3 ) ; dlt . process ( storagePairs2D . toList ( ) , storagePairs3D . toList ( ) , null , HH ) ; H . set ( HH ) ; H . invert ( Hinv ) ; ConvertFloatType . convert ( Hinv , Hinv32 ) ; ConvertFloatType . convert ( H , H32 ) ; }
Used to estimate the image to grid coordinate system before the version is known . The top left square is used to fix the coordinate system . Then 4 lines between corners going to other QR codes is used to make it less suspectable to errors in the first 4 corners