【发布时间】:2016-05-19 01:10:17
【问题描述】:
尝试缩小 ROI(图像的感兴趣区域)并将其粘贴到图像其余部分的正常大小。它似乎不起作用,因为它给了我错误。我到目前为止的代码是 x1,x2,y1,y2 是原始 roi 的坐标。
resize_roi = cv2.resize(roi,None,fx=0.5, fy=0.5, interpolation =cv2.INTER_CUBIC) #indentation wrong
newimg_res = img.copy()
newimg_res[y1:y2, x1:x2] = resize_roi
cv2.imshow('Resize Rectangle',newimg_res)
cv2.waitKey(0)
cv2.destroyAllWindows()
谁能建议我做错了什么或如何解决它?
【问题讨论】:
-
欢迎来到stackoverflow。不妨先看看这里:stackoverflow.com/help/mcve 你能添加一张图片,添加你得到的错误并描述预期的结果吗?
标签: python opencv image-processing