In this code below, a picture can be loaded into openCV and then the region of interest RIO can be created by just selecting a box around something with the mouse, then press
What I am trying to do is measure the apparent width in pixels of the ROI. I am going thru some of the theory in this pyimagesearch blog post for calculating distances in images.
I have a folder called images and a .png file named 1 within the folder.
import cv2 image = cv2.imread("images/1.png") cv2.imshow("image", image) marker = cv2.selectROI("image", image, fromCenter=False, showCrosshair=True) print(marker) print(marker-marker)
The output is below but I am not really sure how/if this can be used. I think its stating the ROI x,y height & width but I am not sure:
(317, 181, 269, 359) -178 >>>
Any tips help... Thanks