Update Python packages and pre-commit hooks (#30597)
	
		
	
				
					
				
			* Update Python packages and pre-commit hooks
* fix
---------
Co-authored-by: jnewb1 <jnewb1@users.noreply.github.com>
old-commit-hash: 46f3fdc090
			
			
				vw-mqb-aeb
			
			
		
							parent
							
								
									25374edffd
								
							
						
					
					
						commit
						8d11c3b742
					
				
				 5 changed files with 14 additions and 87 deletions
			
			
		@ -1,3 +1,3 @@ | 
				
			|||||||
version https://git-lfs.github.com/spec/v1 | 
					version https://git-lfs.github.com/spec/v1 | 
				
			||||||
oid sha256:8c95820a1a166a8c4900ff62f1d214cff411347d24ba395bf2c7ee867d487c60 | 
					oid sha256:74a676b10b857577e8437ad907b3e8ca2e71a867f6a67b2d6cf5d916ff61aca7 | 
				
			||||||
size 433995 | 
					size 432403 | 
				
			||||||
 | 
				
			|||||||
@ -1,35 +0,0 @@ | 
				
			|||||||
#!/usr/bin/env python | 
					 | 
				
			||||||
import numpy as np | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# copied from openpilot.common.transformations/camera.py | 
					 | 
				
			||||||
eon_dcam_focal_length = 860.0  # pixels | 
					 | 
				
			||||||
webcam_focal_length = 908.0  # pixels | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
eon_dcam_intrinsics = np.array([ | 
					 | 
				
			||||||
  [eon_dcam_focal_length,   0,   1152/2.], | 
					 | 
				
			||||||
  [  0,  eon_dcam_focal_length,  864/2.], | 
					 | 
				
			||||||
  [  0,    0,     1]]) | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
webcam_intrinsics = np.array([ | 
					 | 
				
			||||||
  [webcam_focal_length,   0.,   1280/2.], | 
					 | 
				
			||||||
  [  0.,  webcam_focal_length,  720/2.], | 
					 | 
				
			||||||
  [  0.,    0.,     1.]]) | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
cam_id = 2 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if __name__ == "__main__": | 
					 | 
				
			||||||
  import cv2 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  trans_webcam_to_eon_front = np.dot(eon_dcam_intrinsics, np.linalg.inv(webcam_intrinsics)) | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  cap = cv2.VideoCapture(cam_id) | 
					 | 
				
			||||||
  cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1280) | 
					 | 
				
			||||||
  cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 720) | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  while (True): | 
					 | 
				
			||||||
    ret, img = cap.read() | 
					 | 
				
			||||||
    if ret: | 
					 | 
				
			||||||
      img = cv2.warpPerspective(img, trans_webcam_to_eon_front, (1152, 864), borderMode=cv2.BORDER_CONSTANT, borderValue=0) | 
					 | 
				
			||||||
      img = img[:, -864//2:, :] | 
					 | 
				
			||||||
      cv2.imshow('preview', img) | 
					 | 
				
			||||||
      cv2.waitKey(10) | 
					 | 
				
			||||||
@ -1,43 +0,0 @@ | 
				
			|||||||
#!/usr/bin/env python | 
					 | 
				
			||||||
import numpy as np | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# copied from openpilot.common.transformations/camera.py | 
					 | 
				
			||||||
eon_focal_length = 910.0  # pixels | 
					 | 
				
			||||||
eon_dcam_focal_length = 860.0  # pixels | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
webcam_focal_length = -908.0/1.5  # pixels | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
eon_intrinsics = np.array([ | 
					 | 
				
			||||||
  [eon_focal_length,   0.,   1164/2.], | 
					 | 
				
			||||||
  [  0.,  eon_focal_length,  874/2.], | 
					 | 
				
			||||||
  [  0.,    0.,     1.]]) | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
eon_dcam_intrinsics = np.array([ | 
					 | 
				
			||||||
  [eon_dcam_focal_length,   0,   1152/2.], | 
					 | 
				
			||||||
  [  0,  eon_dcam_focal_length,  864/2.], | 
					 | 
				
			||||||
  [  0,    0,     1]]) | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
webcam_intrinsics = np.array([ | 
					 | 
				
			||||||
  [webcam_focal_length,   0.,   1280/2/1.5], | 
					 | 
				
			||||||
  [  0.,  webcam_focal_length,  720/2/1.5], | 
					 | 
				
			||||||
  [  0.,    0.,     1.]]) | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
if __name__ == "__main__": | 
					 | 
				
			||||||
  import cv2 | 
					 | 
				
			||||||
  trans_webcam_to_eon_rear = np.dot(eon_intrinsics, np.linalg.inv(webcam_intrinsics)) | 
					 | 
				
			||||||
  trans_webcam_to_eon_front = np.dot(eon_dcam_intrinsics, np.linalg.inv(webcam_intrinsics)) | 
					 | 
				
			||||||
  print("trans_webcam_to_eon_rear:\n", trans_webcam_to_eon_rear) | 
					 | 
				
			||||||
  print("trans_webcam_to_eon_front:\n", trans_webcam_to_eon_front) | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  cap = cv2.VideoCapture(1) | 
					 | 
				
			||||||
  cap.set(cv2.CAP_PROP_FRAME_WIDTH, 853) | 
					 | 
				
			||||||
  cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480) | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  while (True): | 
					 | 
				
			||||||
    ret, img = cap.read() | 
					 | 
				
			||||||
    if ret: | 
					 | 
				
			||||||
      # img = cv2.warpPerspective(img, trans_webcam_to_eon_rear, (1164,874), borderMode=cv2.BORDER_CONSTANT, borderValue=0) | 
					 | 
				
			||||||
      img = cv2.warpPerspective(img, trans_webcam_to_eon_front, (1164, 874), borderMode=cv2.BORDER_CONSTANT, borderValue=0) | 
					 | 
				
			||||||
      print(img.shape, end='\r') | 
					 | 
				
			||||||
      cv2.imshow('preview', img) | 
					 | 
				
			||||||
      cv2.waitKey(10) | 
					 | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue