Difference between revisions of "HDR images with Elphel cameras"

From ElphelWiki
Jump to: navigation, search
Line 38: Line 38:
 
(under development)
 
(under development)
  
<nowiki>
+
<pre>
 
<?php
 
<?php
 
echo "HDR on Elphel Camera<br />";
 
echo "HDR on Elphel Camera<br />";
Line 110: Line 110:
  
 
?>
 
?>
</nowiki>
+
</pre>
  
 
----
 
----

Revision as of 02:01, 15 February 2008

The purpose of this project is to get HDR images using an Elphel camera. The project development is supported by Waveng.

For informations about HDR imaging see: Wikipedia.org. For informations about HDR imaging algorithms see: Debevec.org and Columbia.edu.




INTRODUCTION

In computer graphics and photography, high dynamic range imaging (HDRI) is a set of techniques that allows a greater dynamic range of exposures than normal digital imaging techniques. The intention of HDRI is to accurately represent the wide range of intensity levels found in real scenes ranging from direct sunlight to shadows.

One HDR image is composed by many LDR (Low Dynamic Range) images representing the same scene. Ideally the LDR images should be acquired at the same time but usually they are acquired in sequence by the same camera as fast as possible. To avoid HDR ghost artifacts and to obtain high frame rate HDR videos it's important to have a high-performance hardware available depending on the static nature of the scene.

In order to get a HDR image, the HDRI system executes the following steps:

1. acquisition of n LDR images with different exposure time;

2. computation of the n acquired images;

3. generation of the HDR image.

The features of the HDRI system needed to execute this cycle are:

1. camera exposure time must vary during the acquisition process;

2. a memory to temporary save the acquired images;

3. a quite powerful CPU for image computation.

An Elphel camera satisfies all these requirements and can execute HDRI algorithms in different ways.




PHP PROGRAMMING (under development)

<?php
echo "HDR on Elphel Camera<br />";

//initial parameters
$init_pars=array(
  "FLIP"=>3,  //!xy, +1 - flip-X, +2 - flipY
  "COLOR"=>1, //! mono - 0, color mode - 1, 2- jp4, +256 - sensor test, 512 - FPGA test
  "DCM_HOR"  => 1,  //! Decimation horizontal
  "DCM_VERT" => 1,  //! Decimation vertical
  "BIN_HOR"  => 1,  //! Binning horizontal
  "BIN_VERT" => 1,  //! Binning vertical
  "QUALITY"  => 100, //! JPEG quality (%)
  "COLOR_SATURATION_BLUE" => 100 , 
  "COLOR_SATURATION_RED" => 100 ,  
  "BITS" => 8,                     //! 8-bit image mode (may be 16)
  "GAMMA" => 100,                   //! Gamma=100% (linear responce)
  "PIXEL_LOW" => 10,               //! Black level - 10 (sensor default "fat zero")
  "PIXEL_HIGH" => 254,             //! white level
  "EXPOS" =>    10,               //! whatever? (in 100usec steps)
  "WOI_LEFT" =>  0,                 //! window left
  "WOI_TOP" =>   0,                 //! window top
  "WOI_WIDTH" =>  2591,            //! window width 
  "WOI_HEIGHT" => 1936,            //! window height 
  "RSCALE" =>       256,            //! red/green*256 (no auto - it is inside ccam.cgi)
  "BSCALE" =>       256,            //! blue/green*256 (no auto - it is inside ccam.cgi)
  "GAINR" =>        100,            //! Red analog gain 2.0*256
  "GAING" =>        100,            //! Green1 (red row) analog gain 2.0*256
  "GAINB" =>        100,            //! Red analog gain 2.0*256
  "GAINGB" =>       100,            //! Green2 (blue row) analog gain 2.0*256
  "BAYER" =>          4             //! 0..3 - set, 4- use calcualted

  );
//exposure time setting doesn't work with 2592x1936 images!

if (elphel_get_state()>7) {  //! compressor is running
     elphel_compressor_stop(); //! stop it
     while (elphel_get_state()>7) ; //! just wait

     elphel_compressor_reset(); //! Maybe needed twice (why?)
     elphel_compressor_reset(); //! Maybe needed twice
}

elphel_reset_sensor();

elphel_set_P_arr($init_pars); //set the array of parameters

elphel_program_sensor(0);

//we need to acquire a sequence of frames with different exposure time
//FIRST FRAME
elphel_compressor_frame();
elphel_wait_frame();

//SECOND FRAME
elphel_set_P_value(ELPHEL_EXPOS,1000);
elphel_program_sensor(1); //should set exposure time but doesn't work
elphel_compressor_frame();
elphel_wait_frame();

//THIRD FRAME
elphel_set_P_value(ELPHEL_EXPOS,10000);
elphel_program_sensor(1); //should set exposure time but doesn't work
elphel_compressor_frame();
elphel_wait_frame();

//elaboration here

//just show last captured frame
echo "<a href=\"http://" . $_SERVER["SERVER_ADDR"] . ":8081/last/save/wait/img\"><img src=\"http://" . $_SERVER["SERVER_ADDR"] . ":8081/last/save/wait/img\" /></a>";

?>


CGI PROGRAMMING AND LINUX SOFTWARE (under development)




FPGA ALGORITHM (under development)




EXTERNAL GPU ALGORITHM (under development)