|
|
@ -1,4 +1,3 @@ |
|
|
|
import cv2 |
|
|
|
import serial |
|
|
|
import threading |
|
|
|
import time |
|
|
@ -154,6 +153,7 @@ if __name__ == '__main__': |
|
|
|
distanceSensor.lock.release() |
|
|
|
grideye2.lock.release() |
|
|
|
grideye.lock.release() |
|
|
|
p = np.zeros((16,16), np.uint16) |
|
|
|
|
|
|
|
img = (np.array(frame.data)-15)*10 |
|
|
|
img = cv2.resize(img.astype(np.uint8), (SIZE,SIZE), interpolation = cv2.INTER_CUBIC) # INTER_LINEAR, INTER_CUBIC |
|
|
@ -179,8 +179,12 @@ if __name__ == '__main__': |
|
|
|
out[:SIZE, :SIZE] = img |
|
|
|
out[:SIZE, SIZE:] = img2 |
|
|
|
|
|
|
|
|
|
|
|
overlap = int(SIZE - (distanceBetweenSensors / (2*distance2Object*math.tan(30.0/180.0*math.pi))) * SIZE) |
|
|
|
try: |
|
|
|
overlap = int(SIZE - (distanceBetweenSensors / (2*distance2Object*math.tan(30.0/180.0*math.pi))) * SIZE) |
|
|
|
except: |
|
|
|
overlap = 0 |
|
|
|
if overlap < 0: |
|
|
|
overlap = 0 |
|
|
|
offset = int(overlap/2) |
|
|
|
# tmp = cv2.resize(img.astype(np.uint8), (SIZE*2-overlap, SIZE)) |
|
|
|
# tmp.astype(np.uint16) |
|
|
@ -222,7 +226,20 @@ if __name__ == '__main__': |
|
|
|
# out[SIZE*2:, SIZE+offset:SIZE+(SIZE-overlap2)+offset] = img2[:,overlap2:SIZE] |
|
|
|
out = out.astype(np.uint8) |
|
|
|
|
|
|
|
img = (np.array(frame.data)-15)*10 |
|
|
|
img = img.astype(np.uint8) |
|
|
|
img2 = (np.array(frame2.data)-15)*10 |
|
|
|
img2 = img2.astype(np.uint8) |
|
|
|
p = np.zeros((8,16), np.uint8) |
|
|
|
for i in range(16): |
|
|
|
if i%2 == 0: |
|
|
|
p[:,i] = img[:,int(i/2)] |
|
|
|
else: |
|
|
|
p[:,i] = img2[:,int(i/2)] |
|
|
|
p = cv2.resize(p, (SIZE,SIZE), interpolation = cv2.INTER_CUBIC) |
|
|
|
|
|
|
|
cv2.imshow('sample', out) |
|
|
|
cv2.imshow('p', p) |
|
|
|
videoWriter.write(cv2.cvtColor(out,cv2.COLOR_GRAY2BGR)) |
|
|
|
key = cv2.waitKey(1) |
|
|
|
if key == ord('q'): |
|
|
|