1 | initial version |
This will worked for me. I\m using raspberry pi 3, OpenCv 3.3.0 and python 3.5.
import cv2
if __name__ == '__main__' :
# Read image
img = cv2.imread("starwars.jpg")
# Select ROI
r = cv2.selectROI("Image", img, False, False)
# Crop image
imCrop = img[int(r[1]):int(r[1]+r[3]), int(r[0]):int(r[0]+r[2])]
# Display cropped image
cv2.imshow("Image", imCrop)
cv2.waitKey(0)
2 | No.2 Revision |
This will worked for me. I\m I'm using raspberry pi 3, OpenCv 3.3.0 and python 3.5.
import cv2
if __name__ == '__main__' :
# Read image
img = cv2.imread("starwars.jpg")
# Select ROI
r = cv2.selectROI("Image", img, False, False)
# Crop image
imCrop = img[int(r[1]):int(r[1]+r[3]), int(r[0]):int(r[0]+r[2])]
# Display cropped image
cv2.imshow("Image", imCrop)
cv2.waitKey(0)
3 | No.3 Revision |
This will worked for me. I'm using raspberry pi 3, OpenCv OpenCV 3.3.0 and python 3.5.
import cv2
if __name__ == '__main__' :
# Read image
img = cv2.imread("starwars.jpg")
# Select ROI
r = cv2.selectROI("Image", img, False, False)
# Crop image
imCrop = img[int(r[1]):int(r[1]+r[3]), int(r[0]):int(r[0]+r[2])]
# Display cropped image
cv2.imshow("Image", imCrop)
cv2.waitKey(0)