0

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.

aoi

lucians
  • 2,239
  • 5
  • 36
  • 64

1 Answers1

2

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:

enter image description here


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)
Community
  • 1
  • 1
Kinght 金
  • 17,681
  • 4
  • 60
  • 74