Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

I have a code that checks a folder for jpg files. Then invert and crop it and copy it in another folder. All i need is doing same thing for a raw image(NEF file). I need to make them grayscale too.

Here is my code for jpg images;

Python
import cv2
import numpy as np
import filecmp
import time
import os


old=set(os.listdir('C:\images'))
while (1):
    new = set(os.listdir('C:\images'))
    if(new!=old):
        difference = new.difference(old)
        for images in difference:


            img = cv2.imread('C:\images/' + images)
            
            inverted = (255-img)
            inverted2 = inverted[148:3925 , 732:5157]

            cv2.imwrite('C:/data/' + images ,inverted2)
            
    time.sleep(3)
    old =  new


i downloaded rawPy and PythonMagick too but i don't know how to use them in my code.

How can i update my code for NEF files?
Posted
Updated 23-Jan-15 0:57am
v3
Comments
Richard MacCutchan 23-Jan-15 8:56am    
Have you checked the OpenCV documentation to see if it supports this file type?
Member 10587827 23-Jan-15 9:21am    
yes i checked but i couldn't find something useful about raw images...
Richard MacCutchan 23-Jan-15 10:02am    
Then maybe they are not supported.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900