We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following code does not compile
#pythran export get(int[:,:], int, int, int, int, str) #pythran export get(int[:,:], int, int, int, int) import numpy as np def get(img, y0, y1, x0, x1, mode="reflect"): #xs, ys = np.mgrid[y0:y1, x0:x1] xs = np.ones((y1-y0, x1-x0)) ys = np.ones((y1-y0, x1-x0)) height, width = img.shape if mode == "nearest": xs = np.clip(xs, 0, height-1) ys = np.clip(ys, 0, width-1) elif mode == "wrap": xs = xs % height ys = ys % width elif mode == "reflect": maxh = height-1 maxw = width-1 # An unobvious way of performing reflecting modulo # You should comment this xs = np.absolute((xs + maxh) % (2 * maxh) - maxh) ys = np.absolute((ys + maxw) % (2 * maxw) - maxw) elif mode == "constant": output = np.empty((y1-y0, x1-x0)) output.fill(0) # WHAT THE CONSTANT IS # LOADS of bounds checks and restrictions # You should comment this target_section = output[max(0, -y0):min(y1-y0, -y0+height), max(0, -x0):min(x1-x0, -x0+width)] new_fill = img[max(0, y0):min(height, y1), max(0, x0):min(width, x1)] # Crop both the sections, so that they're both the size of the smallest # Use more lines; I'm too lazy right now target_section[:new_fill.shape[0], :new_fill.shape[1]] = new_fill[:target_section.shape[0], :target_section.shape[1]] return output else: raise NotImplementedError("Unknown mode") return img[xs, ys]
but why? Related to https://linuxfr.org/nodes/114545/comments/1739776
The text was updated successfully, but these errors were encountered:
Ok, the problem comes from the imgs[cs,ys] notation which is not supported yet.
imgs[cs,ys]
Sorry, something went wrong.
And again, it's related to #926
No branches or pull requests
The following code does not compile
but why? Related to https://linuxfr.org/nodes/114545/comments/1739776
The text was updated successfully, but these errors were encountered: