Programming help with DNG processing - RAW Shooting and Processing - CHDK Forum

Programming help with DNG processing

  • 7 Replies
  • 4527 Views
*

Offline PS

  • ***
  • 157
  • A610 1.00f
Programming help with DNG processing
« on: 08 / January / 2011, 16:01:48 »
Advertisements
Here is the idea (provisional, so feel free to suggest something better):
Code: [Select]
#include <iostream>
#include <fstream>
using namespace std;
int main()
{unsigned int i, P, BL=31, hd=, size=, ev=8, CL=900;
cout<<"Black level="<<BL<<"; Header="<<hd
<<"\nSet exposure diff +Tv/0Tv("<<ev<<"): ";cin>>ev;
cout<<"\nSet clip level ("<<CL<<"): ";cin>>CL;
size-=hd; char *d0=new char[size], *d2=new char[size];
ifstream dng("0.dng",ios::binary); dng.seekg(hd); dng.read(d0,size);
ifstream dn2("2.dng",ios::binary); dn2.seekg(hd); dn2.read(d2,size);
ofstream out("m.dng",ios::binary); for(i=0; i<size; i+=2)
{P=(unsigned char)d2[i]+256*(unsigned char)d2[i+1]; if(P>CL)
{P=(unsigned char)d0[i]+256*(unsigned char)d0[i+1]; if(P>BL) P=(P-BL)*ev+BL;}
out.put(P%256); out.put(P/256);}}
« Last Edit: 16 / April / 2011, 13:44:00 by PS »

*

Offline Lebeau

  • ***
  • 187
Re: Programming help with DNG processing
« Reply #1 on: 09 / January / 2011, 21:52:37 »
Did you ever try HDR software ?

I use Dynamic Photo HDR but other soft exist.

*

Offline PS

  • ***
  • 157
  • A610 1.00f
.
« Reply #2 on: 11 / January / 2011, 11:05:59 »
.
« Last Edit: 30 / January / 2011, 18:54:56 by PS »

*

Offline Lebeau

  • ***
  • 187
Re: Programming help with DNG processing
« Reply #3 on: 11 / January / 2011, 22:38:20 »
Did you try Dynamic Photo HDR ? It merges RAW files !!!

*

Offline PS

  • ***
  • 157
  • A610 1.00f
Re: Programming help with DNG processing
« Reply #4 on: 13 / January / 2011, 11:17:37 »
Seems like common bloatware that adds bells & whistles to pictures, whereas in my first post I actually asked for programming help with simple data processing.

Re: Programming help with DNG processing
« Reply #5 on: 30 / January / 2011, 16:36:21 »
In my experience 31 is not the absolute zero for exposure, it's just that lower values are noisy and the camera seems to reset them to that black level value (or the sensor is unable to register them). See:
http://chdk.setepontos.com/index.php?topic=4737.msg46423#msg46423

So maybe your algorithm should be just p*x. When x<1, the value could change to 31 for results lesser than 31.

*

Offline PS

  • ***
  • 157
  • A610 1.00f
.
« Reply #6 on: 30 / January / 2011, 17:57:03 »
.
« Last Edit: 14 / April / 2011, 18:15:38 by PS »

*

Offline Lebeau

  • ***
  • 187
Re: Programming help with DNG processing
« Reply #7 on: 31 / January / 2011, 11:10:47 »
In Canon sensor, therefore in the raw file, you would find what they call a masked area, beside the active area.

It contains a bunch of non-exposed cells where you could statistically calculate the black level (about 32 ?) and the black level statistic distribution.

This masked area is specially usefull to evaluate certain types of noise, without using a black frame !)

 

Related Topics


SimplePortal © 2008-2014, SimplePortal