00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00035
00036 $balance_pars=array(
00037 "RSCALE" => 256,
00038 "BSCALE" => 256,
00039 "GSCALE" => 256,
00040 "GAINR" => 512,
00041 "GAING" => 512,
00042 "GAINB" => 512,
00043 "GAINGB" => 512,
00044 );
00045 $xml = new SimpleXMLElement("<?xml version='1.0'?><white_balance/>");
00046 $xml->addChild ('pars');
00047 $xml->addChild ('before');
00048
00049
00050 $thrsh=0.98;
00051 $minfrac=0.01;
00052 $rscale=1.0;
00053 $bscale=1.0;
00054 $v=$_GET['thrsh']; if (is_numeric ($v) && ($v > 0) && ($v <= 1)) $thrsh=$v;
00055 $v=$_GET['minfrac']; if (is_numeric ($v) && ($v > 0) && ($v < 1)) $minfrac=$v;
00056 $v=$_GET['rscale']; if (is_numeric ($v) && ($v >= 0.1) && ($v <= 10.0)) $rscale=$v;
00057 $v=$_GET['bscale']; if (is_numeric ($v) && ($v >= 0.1) && ($v <= 10.0)) $bscale=$v;
00058 $balance_pars=elphel_get_P_arr($balance_pars);
00059 foreach ($balance_pars as $key=>$value) {
00060 $xml->before->addChild ($key,$value);
00061 }
00062 $xml->pars->addChild ('thrsh',$thrsh);
00063 $xml->pars->addChild ('minfrac',$minfrac);
00064 $xml->pars->addChild ('rscale',$rscale);
00065 $xml->pars->addChild ('bscale',$bscale);
00066 $rslt= elphel_white_balance ($thrsh, $minfrac, $rscale, $bscale);
00067 $xml->addChild ('result',($rslt>=0)?"OK":"failure");
00068 if ($rslt>=0) {
00069 $xml->addChild ('after');
00070 elphel_program_sensor (1);
00071 $balance_pars=elphel_get_P_arr($balance_pars);
00072 foreach ($balance_pars as $key=>$value) {
00073 $xml->after->addChild ($key,$value);
00074 }
00075 }
00076 $sxml=$xml->asXML();
00077 header("Content-Type: text/xml");
00078 header("Content-Length: ".strlen($sxml)."\n");
00079 header("Pragma: no-cache\n");
00080 printf($sxml);
00081 ?>