1

This Mathworks.com article (the creators of MATLAB) suggests that the .NEF format undergoes a quantization, using the linearization table shown in the link. I have a Nikon Coolpix B700, which captures RAW images in .NRW format. I want the actual RAW data, so I need to know if there is quantization, along the same lines as .NEF, happening in .NRW as well?

I have tried DNG converter, and it does not have any output for a linearization table, when accessed using the code in the link.

3

Correction — the linked article (including the comments thread following it) suggests that the .NEF format undergoes a linear quantization only for some consumer-grade DSLR cameras.

Mathworks.com user "Craig" says (in comment #4):

I did some checking and Nikon’s consumer-grade DSLRs (D90 and below) do indeed compress the raw sensor data from 12 bits to 9-10 bits in NEF format using curves of the type above. The higher-end DLSRs have the choice of compressed or uncompressed NEF.

(note, this Mathworks.com article and comments are from March 2011, so references to specific camera models are relative to that timeframe).

In Decemer 2011, user "Stephen Nuske" corroborate's Craig's statement (in comment #17):

Because it appears that there was no LinearizationTable applied by my Nikon D300S to the NEF. After reading the cfa from the Tiff, as you listed above, the values go up past 768 which is unlike the NEF you tested with. The values in my NEF went all the way to the full 12bit range (4096).

The quantization is applied for cameras that use (or optionally allow) "12-bit compressed" RAW format. This "compressed" format is lossy; in fact, it is the quantization table that creates this compression. In the Mathworks.com article you linked to, the extracted RAW data values range from 0 – 768. Note that log₂(768) ≈ 9.6, meaning that it requires 10 bits to store the range of values. Thus the D90 camera in the article compressed the 12-bit data to an approximate 10-bit range via the quantization table. (Nikon describes their RAW lossy format as "virtually lossless").


To answer your question, "I want the actual RAW data, I need to know if there is quantization happening in .NRW as well?", I do not believe the B700 compresses .NRW data.

I downloaded a sample .NRW file and extracted its tags using exiftool. One of the tags, Compression, returned Uncompressed:

> exiftool "-*Compression*" 2017-01-18_B700_0053.nrw
Compression                     : Uncompressed

Compare the output of a sample D90 .NEF file, which as we know uses compression:

> exiftool "-*Compression*" nikon_d90_04.nef
Compression                     : Nikon NEF Compressed
NEF Compression                 : Lossy (type 2)    

For completion's sake, I tested against a sample .NRW file from a CoolPix P7800, which shows the RAW file uses compression:

> exiftool "-*Compression*"  nikon_coolpix_p7800_01.nrw
Compression                     : Nikon NEF Compressed
NEF Compression                 : Unknown (7)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.