I'm using OpenCV with Python and I'm trying to use multiprocess to process an image. The image is 100x100
and I have started 4 processes. The entire image was split in four. This is one process:
processes = []
_ = mp.Process(target=kill, args=[blue[0:40, 0:47],0, 2])
_.start()
processes.append(_)
After this, I just join all of the processes.
This is my function:
def kill(sliced, idx, perc):
for i in range (0, sliced.shape[0]):
for j in range (0, sliced.shape[1]):
if perc* sliced[i][j][0] - sliced[i][j][1] - sliced[i][j][2] < 0:
for k in range(0, 3):
sliced[i][j][k] = 0 #I am expecting this to alter my "blue" image
So I was expecting next, if I were to cv2.imshow("blue", blue)
to see an image with blacked out pixels. The problem is that this seems not to modify the original blue
image.
I am passing to each of my process a sliced image. After the processes being finished, I was expecting my original image to be modified, instead it wasn't altered. Passing a sliced image and modifying it shouldn't modify my original image? Is there any copy / buffer thing?