Incomplete(over-zoomed) image shown for box coordinates extraction using selectROI

Question:

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)
Asked By: dartigan

||

Answers:

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)
Answered By: berak
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.