I am stupid mirroring fixed it

This commit is contained in:
2024-08-18 23:31:33 -04:00
parent 11f715c7e2
commit b7ea411159
31 changed files with 19 additions and 41118 deletions

View File

@@ -22,7 +22,6 @@ RAD2DEG = 180*pi
parser = argparse.ArgumentParser(description="Select display")
parser.add_argument("--display", action='store_true', help="enable a display of the camera")
parser.add_argument("--high_res", action='store_true', help="enable resolution 1088x720 vs 640x480")
parser.add_argument("--wide_low", action='store_true', help="estimate with wide pi 3 camera 640x480")
parser.add_argument("--pose_estimation", action='store_true', help="estimate pose based on detected tags")
parser.add_argument("--ip_add", type=str, required=True)
args = parser.parse_args()
@@ -38,8 +37,8 @@ camera_matrix = np.array([[FOCAL_LEN_PIXELS, 0., 308.94165115],
# from Camera_Calibration.py
dist = np.array([ 2.32929183e-01, -1.35534844e+00, -1.51912733e-03, -2.17960810e-03, 2.25537289e+00])
camera_res = (640, 480)
camera_res = (1536, 864)
if args.high_res:
FOCAL_LEN_PIXELS = 991.5391539
@@ -48,16 +47,7 @@ if args.high_res:
[0.00000000, 0.00000000, 1.00000000]])
dist = np.array([[ 2.52081760e-01, -1.34794418e+00, 1.24975695e-03, -7.77510823e-04,
2.29608398e+00]])
camera_res = (1088, 720)
if args.wide_low:
FOCAL_LEN_PIXELS = 976.16482142
camera_matrix = np.array([[FOCAL_LEN_PIXELS, 0., 771.05155174],
[ 0., FOCAL_LEN_PIXELS, 408.52081949],
[ 0., 0., 1. ]])
dist = np.array([[-0.04790604, 0.08489533, -0.00387366, 0.00616192, -0.03875398]])
camera_res = (1536, 864)
camera_res = (2304, 1296)
b=6.5
# 3d object array. The points of the 3d april tag that coresponds to tag_points which we detect
@@ -135,10 +125,14 @@ def display_features(image, imgpts, totalDist):
return image
# setting up apriltag detection. Make sure this is OUTSIDE the loop next time
options = apriltag.DetectorOptions(families='tag36h11', border=1, nthreads=1,
quad_decimate=2.0, quad_blur=0.0, refine_edges=True,
refine_decode=False, refine_pose=False, debug=True, quad_contours=True)
detector = apriltag.Detector(options)
detector = dt_apriltags.Detector(searchpath=['apriltags'],
families='tag36h11',
nthreads=2,
quad_decimate=2,
quad_sigma=0,
refine_edges=1,
decode_sharpening=0.25,
debug=0)
# main vision processing code
time.sleep(0.1)
@@ -153,6 +147,7 @@ while True:
tagFrame = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
output = detector.detect(tagFrame)
print(output)
for det in output:

View File

@@ -15,6 +15,7 @@ while True:
stream.update()
frame = stream.read()
frame = cv2.flip(frame, 1)
grey = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

View File

@@ -1,5 +1,6 @@
from picamera2 import Picamera2
from libcamera import Transform
import cv2
# class for allocating a thread to only updating the camera stream,
# the other thread is used for detection processing
@@ -24,6 +25,7 @@ class Picam2Vid:
self.camera.stop()
return
self.frame=self.camera.capture_array('main')
self.frame = cv2.flip(self.frame, 1)
#print(self.frame.dtype)
#print("debug threading")

View File

@@ -2,7 +2,6 @@ import dt_apriltags
import numpy as np
import cv2
FOCAL_LEN_PIXELS = 976.16482142
camera_matrix = np.array([[FOCAL_LEN_PIXELS, 0., 771.05155174],
[ 0., FOCAL_LEN_PIXELS, 408.52081949],
@@ -13,9 +12,9 @@ dist = np.array([[-0.04790604, 0.08489533, -0.00387366, 0.00616192, -0.0387539
detector = dt_apriltags.Detector(searchpath=['apriltags'],
families='tag36h11',
nthreads=2,
quad_decimate=2,
quad_sigma=1,
refine_edges=3,
quad_decimate=1,
quad_sigma=0,
refine_edges=1,
decode_sharpening=0.25,
debug=1)
@@ -41,6 +40,6 @@ print(smaller)
cv2.imshow("frame", smaller)
cv2.waitKey(0)
output = detector.detect(smaller, estimate_tag_pose=False, camera_params=None, tag_size=None)
output = detector.detect(smaller, estimate_tag_pose=True, camera_params=None, tag_size=None)
print(output)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 258 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 570 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 668 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB