Fast CinemaDNG Processor

High performance software for CinemaDNG processing on GPU

Fast CinemaDNG Processor on CUDA

PGM to DNG Converter

We have wide experience to work with machine vision and industrial video cameras and in most cases we can't get raw output from such a cameras in DNG format or something alike. We can get raw data from the camera, but such cameras don't offer any additional info concerning color calibration which is a must to get precise colors after image processing. If we have a look at photo cameras from Canon, Nikon, Sony, etc., we can see that all these manufacturers store color calibration info inside each camera. So we see the difference and it's not very difficult to do pretty much the same.

Normally we get raw frame from machine vision or industrial camera as a bitmap of 8/10/12/14/16-bit values which we store at PGM (Portable Gray Map) image format. Apart from bitmap we know bit depth and image resolution (width and height) for every frame. But this is not enough for precise color reproduction. We also need the following:

  • White Balance coefficients (three coefficients for red, green and blue channels)
  • Color correction matrix 3x3 or DCP profile

To get the above data, we need to perform color calibration with Color Checker and calibrated light sources. Camera manufacturers do that calibration by themselves because they posess high quality and well-calibrated light sources. If our illimination is different, we can compute color transform to take that into account, but we need original color calibration data, which are supplied by camera manufacturer.

To describe the situation in more detail, we get raw data at camera colorspace, and we need to transform that data to any colorpace that we know. Usually we need to transform data from camera colorspace to intermediary XYZ colorspace and later on we will transform the image to any colorpace that we need. To get calibration data, we need to capture Color Checker card and process it with DCamProf software. So we need to combine Adobe DNG SDK 1.4 together with DCamProf software to accomplish that task.

Algorithm for PGM2DNG converter

  1. Get PGM data from a camera or from SSD/NMVe
  2. Capture Color Checker image and recognize all 24 squares
  3. Compute WB coefficients
  4. Load Color Checker image to DCamProf software to get DCP profile
  5. Create DNG image from WB coefficients, DCP profile and PGM data
  6. Raw data in DNG could be stored as tiles with lossless jpeg compression
  7. Optionally view DNG at Fast CinemaDNG Processor or Raw Therapee

You can get source codes and more info from