Skip to content

Instantly share code, notes, and snippets.

@danielthiel
Created August 20, 2014 17:23
Show Gist options
  • Save danielthiel/9ba6db066bfe6051bb41 to your computer and use it in GitHub Desktop.
Save danielthiel/9ba6db066bfe6051bb41 to your computer and use it in GitHub Desktop.
crop images with opencv (OpenCV)
"""
found here: http://amiest-devblog.blogspot.de/2008/08/how-to-crop-images-with-opencv-in.html
opencv: http://opencv.org/
"""
cropped = cvCreateImage( cvSize(new_width, new_height), 8, 3)
src_region = cvGetSubRect(image, opencv.cvRect(left, top, new_width, new_height) )
cvCopy(src_region, cropped)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment