I have been looking to copy an image over anotherthis link.
I wrote a very simple python function:
def fromCopyTo(target, destination, x, y):
h, w = target.shape
destination[y:y+h,x:x+w] = target
return destination
the concept is to get an target image and X and Y coordinates and copy the target image to that position - without thinking of the size of the target image (assume the destination image is big enough)
I am using an empty mask to copy to and trying to copy an image with a size 20x20 - the target image is only (0,0,0) and (255,255,255) colors
the problem is that y:y+h, returns maximum of size 11 rather than the size 20.
ValueError: could not broadcast input array from shape (20,20) into shape (11,20)
if I flip the function destination[x:x+w, y:y+h] = target
(which as far as I understand is wrong) I get:
ValueError: could not broadcast input array from shape (20,20) into shape (20,0)
by testing I ran print len(destination[y_position:y_position+30, 0])
which returns everything up to 11 but after 11 it just maxes it out to 11. As the example returns 11.
what am I doing wrong ?