photo-finish.php 2.12 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
<?php
/**
 * @file photo-finish.php
 * @brief -
 * @copyright Copyright (C) 2018 Elphel Inc.
 * @author Oleg Dzhimiev <oleg@elphel.com>
 *
 * @par <b>License</b>:
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

$help = <<<HELP
Description:
  This scripts sets up a photo finish mode. Will work for port 0, to change
  the port - edit this script.
HELP;

if (isset($argv[1])){
  $_GET['cmd'] = $argv[1];
}

if (isset($_GET['cmd'])){
  $cmd = $_GET['cmd'];
}else{
  $cmd = "donothing";
}

$sensor_port = 0;
$master_port = 0;

// $pars_init_X order is important,
// photo finish is a sensitive mode

// reset
$pars_init_0 = array(
  'WB_EN' => 0,
  'AUTOEXP_ON' => 0,
  'TRIG' => 0,
  'EXPOS' => 300,
  'COMPRESSOR_RUN' => 0
);

// set linescan mode
$pars_init_1 = array(
  'COLOR' => 5,
  'TRIG' => 4,
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
58
  'TRIG_PERIOD' => 50000, // 2000fps
59
  'PF_HEIGHT' => 2,
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
60
  'WOI_HEIGHT' => 16 // for faster work
61 62 63
);

$pars_init_2 = array(
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
64 65
  'WOI_HEIGHT' => 8000, // equals to 10 seconds for 400fps
  'WOI_TOP' => 968 // scan at the sensor's center
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
);

$pars_init_3 = array(
  'EXPOS' => 300,
  'TRIG_PERIOD' => 250000, // 400fps, 2xFPS should cover 1 second
  'COMPRESSOR_RUN' => 2
);

if ($cmd=="init"){

  $frame_num = elphel_get_frame($sensor_port);

  elphel_set_P_arr($sensor_port,$pars_init_0,$frame_num+3);
  elphel_set_P_arr($sensor_port,$pars_init_1,$frame_num+6);
  elphel_set_P_arr($sensor_port,$pars_init_2,$frame_num+9);
Oleg Dzhimiev's avatar
Oleg Dzhimiev committed
81
  elphel_set_P_arr($sensor_port,$pars_init_3,$frame_num+12);
82 83 84 85 86 87 88 89

  elphel_wait_frame_abs($sensor_port,$frame_num+12);

  echo "OK\n";

}

?>