Created
May 12, 2014 23:37
-
-
Save RhinoLance/bcd2a2e1b35f998e6f95 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
import time | |
import io | |
import scipy.misc | |
import pprint | |
from PIL import Image | |
from skimage import data | |
from skimage.io import imread | |
from skimage import filter | |
def processFile(src, dest): | |
print( "Processing " + src ) | |
#srcImg = imread(src) | |
srcImg = data.lena() | |
#srcImg = data.coins() | |
pprint.pprint(srcImg) | |
destImg = filter.sobel(srcImg) | |
scipy.misc.imsave(dest, destImg) | |
############################################################################## | |
### Start processing | |
############################################################################## | |
if len(sys.argv) != 3: | |
print( "Usage processQueue <source> <target>" ) | |
print(len(sys.argv)) | |
exit() | |
src = sys.argv[1]; | |
target = sys.argv[2]; | |
while True: | |
fileList = os.listdir( src ) | |
if( len(fileList) > 0 ): | |
file = fileList[0] | |
srcPath = os.path.join(src, os.path.basename(file)) | |
destPath = os.path.join(target, os.path.basename(file)) | |
processFile(srcPath, destPath) | |
#os.remove(srcPath) | |
exit() | |
else: | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment