I think I will not use the proprietary Nikon format (NEF), but I will convert all the raw images to DNG files.
I now converted all files using the free adobe DNG converter, and it was now possible to import the image into matlab using this tips:
http://blogs.mathworks.com/steve/2011/03/08/tips-for-reading-a-camera-raw-file-into-matlab/
However, if I write DNG files with matlab using the tiff class, I cannot open the resulting images in lets say photoshop.
Here is what I did:
copyfile('DSC_0799_ISO1600.dng','output_test.dng');
t = Tiff('DSC_0799_ISO1600.dng','r');
offsets = getTag(t,'SubIFD');
setSubDirectory(t,offsets(1));
cfa = read(t);
close(t);
t2 = Tiff('output_test.dng','r+');
offsets = getTag(t2,'SubIFD');
setSubDirectory(t2,offsets(1));
w=flipdim(cfa,1);
t2.write(w)
close(t2);
I just copy the original file, read the content I want, open the copied file, mirror the original content and write it to the new file.
The new file is a few KBs bigger and isn't recognized by Photoshop anymore.
Is there another option to write standard DNG files?
Thank you!