opencv - Clone an image in cv2 python -
i'm new opencv, here question, python function act same cv::clone() in cpp? try rect
rectimg = img[10:20, 10:20]
but when draw line on ,i find line appear both on img , rectimage,so , how can done?
if use cv2
, correct method use .copy()
method in numpy. create copy of array need. otherwise produce view of object.
eg:
in [1]: import numpy np in [2]: x = np.arange(10*10).reshape((10,10)) in [4]: y = x[3:7,3:7].copy() in [6]: y[2,2] = 1000 in [8]: 1000 in x out[8]: false # see, 1000 in y doesn't change values in x, parent array.
Comments
Post a Comment