OpenCV矩形在原始图像上绘制(无法删除)

时间:2018-06-19 15:10:27

标签: python-3.x image computer-vision opencv3.0

我使用cv2.rectangle()函数在图像周围绘制了一个矩形。这很好。但是,我意识到它也来自我的原始副本。 (我从原始图像文件中复制了同一图像的两个副本)。有人可以指出我哪里出问题了吗? 这是代码(省略了块以减少长度):

img=cv2.imread(file,1)
height, width = img.shape[:2]
max_height = 800
max_width = 800

#some image resizing function
#...
resized=img

originalImg=resized
height0, width0=resized.shape[:2]
image=resized

#image manipulation on (image)
#...

imageRect=cv2.rectangle(image,(xCoor,yCoor),(xCoor+width, yCoor+height), (255,0,255), 3)
#This shows the drawn on rectangle fine
cv2.imshow("imageRect", imageRect)

#problem is, this originalImg still has the rectangle drawn on it
cv2.imshow("originalImg", originalImg)

0 个答案:

没有答案