Using OpenCV, how can I draw a similar interface and, caputure the ROI inside it ?
How this is called ? It's a opencv mask ? I would like, more than code, know the terms/steps I have to search to achieve this.
Using OpenCV, how can I draw a similar interface and, caputure the ROI inside it ?
How this is called ? It's a opencv mask ? I would like, more than code, know the terms/steps I have to search to achieve this.
I take the image from this question.
Here is my steps:
(1) First crop and backup the roi;
(2) Then divide the image by 2;
(3) Then past the roi into the origin image.
This is my result:
The code:
# 2018/11/29 08:20 (CST)
import cv2
fname = "draw.jpg"
img = cv2.imread(fname)
sx, sy = (70, 120)
rw, rh = (410, 360)
roi = img[sy:sy+rh, sx:sx+rw].copy()
img //= 2
img[sy:sy+rh, sx:sx+rw] = roi
cv2.imwrite("dst.png", img)