Skip to content

Instantly share code, notes, and snippets.

View Ripley6811's full-sized avatar

Jay W Johnson Ripley6811

View GitHub Profile
@Ripley6811
Ripley6811 / EXIF after PIL.py
Created April 1, 2013 08:13
ccess EXIF data of images. Preserve EXIF data after PIL manipulation of an image. Requires exiftool.exe. Download from http://www.sno.phy.queensu.ca/~phil/exiftool/
'''
Preserve EXIF data after PIL manipulation of an image.
Requires exiftool.exe. Download from http://www.sno.phy.queensu.ca/~phil/exiftool/
Basically, do not save the manipulated image over the old image. Exiftool can
copy the data from old to new.
'''
from PIL import Image
import subprocess
@Ripley6811
Ripley6811 / python_cv2_feature_detection.py
Created October 11, 2012 08:17
Python+OpenCV feature detection
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Tests the various feature detector algorithms in OpenCV 2.4 on one image
@SINCE: Thu Sep 13 23:01:23 2012
@VERSION: 0.1
@REQUIRES: OpenCV 2.4 (I used 2.4.0), matplotlib
@Ripley6811
Ripley6811 / gist:3735758
Created September 17, 2012 05:50
PIL image to CV2 image
# PIL RGB 'im' to CV2 BGR 'imcv'
imcv = np.asarray(im)[:,:,::-1].copy()
# Or
imcv = cv2.cvtColor(np.asarray(im), cv2.COLOR_RGB2BGR)
# To gray image
imcv = np.asarray(im.convert('L'))
# Or
imcv = cv2.cvtColor(np.asarray(im), cv2.COLOR_RGB2GRAY)