[Elphel-support] Setting exposure time via PHP

support-list support-list at support.elphel.com
Wed Apr 17 09:46:56 PDT 2013


David, elphel_wait_frame(N) waits for an absolute frame number N, so frame number 3 already passed (during camera startup), and that function returns immediately, so
 elphel_skip_frame(N) is equivalent to  elphel_wait_frame(elphel_get_frame()+N)

 > Let's assume that : 
 >     - The camera is in 'native' state (autoexp_on=1, free running, ect.) 
 >     - I set the exposure to something with 
 > *elphel_set_P_value*(EPHEL_EXPOS,/something/) 
 >     - and then wait for four frames with *elphel_wait_frame*(4) 
 >     - would like to read the exact frame at which the camera is and display 
 > this frame 

There will be no wait as yiouy specified "frame #4"


 >  
 > I tried to do it like this 
 > --- 
 > echo "<img src="http://192.168.0.9:8081/img" width='200'>; # curr. img 
 > elphel_set_P_value(ELPHEL_AUTOEXP_ON,0); # turn off autoexposure 
 > elphel_set_P_value(EXPOS,100000); # set exposure to 0.1 sec 
 > elphel_wait_frame(5); # to be on the safe side 
 > echo "<img src="http://192.168.0.9:8081/last/img" width='200'>; 
 > --- 


Same - frame #5

 >  
 > Should this not show me first an image from the free running mode, with 
 > autoexposure on, then turn off autoexposure and set another exposure, 
 > wait for some time and show me the new image? 

I'm not sure - need to check - what is the latency of the of the autoexposure on/off - the best way to check is to use parsedit.php with 9 images, because normally autoeposure is not turn on/off ay high frequency. I would first turn autoexosure off (once) and wait some frames. After that exposure will change with predicted latency (with some sensor restriction - it does not allow to change exposure each frame - should skip one at least between changes)
 > When I use 
 > --- 
 > echo "frame ".elphel_get_frame()."<br>"; 
 > echo elphel_wait_frame(3); 
 > echo "frame ".elphel_get_frame()."<br>"; 
 > echo elphel_skip_frame(3); 
 > echo "frame ".elphel_get_frame()."<br>"; 
 > --- 
 >  
 > I get this output from PHP 
 > --- 
 > frame 2059 
 > frame 2060 
 > frame 2063 

exactly as it should be, see my explanations at the beginning of the message.
 > --- 
 >  
 > Shouldn't *elphel_wait_frame* also increase the pointer of 
 > *elphel_get_frame*? 

Frame number counter is maintained by the hardware (FPGA), but you still can force change it (we do that in Eyesis during startup synchronization of the sub-cameras so all the cameras have the same frame number for the same panorama iamges), but after elphel_wait_frame(N) the elphel_get_frame() will return N -  only if that number did not pass already. 

 >  
 > Long story short, how can I make sure I show the user the image where 
 > the new exposure time has been set?

Basically do as you did with elphel_skip_frames(3) - or proper use elphel_wait_frame(N). You can always check the latencies with pasedit.php and 9 images - you can put multiple exposure (or other parameters)  changes with different delays in the same test (some examples are shown if you open parsedit.php without any parameters), then look at the 9-image table and analyze the chnages - each frame will be numbered and annotated with parameters that chnaged.

Andrey





More information about the Support-list mailing list