django - how to convert python list[a,b,c,d] to [a:b, c:d] format -
django - how to convert python list[a,b,c,d] to [a:b, c:d] format -
how convert python list [a:b, c:d]
format?
this format used in cropping of images in python-opencv.
suppose have cropping dimensions of image in list cropdim
don't know how create opencv acceptable format image[a:b, c:d]
.
import cv2 def crop(cropdim): bimage = cv2.imread("nor.jpg") cropped = bimage[a:b, c:d] cv2.imwrite('nor-crop.jpg', cropped)
first of let's terminology straight - that's not python list, it's array 2 dimensions. you're trying piece on it.
cropped = bimage[cropdim[0]:cropdim[1], cropdim[2]:cropdim[3]]
python django opencv image-processing
Comments
Post a Comment