Hi lizhipeng, Auto-exposure and (white balancing too) is handled in the camera on several levels:
1) FPGA calculates histograms for each of the 4 colors (including 2 separate greens), as 256 elements arrays, this is done _after_ gamma conversion, so drivers provide a way to un-apply gamma. 2) Driver handles copying FPGA tables to system memory for the histograms and copies gamma tables to the FPGA. It can calculate cumulative histogram, histogram with un-applied gamma and reversed histogram to find out what output data from the sensor corresponds to say 98% of the pixels (98% pixels output below that value, remaining 2% - above) You can use diag_utils.php in the camera (linked from the default page) to look into the raw histogram data 3) on the top leve there is autoexposure application. You may telnet to the camera, kill it and restart with debug options in the command line (different bits of the debug value turn on different debug output). This application is easier to debud than the drivers that are compiled with the kernel and are heavily interrupt-driven. After tweaking the autoexposure (or better making another version with different name) you can simply ftp the binary to the camera and run it there Application itself itself is here http://elphel.cvs.sourceforge.net/viewvc/elphel/elphel353-8.0/apps/autoexposure/, it is also included in the camera (link from the camera default page). (1)There are two important parameters set up for auto exposure effect: > AEXP_LEVEL and AEXP_FRACPIX,can you provide some experience relation between > the two parameters for us to combine the two parameters into one parameter. > > These parameters are designed to be separate (actually there are more parameters related to autoexposure, you can access them with /parsedit.php in the camera, but these two are the most basic, and need to be different, depending on the application goal. Let's consider the following cases 1) you would like to have a perfect picture of some nicely illuminated scenary. No overexposed pixels, full 0...255 output range - you set both AEXP_LEVEL and AEXP_FRACPIX very close to 100% (0x10000) 2) you have a security camera that has to capture faces, but on there is bright background (i.e. window). If you keep the same settings, you will get nice quality of the view in the window, but very dark faces that you need. In such case I would recommend keeping AEXP_LEVEL high, but reduce AEXP_FRACPIX significantly, so that will match the fraction of dark parts of the image, if you set it to 80% that would mean that camera will ignore 20% of the image area and let it wash out. 3) The illumination conditions are changing very rapidly and you have to adjust exposure fast. That may be tricky. You see, if the camera got under-exposed frame it can easily calculate required correction to the exposure from the histogram and do it in a single step. But if it is overexposed, it may be difficult to calculate the required exposure because the information from overexposed areas is lost, so it is not know how much exposure has to be reduced to get few overexposed pixels and use all the 0.255 range simultaneously. In that case it makes sense to reduce both AEXP_LEVEL and AEXP_FRACPIX. If you set them to say 80% (actual values can be determined experimentally fro particular conditions), then camera will maintain that 80% pixels will have the value of 255*.8~=204. So If the illumination between frames increases and camera gets up to 20% of the pixels overexposed (showing as 255), it can still calculate the exact exposure for the next step using the histogram data from the previous one. Camera hardware and code is built using pipelined operation, there is certain frame latency between change of exposure and receiving the actual frame that reflects the new exposure setting, that applies to other parameters also. Those latencies depend on sensor operation mode - free running or triggered, so drivers store them separately. It is possible to troubleshoot this operation by acquiring a sequence of images and applying parameters at known frame and watching the result - parsedit.php page shows how to do that. You may use diag_utils.php in the camera to modify those latencies at run time, if you find some bug related to operation in triggered mode that you can fix with adjusting say exposure latency - please tell us, the triggered mode is less used, so less tested than the free running mode. Some autoexposure parameters may also be tweaked for that mode (I would start from that), making sure they work fof you application. Andrey
_______________________________________________ Support-list mailing list [email protected] http://support.elphel.com/mailman/listinfo/support-list_support.elphel.com
