A way cutting an image in OpenCV
But how I can do it on OpenCV in Python? This is what I tried:
image = cv.imread('back.png', cv.CV_LOAD_IMAGE_GRAYSCALE)
(thresh, im_cd) = cv.threshold(image, 87, 34, cv.THRESH_OTSU)
image = cv.getRectSubPix(im_cd, (120, 60 ), (10, 10))
cv.imshow('Img', image)
cv.waitKey(0)
But it doesn't work. Help me. It is urgent problem
CodePudding user response:
I had this problem 10 days ago. This is solution I think.
import cv2
img = cv2.imread("lenna.png")
crop_img = img[y:y h, x:x w]
cv2.imshow("cropped", crop_img)
cv2.waitKey(0)
CodePudding user response:
Also I wanna know about C Solution using OpenCV. Because if python not, I will do using C .
CodePudding user response:
Thanks for christopher-dev. I have done it.