@@ -484,18 +484,22 @@ def orient(
484484 # contained both in the spatial intersection and the resection
485485 # see [1], eq. 23
486486
487- beta , residuals , rank , singular_values = np .linalg .lstsq (
488- Xh [:, :numbers ], yh , rcond = None
487+ # beta, residuals, rank, singular_values = np.linalg.lstsq(
488+ # Xh[:, :numbers], yh, rcond=None
489+ # )
490+
491+ beta , residuals , rank , singular_values = scipy .linalg .lstsq (
492+ Xh [:, :numbers ], yh , lapack_driver = 'gelsy'
489493 )
490494
491495 # Interpret the results
492- # print(
493- # f"Coefficients (beta): {beta} \n \
494- # Residuals: {residuals} \n \
495- # singular_values: {singular_values} \n \
496- # rank: {rank} \n \
497- # "
498- # )
496+ print (
497+ f"Coefficients (beta): { beta } \n \
498+ Residuals: { residuals } \n \
499+ singular_values: { singular_values } \n \
500+ rank: { rank } \n \
501+ "
502+ )
499503
500504 # stopflag
501505 stopflag = True
@@ -585,8 +589,14 @@ def raw_orient(
585589 pix : List [Target ],
586590) -> bool :
587591 """Calculate orientation of the camera, updating its calibration."""
588- X = np .zeros ((10 , 6 ))
589- y = np .zeros (10 )
592+ # the original C file says nfix is typically 4, but why X is 10 x 6 and not 8?
593+
594+ # X = np.zeros((10, 6))
595+ # y = np.zeros(10)
596+
597+ X = np .zeros ((nfix * 2 , 6 ))
598+ y = np .zeros (nfix * 2 )
599+
590600 # XPX = np.zeros((6, 6))
591601 # XPy = np.zeros(6)
592602 beta = np .zeros (6 )
@@ -633,10 +643,10 @@ def raw_orient(
633643 ) # , rcond=None)
634644
635645 # Interpret the results
636- print ("Coefficients (beta):" , beta )
637- print ("Residuals:" , residuals )
638- print ("rank:" , rank )
639- print ("singular_values:" , singular_values )
646+ # print("Coefficients (beta):", beta)
647+ # print("Residuals:", residuals)
648+ # print("rank:", rank)
649+ # print("singular_values:", singular_values)
640650
641651 stopflag = True
642652 for i in range (6 ):
@@ -824,6 +834,7 @@ def full_calibration(
824834
825835 if residuals is None :
826836 # free(residuals)
837+ print (f"Residuals = { residuals } " )
827838 raise ValueError ("Orientation iteration failed, need better setup." )
828839
829840 ret = np .empty ((len (img_pts ), 2 ))
0 commit comments