hi i thought i'd post the main.py file code
import logging
import threading
import argparse
import ctypes
import json
import time
import os
from pathlib import Path
import cv2
from modules import Solenoid
from depthai_utils import DepthAI
from multiprocessing import Process, Manager
parser = argparse.ArgumentParser()
parser.add_argument('-m', '--model', default='poa', choices=list(os.listdir('./models')))
args = parser.parse_args()
debug = True
if name == "main":
Start threading
p = Process(target=store, args=(shared_results, ))
p.daemon = True
p.start()
# Initialize the model
d = DepthAI(model_name=args.model)
# Initialize the solenoid object
sol = Solenoid(12)
for frame, detections in d.run():
if len(detections) >= 1:
print ("Weed found")
sol.run(True)
else:
sol.run(False)
if debug:
cv2.putText(frame, "Find Poa", (20, 20), cv2.FONT_HERSHEY_TRIPLEX, 0.9, 255)
img_h = frame.shape[0]
img_w = frame.shape[1]
for detection in detections:
left, top = int(detection.x_min * img_w), int(detection.y_min * img_h)
right, bottom = int(detection.x_max * img_w), int(detection.y_max * img_h)
cv2.rectangle(frame, (left, top), (right, bottom), (0, 0,255), 5)
cv2.imshow('Result', frame)
if cv2.waitKey(1) == ord('q'):
cv2.destroyAllWindows()
break
del d