mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-04 04:14:58 +00:00
fix thread crash
This commit is contained in:
@@ -38,7 +38,7 @@ def on_message(client, userdata, message):
|
|||||||
"bbox": box.xyxy.tolist()
|
"bbox": box.xyxy.tolist()
|
||||||
})
|
})
|
||||||
# Draw bounding box on the processed image
|
# Draw bounding box on the processed image
|
||||||
x1, y1, x2, y2 = map(int, box.xyxy)
|
x1, y1, x2, y2 = map(int, box.xyxy[0])
|
||||||
cv2.rectangle(processed_image, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
cv2.rectangle(processed_image, (x1, y1), (x2, y2), (0, 255, 0), 2)
|
||||||
cv2.putText(processed_image, f"{class_name} {box.conf.item():.2f}", (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2)
|
cv2.putText(processed_image, f"{class_name} {box.conf.item():.2f}", (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2)
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ mqtt_client.loop_start()
|
|||||||
mqtt_client.subscribe("kobuki/data")
|
mqtt_client.subscribe("kobuki/data")
|
||||||
mqtt_client.subscribe("kobuki/cam")
|
mqtt_client.subscribe("kobuki/cam")
|
||||||
|
|
||||||
mqtt_client.on_message = on_message # this line needs to be under the function definition otherwise it can't find which function it needs to use
|
mqtt_client.on_message = on_message # this line needs to be under the function definition otherwise it cant find which function it needs to use
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
@@ -64,7 +64,6 @@ def control():
|
|||||||
else:
|
else:
|
||||||
return ('Unauthorized', 401, {'WWW-Authenticate': 'Basic realm="Login Required"'})
|
return ('Unauthorized', 401, {'WWW-Authenticate': 'Basic realm="Login Required"'})
|
||||||
|
|
||||||
|
|
||||||
@app.route('/move', methods=['POST'])
|
@app.route('/move', methods=['POST'])
|
||||||
def move():
|
def move():
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
@@ -81,7 +80,6 @@ def move():
|
|||||||
def data():
|
def data():
|
||||||
return kobuki_message
|
return kobuki_message
|
||||||
|
|
||||||
|
|
||||||
@app.route('/image')
|
@app.route('/image')
|
||||||
def image():
|
def image():
|
||||||
global processed_image
|
global processed_image
|
||||||
@@ -91,12 +89,10 @@ def image():
|
|||||||
else:
|
else:
|
||||||
return "No image available", 404
|
return "No image available", 404
|
||||||
|
|
||||||
|
|
||||||
@app.route('/yolo_results', methods=['GET'])
|
@app.route('/yolo_results', methods=['GET'])
|
||||||
def yolo_results_endpoint():
|
def yolo_results_endpoint():
|
||||||
global yolo_results
|
global yolo_results
|
||||||
return jsonify(yolo_results)
|
return jsonify(yolo_results)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(debug=True, port=5000)
|
app.run(debug=True, port=5000)
|
Reference in New Issue
Block a user