paul-pias / Object-Detection-and-Distance-Measurement

Using yolov3 & yolov4 weights objects are being detected from live video frame along with the measurement of the object from the camera without the support of any extra hardware device.
348 stars 118 forks source link

Visual output of the code #10

Closed nikoststs closed 4 years ago

nikoststs commented 4 years ago

Hi everyone, I was wondering if there is an optical output after we run the code. E.g a video that is the same with the original plus bounding boxes and markers that mark the distance Or more generally, where can we see the distance information?

paul-pias commented 4 years ago

You need to add the following line before cv2.imshow to draw the distance in the frame. However, you can use more OpenCV functionalities to draw customized boxes, text, overlay over a frame using cv2.rectangle, cv2.overlay, etc. Anyway, I have updated the repo with few modifications, hope these will solve your issues. frame = cv2.putText(frame, str("{:.2f} Inches".format(distance)), (x,y), cv2.FONT_HERSHEY_DUPLEX, 0.6, (0,0,255), 1, cv2.LINE_AA)