[Elphel-support] Re1: get image and histogram for the command line

Andrey Filippov support-list at support.elphel.com
Wed Mar 23 09:40:04 PDT 2011


Sebastien, Sebastian

1) Monochrome images - you may set monochrome mode (selection list in camvc
or COLOR=0 in parsedit.pho or just from the PHP script.
It will still appear as "color JPEG", but color components will be zeroed
completely so compressed nicely.
2) "Raw" - I would still recommend using JPEG with quality=100%. The
compression error will be less than 1 count, but you'll get the normal fps -
real raw data from the camera is made fro debugging mostly, it requires each
pixel to be read from the FPGA by software - in compressed mode data is
transferred to the system memory over DMA
3) Using camvc.php to control the camera - yes, it is possible but I would
recommend using custom php script (you may use snapfull.php as an example)
4) Histograms - you may use PHP code to read histogram arrays from the
camera, there is support in the PHP extension:
http://elphel.cvs.sourceforge.net/viewvc/elphel/elphel353-8.0/apps/php-5.2.9/ext/elphel/elphel_php.c?view=markup:

1245 /**  1246 * @brief return histograms for selected frame (absolute frame
number) as a plain integer array  1247 * some derivative histograms may be
calculated if they do not exist yet  1248 * (raw FPGA data should be read
from IRQ/tasklet - no attemt to re-read FPGA here)  1249 * @param frame -
absolute frame number  1250 * @param needed - bitmask specifying what tables
to include in the output array, each group is in the order
r(0),g(1),gb(2),b(3)  1251 * - bits 0..3 - raw histograms from the FPGA
(only if they are already in the cache)  1252 * - bits 4..7 - cumulative
histograms (sum of raw ones) - normally called from applications  1253 * -
bits 8..11 - calculate percentiles (reverse cumulative histograms) -
normally called from applications  1254 * @return NULL - error, otherwise a
string with (struct histogram_stuct_t)  1255 *  1256 */  1257
 1258 PHP_FUNCTION(elphel_histogram_get)  1259 {  1260 struct
histogram_stuct_t * frame_histogram_structure;  1261 long frame=-1;  1262
long needed=0xfff;  1263 long index;  1264 int i;  1265 if (
zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &needed, &frame) ==
FAILURE) {  1266 php_error_docref(NULL TSRMLS_CC, E_ERROR, "Wrong index");
1267 RETURN_NULL ();  1268 }
(all php functions are listed in the beginning of the file)

For each function format is specified in a line like
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ll", &needed, &frame)
== FAILURE) {

"|ll" means that there are no required parameters (nothing before "|"), so
you can call
$histogram=elphel_histogram_get();

and two optional long parameters that will be assigned to "needed" and
"frame" variables

Note, there is no automatic conversion of the parameter types, they should
be numbers, not string. You may ensure that the strings are converted by
adding 0 to them, i.e
$numeric_value=$_GET('url_value')+0;
to convert url parameter (...&url_value=1234&..) to integer value 1234

Andrey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://support.elphel.com/pipermail/support-list_support.elphel.com/attachments/20110323/4d9f6bbe/attachment-0002.html>


More information about the Support-list mailing list