Opening Nikon .NEF raw files in opencv?

asked 2014-02-26 07:58:33 -0600

s093294 gravatar image

updated 2014-03-14 05:22:14 -0600

I tried to open a .nef file in my opencv application. Everything worked but the image was 160x120 pixels instead of the full size. No errors.

What do it take to open raw .nef files and then use them.

I updated my issues at : http://stackoverflow.com/questions/22355491/libraw-is-making-my-images-too-bright-compared-to-nikons-own-converter

edit retag flag offensive close merge delete

Comments

http://lclevy.free.fr/nef/index.html (the problem fits with the specs of the 160x120 extra image)

s093294 gravatar images093294 ( 2014-02-26 08:00:12 -0600 )edit

I think it should be possible to read in your raw data using the libraw. The link shows some code on how to put the data in a matrix structure.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-02-26 08:48:51 -0600 )edit

I just tried libraw outside opencv environement and opened the ppm image it generated from the nef. It have done something to the colors. Will try your link and see if the same results will be present there. If so it must be something in libraw that is manipulating the image.

s093294 gravatar images093294 ( 2014-02-26 09:24:29 -0600 )edit

Aha, probably libraw reads in the images in an RGB way, where openCV functionality uses BGR configuration. You should switch the data of R and B channel, then it should be fixed.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-02-27 02:38:58 -0600 )edit

Thats not the problem. I already tried that and also confirmed that a Red car is actual red. I found out how to tell libraw to use the camera WB, and the image is more truth to its colors, but still to light

s093294 gravatar images093294 ( 2014-02-27 03:27:00 -0600 )edit

hmmm :) no clue then, i am sorry!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-02-27 03:34:26 -0600 )edit

Thanks anyhow. Just abit anoyed with it. We are using view NX from nikon right now which is an awesome tool but I need to automate this.

s093294 gravatar images093294 ( 2014-02-27 03:41:03 -0600 )edit