Home > Software design >  Incomplete(over-zoomed) image shown for box coordinates extraction using selectROI
Incomplete(over-zoomed) image shown for box coordinates extraction using selectROI

Time:08-13

I'm new to opencv, I want to draw a rectangular box and get the coordinates of the box in an image using opencv.selectROI, but the image that opened to select the area using selectROI is incomplete, zoomed-in, because of this i'm able to see only a portion of the image.(top-left corner).

Is my image too large, is that why it is being cropped?

I did try using cv2.WINDOW_NORMAL but am not sure where to add this....!!!

The read image function using just cv2.WINDOW_NORMAL is very blurry/pixelated but complete.

Since my intention is to get the coordinates i think this could help.

Code:

import cv2
image = cv2.imread("path")

# Select ROI
r = cv2.selectROI("select the area", image)
print('Selected bounding boxes: ',r)

CodePudding user response:

I did try using cv2.WINDOW_NORMAL but am not sure where to add this....!!!

add a line like:

# set window flags
cv2.namedWindow("select the area", cv2.WINDOW_NORMAL)

# Select ROI
r = cv2.selectROI("select the area", image)
  • Related