B
B
BitNeBolt2019-03-03 17:11:36
Python
BitNeBolt, 2019-03-03 17:11:36

Why is OpenCV ROI not working?

I'm trying to select a region of interest in an image, but an empty array is returned. What am I doing wrong, and what values ​​should be specified to determine the region?
Here is the code:

import numpy as np
import cv2

img = cv2.imread("circ.jpg")
img = cv2.resize(img, (500, 500))

roi = img[100:100, 200:200]

print(roi)

Picture:
5c7be07e652e9226905794.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2019-03-03
@BitNeBolt

Because the image was cut from 100 to 100 pixels in y and from 200 to 200 in x
img[y:y+h, x:x+w]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question