@@ -17,6 +17,9 @@ from cv_bridge import CvBridge, CvBridgeError
...
@@ -17,6 +17,9 @@ from cv_bridge import CvBridge, CvBridgeError
importnumpyasnp
importnumpyasnp
importtf
importtf
remembered_points=None
have_points=False
parser=OptionParser()
parser=OptionParser()
parser.add_option ("","--image-topic",action="store",type="string",dest="image_topic",help="Topic to take image from",default="/dji21/camera0/image_raw_orig")
parser.add_option ("","--image-topic",action="store",type="string",dest="image_topic",help="Topic to take image from",default="/dji21/camera0/image_raw_orig")
parser.add_option ("","--image-frame",action="store",type="string",dest="image_frame",help="Topic to take image from",default="/dji0/camera0/image_frame")
parser.add_option ("","--image-frame",action="store",type="string",dest="image_frame",help="Topic to take image from",default="/dji0/camera0/image_frame")
...
@@ -65,7 +68,7 @@ def stamp_to_json(data):
...
@@ -65,7 +68,7 @@ def stamp_to_json(data):
returnjobj
returnjobj
defimage_callback(data):
defimage_callback(data):
globalfifo
globalfifo,remembered_points,have_points
try:
try:
# print("image_callback_main")
# print("image_callback_main")
ifoptions.compressed:
ifoptions.compressed:
...
@@ -111,11 +114,13 @@ def image_callback(data):
...
@@ -111,11 +114,13 @@ def image_callback(data):
frame_pil=PilImage.fromarray(scaledimg)
frame_pil=PilImage.fromarray(scaledimg)
timestamp=time.time()
qr=qrcode.QRCode(box_size=2)
qr=qrcode.QRCode(box_size=2)
# qr.add_data(str(timestamp))
ifoptions.qr_time:
qr.add_data(json.dumps(jobj))
timestamp=time.time()
qr.make()
qr.add_data(str(timestamp))
else:
qr.add_data(json.dumps(jobj))
qr.make()
img_qr=qr.make_image()
img_qr=qr.make_image()
pos=(frame_pil.size[0]-img_qr.size[0]-1,1)#better result when 1 pixel in, thus -1 and +1
pos=(frame_pil.size[0]-img_qr.size[0]-1,1)#better result when 1 pixel in, thus -1 and +1