packages/web/353/php_top/camera_demo.php

Go to the documentation of this file.
00001 <?php
00002 echo "<pre>\n";
00003 $init_pars=array(
00004   "FLIP"=>3,  
00005   "COLOR"=>1, 
00006   "DCM_HOR"  => 1,  
00007   "DCM_VERT" => 1,  
00008   "BIN_HOR"  => 1,  
00009   "BIN_VERT" => 1,  
00010   "QUALITY"  => 90, 
00011   "COLOR_SATURATION_BLUE" => 200 , 
00012   "COLOR_SATURATION_RED" => 200 ,  
00013   "BITS" => 8,                     
00014   "GAMMA" => 57,                   
00015   "PIXEL_LOW" => 10,               
00016   "PIXEL_HIGH" => 254,             
00017   "EXPOS" =>    100,               
00018   "WOI_LEFT" =>  0,                 
00019   "WOI_TOP" =>   0,                 
00020   "WOI_WIDTH" =>  10000,            
00021   "WOI_HEIGHT" => 10000,            
00022   "RSCALE" =>       256,            
00023   "BSCALE" =>       256,            
00024   "GAINR" =>        512,            
00025   "GAING" =>        512,            
00026   "GAINB" =>        512,            
00027   "GAINGB" =>       512,            
00028   "BAYER" =>          4             
00029 
00030   );
00031  $phase_pars=array();
00032   if ($_GET["phase"]) $phase_pars["SENSOR_PHASE"]=$_GET["phase"]+0;
00033   if ($_GET["clk"])   $phase_pars["CLK_SENSOR"]=  $_GET["clk"]*1000000; 
00034 
00035   echo "Original state was=".elphel_get_state()."<br/>\n";
00036 /*
00037   if (elphel_get_state()>7) {  //! compressor is running
00038      elphel_compressor_stop(); //! stop it
00039      while (elphel_get_state()>7) usleep (100000) ; //! just wait - will wait forever if async mode
00040      elphel_compressor_reset(); //! Maybe needed twice
00041      elphel_compressor_reset(); //! Maybe needed twice
00042   }
00043   echo "Before sensor reset state was=".elphel_get_state()."<br/>\n";
00044 */
00045   if (($_GET["phase"]) && ($_GET["clk"]==null)) { 
00046           printf ("Writing %d parameters to control sensor phase to the camera before reset\n",elphel_set_P_arr($phase_pars));
00047           print_r($phase_pars);
00048   }
00049   elphel_reset_sensor();
00050   echo "After reset+initializing: elphel_get_state=".elphel_get_state()."<br/>\n";
00051   printf ("Written %d parameters to the camera\n",elphel_set_P_arr($init_pars));
00053   if ($_GET["clk"]) { 
00054           printf ("Writing %d parameters to control sensor phase to the camera - will reset sensor (again)\n",elphel_set_P_arr($phase_pars));
00055           print_r($phase_pars);
00056   }
00057 
00058   elphel_program_sensor (0);
00059   echo "After programming sensor parameters - elphel_get_state=".elphel_get_state()."<br/>\n";
00061   echo "Parameters after programmimg:\n";
00062   print_r(elphel_get_P_arr($init_pars));
00063   if (count($phase_pars)) print_r(elphel_get_P_arr($phase_pars));
00065   elphel_compressor_run();
00067 //  elphel_compressor_frame();
00068   echo "After starting compressor - elphel_get_state=".elphel_get_state()."<br/>\n";
00069 echo "</pre>\n";
00070 echo "<p>Link to <a href=\"http://" . $_SERVER["SERVER_ADDR"] . ":8081/last/pointers\">circbuf pointers</a></p>";
00071 echo "<a href=\"http://" . $_SERVER["SERVER_ADDR"] . ":8081/last/save/wait/img\"><img src=\"http://" . $_SERVER["SERVER_ADDR"] . ":8081/last/save/wait/img\" /></a>";
00072 ?> 

Generated on Fri Nov 28 00:06:24 2008 for elphel by  doxygen 1.5.1