Hope this helps OpenCV uses NumPy arrays as the fundamental datatype to represent images. Indeed NumPy has a resize method to "resize" the data, but you're not using it properly. By consulting the documentation, the numpy.resize method requires you to reverse the order of your parameters. The input array goes first followed by the desired size. You have it almost correct - just swap the order of the arguments. However, I don't believe this is what you're looking for since numpy.resize fills in the output array with repeated copies of the input - especially since you're doing this for facial recognition. I believe you want to resize the contents of the image to fit the desired size, not fill in the array with repeated copies of the input with its original size intact.
With these it helps The problem was I was trying to get coordinate picture that were negative so it couldn't get it. I just expanded condition if pt1+leng > width or pt2+leng > height or pt2 < 0 or pt1 < 0: and it works.
I think the issue was by ths following , If you are absolutely intent on doing this in Python, then please just disregard my answer. If you are interested in getting the job done simply and fast, read on... I would suggest GNU Parallel if you have lots of things to be done in parallel and even more so as CPUs become "fatter" with more cores rather than "taller" with higher clock rates (GHz).
I hope this helps . i am trying to resize the following PNG image without losing transparent background (alpha channel) using cv2.resize() function but it only shows the original image with same dimensions [!] , Try something like this
Hope this helps By downsizing to 1 pixel you loose nearly all image information as all y-pixels get interpolated to a single number per x-pixel. By resizing back that pixel is then copied vertically to 500px, so I expect you to get a stripy pattern. You should not resize, you have to reshape. That means putting the pixel values from a 2d array to a 1d array, that is what the PCA algorithm expects.
# create 2d array
y = np.array(range(9)).reshape(3,3)
# reshape to 1d
x = y.reshape(-1)