keep experiment as commented code
This commit is contained in:
parent
4751d02229
commit
5423b84788
1 changed files with 17 additions and 4 deletions
|
@ -30,9 +30,9 @@ class Renderer:
|
||||||
self.frame_sock.connect(config.zmq_frame_addr)
|
self.frame_sock.connect(config.zmq_frame_addr)
|
||||||
|
|
||||||
|
|
||||||
H = np.loadtxt(self.config.homography, delimiter=',')
|
self.H = np.loadtxt(self.config.homography, delimiter=',')
|
||||||
|
|
||||||
self.inv_H = np.linalg.pinv(H)
|
self.inv_H = np.linalg.pinv(self.H)
|
||||||
|
|
||||||
if not self.config.output_dir.exists():
|
if not self.config.output_dir.exists():
|
||||||
raise FileNotFoundError("Path does not exist")
|
raise FileNotFoundError("Path does not exist")
|
||||||
|
@ -57,8 +57,19 @@ class Renderer:
|
||||||
predictions = self.prediction_sock.recv_json(zmq.NOBLOCK)
|
predictions = self.prediction_sock.recv_json(zmq.NOBLOCK)
|
||||||
except zmq.ZMQError as e:
|
except zmq.ZMQError as e:
|
||||||
logger.debug(f'reuse prediction')
|
logger.debug(f'reuse prediction')
|
||||||
|
|
||||||
img = frame.img
|
img = frame.img
|
||||||
|
|
||||||
|
# all not working:
|
||||||
|
# if i == 1:
|
||||||
|
# # thanks to GpG for fixing scaling issue: https://stackoverflow.com/a/39668864
|
||||||
|
# scale_factor = 1./20 # from 10m to 1000px
|
||||||
|
# S = np.array([[scale_factor, 0,0],[0,scale_factor,0 ],[ 0,0,1 ]])
|
||||||
|
# new_H = S * self.H * np.linalg.inv(S)
|
||||||
|
# warpedFrame = cv2.warpPerspective(img, new_H, (1000,1000))
|
||||||
|
# cv2.imwrite(str(self.config.output_dir / "orig.png"), warpedFrame)
|
||||||
|
|
||||||
|
|
||||||
for track_id, prediction in predictions.items():
|
for track_id, prediction in predictions.items():
|
||||||
if not 'history' in prediction or not len(prediction['history']):
|
if not 'history' in prediction or not len(prediction['history']):
|
||||||
continue
|
continue
|
||||||
|
@ -94,7 +105,9 @@ class Renderer:
|
||||||
# cv2.imwrite(str(img_path), img)
|
# cv2.imwrite(str(img_path), img)
|
||||||
self.out.write(img)
|
self.out.write(img)
|
||||||
logger.info('Stopping')
|
logger.info('Stopping')
|
||||||
self.out.release()
|
|
||||||
|
if i>2:
|
||||||
|
self.out.release()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue