Commit 1b7f5ea9 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev
Browse files

initial

parent b0df5d3b
Loading
Loading
Loading
Loading

attic/channel0.xml

0 → 100644
+1 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?><properties><r_xy_2_y>0.0</r_xy_2_y><r_xy_2_x>0.0</r_xy_2_x><comment_arrays>Array corrections from acquired image to radially distorted, in pixels</comment_arrays><distortion_formula>(normalized by distortionRadius in mm) Rdist/R=A8*R^7+A7*R^6+A6*R^5+A5*R^4+A*R^3+B*R^2+C*R+(1-A6-A7-A6-A5-A-B-C)</distortion_formula><arraysSet>true</arraysSet><elevation>55.23272690216834</elevation><r_xy_1_y>0.0</r_xy_1_y><r_xy_1_x>0.0</r_xy_1_x><pixelSize>2.2</pixelSize><r_xy_0_y>0.0</r_xy_0_y><r_xy_0_x>0.0</r_xy_0_x><pixelCorrectionWidth>2592</pixelCorrectionWidth><subchannel>0</subchannel><maskSet>true</maskSet><distortionRadius>2.8512</distortionRadius><height>38.16414288388006</height><distortionC>0.021580979121640767</distortionC><distortionB>-0.1490870106930063</distortionB><distortionA>0.1715459452204896</distortionA><radius>42.886065727550715</radius><comment_subchannel>number of the sensor port on a subcamera (0..2)</comment_subchannel><comment_roll>lens rotation around the lens axis. Positive - CW looking to the target, degrees</comment_roll><pixelCorrectionHeight>1936</pixelCorrectionHeight><roll>91.03911481464476</roll><distortionRadius_unuts>mm</distortionRadius_unuts><entrancePupilForward>-1.1988297137736406</entrancePupilForward><comment_subcamera>number of the subcamera with individual IP, starting with 0</comment_subcamera><sensor_port>3</sensor_port><r_od_6_o>0.0</r_od_6_o><focalLength>4.387358364054829</focalLength><r_od_5_o>0.0</r_od_5_o><comment_channel>number of the sensor (channel) in the camera</comment_channel><r_od_6_d>0.0</r_od_6_d><r_od_4_o>0.0</r_od_4_o><comment_azimuth>lens center azimuth, CW from top, degrees</comment_azimuth><r_od_5_d>0.0</r_od_5_d><r_od_3_o>0.0</r_od_3_o><comment_elevation>lens elevation from horizontal, positive - above horizon, degrees</comment_elevation><py0>967.0225937334275</py0><r_od_4_d>0.0</r_od_4_d><r_od_2_o>0.0</r_od_2_o><comment_px0_py0>lens center on the sensor, in pixels</comment_px0_py0><comment_defects>Sensor hot/cold pixels list as x:y:difference</comment_defects><VERSION>1.0</VERSION><comment_heading>lens heading - added to azimuth</comment_heading><r_od_3_d>0.0</r_od_3_d><r_od_1_o>0.0</r_od_1_o><focalLength_units>mm</focalLength_units><r_od_2_d>0.0</r_od_2_d><r_od_0_o>0.0</r_od_0_o><r_od_1_d>0.0</r_od_1_d><channel>0</channel><comment_decimation>when decimation use integer divide to find the index, corection values are in non-decimated pixels</comment_decimation><r_od_0_d>0.0</r_od_0_d><px0>1472.7260914907251</px0><azimuth>0.0</azimuth><subcamera>0</subcamera><lensDistortionModel>200</lensDistortionModel><comment_radius>lens center distance from the camera vertical axis, mm</comment_radius><heading>-0.567737495009799</heading><comment_height>lens center vertical position from the head center, mm</comment_height><r_xy_5_y>0.0</r_xy_5_y><r_xy_5_x>0.0</r_xy_5_x><pixelCorrectionDecimation>4</pixelCorrectionDecimation><comment_entrancePupilForward>entrance pupil distance from the azimuth/radius/height, outwards in mm</comment_entrancePupilForward><r_xy_4_y>0.0</r_xy_4_y><r_xy_4_x>0.0</r_xy_4_x><distortionA8>0.0</distortionA8><distortionA7>0.0</distortionA7><pixelSize_units>um</pixelSize_units><distortionA6>0.05379610812355174</distortionA6><distortionA5>-0.12746135163056044</distortionA5><r_xy_3_y>0.0</r_xy_3_y><r_xy_3_x>0.0</r_xy_3_x><comment_lensDistortionModel>Integer specifying lens distrotion model (0 - radial)</comment_lensDistortionModel></properties>
 No newline at end of file
+135 −0
Original line number Original line Diff line number Diff line
<?php
/*!***************************************************************************
*! FILE NAME  : convert_image.php
*! DESCRIPTION: based on Paulo's original jp4-proxy.php
*! CO-AUTHOR: Oleg K Dzhimiev <oleg@elphel.com>
*! Copyright (C) Paulo Henrique Silva <ph.silva@gmail.com>
*! -----------------------------------------------------------------------------**
*!  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.
*!
*!  The four essential freedoms with GNU GPL software:
*!  * the freedom to run the program for any purpose
*!  * the freedom to study how the program works and change it to make it do what you wish
*!  * the freedom to redistribute copies so you can help your neighbor
*!  * the freedom to distribute copies of your modified versions to others
*!
*!  You should have received a copy of the GNU General Public License
*!  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*/

/*!
  Copyright 2010 Paulo Henrique Silva <ph.silva@gmail.com>

  This file is part of movie2dng.

  movie2dng 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.
  
  movie2dng 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 movie2dng.  If not, see <http://www.gnu.org/licenses/>.
*/

if (isset($_GET['source'])||(isset($argv[1])&&$argv[1]=='source')) {
  $source=file_get_contents ($_SERVER['SCRIPT_FILENAME']);
  header("Content-Type: text/php");
  header("Content-Length: ".strlen($source)."\n");
  header("Pragma: no-cache\n");
  echo $source;
  exit(0);
}

if (isset($_GET['help'])||isset($_GET['usage'])) {_help();}

if (isset($argv[1])) {
  if ($argv[1]=="help"||$argv[1]=="usage") _help();
}

if (isset($_GET['path']))  $path=$_GET['path'];
else if (isset($argv[1]))  $path=$argv[1];
else die("File is not specified. Use with 'help'-key or type in a terminal: php convert_image.php help\n");

if (isset($_GET['mode'])) $mode = $_GET['mode'];
else if (isset($argv[2])) $mode = $argv[2];
else                      $mode = "jpeg";

if (isset($_GET['quality'])) $quality=$_GET['quality'];
else if (isset($argv[3]))    $quality=$argv[3];
else                         $quality=100;

if (isset($_GET['print'])) $print=true;
else if (isset($argv[4]))  $print=true;
else                       $print=false;

if (!is_file($path)&&!is_dir($path)) die("file/folder does not exist\n");

if (is_dir($path)) {
    $list = scandir($path);
    foreach($list as $file) {
	$tmp = pathinfo($file);
	if ($tmp['extension']=="jp4"||$tmp['extension']=="dng") convert_file("$path/$file",$mode,$quality);
    }
}else{
    convert_file($path,$mode,$quality);
    if ($print){
      $pathinfo = pathinfo($path);
      $file_jpeg = $pathinfo['dirname']."/".$pathinfo['filename'].".jpeg";
      $output = file_get_contents($file_jpeg); 
      header("Content-type: image/jpeg");
      echo $output;
    }
}

function convert_file($path,$mode,$quality){
    $pathinfo = pathinfo($path);
    $file_extension = $pathinfo['extension'];
    $file_dng = $pathinfo['dirname']."/".$pathinfo['filename'].".dng";
    $file_jpeg = $pathinfo['dirname']."/".$pathinfo['filename'].".jpeg";

    if (($mode=="jpeg"||$mode=="dng")&&$file_extension=="jp4") exec("movie2dng --dng $path");

    if ($mode=="jpeg"&&is_file($file_dng)) {
	    exec("dcraw -c $file_dng | cjpeg -quality $quality > $file_jpeg");
	    if ($file_extension=="jp4") exec("rm $file_dng");
    }
}

function _help(){
	echo "<pre>\n";
	echo "requirements:\n";
	echo "\tLinux OS,\n";
	echo "\tApache2,\n";
	echo "\tPHP5,\n";
	echo "\tmovie2dng (http://wiki.elphel.com/index.php?title=Movie2dng)\n";
	echo "\tcjpeg (package - libjpeg-progs, terminal: sudo apt-get install libjpeg-progs\n";
	echo "Usage (browser):\n\thttp://.../convert_image.php?path={full-path-to-file/folder}&mode={jpeg|dng}&quality={0-100}&print={true|false}\n";
	echo "\t\tpath - full path to folder or file, if a folder is specified then all the files will be processed\n";
	echo "\t\tmode - convert file into 'jpeg' or 'dng' (default - 'jpeg')\n";
	echo "\t\tquality - jpeg compression quality (default - 100)\n";
	echo "\t\tprint - show result contents (default - false)\n";
	echo "\t\tsource (w/o value) - show source\n";
	echo "\t\tusage (w/o value) - print this guide.\n";
	echo "\t\thelp (w/o value) - print this guide.\n";
	echo "Usage (terminal):\n\tphp convert_image.php {file/dir-full-path} {jpeg|dng} {0-100} {true|false}\n";
	echo "Examples:\n";
	echo "http://127.0.0.1/.../convert_image.php?path=/home/user/src/file.jp4\n";
	echo "http://127.0.0.1/.../convert_image.php?path=/home/user/src\n";
	exit(0);
}

?>
+84 −0
Original line number Original line Diff line number Diff line
<?php
/*!***************************************************************************
*! FILE NAME  : jp4-proxy.php
*! DESCRIPTION: based on Paulo's original jp4-proxy.php
*! CO-AUTHOR: Oleg K Dzhimiev <oleg@elphel.com>
*! Copyright (C) Paulo Henrique Silva <ph.silva@gmail.com>
*! -----------------------------------------------------------------------------**
*!  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.
*!
*!  The four essential freedoms with GNU GPL software:
*!  * the freedom to run the program for any purpose
*!  * the freedom to study how the program works and change it to make it do what you wish
*!  * the freedom to redistribute copies so you can help your neighbor
*!  * the freedom to distribute copies of your modified versions to others
*!
*!  You should have received a copy of the GNU General Public License
*!  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*!  $Log: jp4-proxy.php,v $
*/

/*!
  Copyright 2010 Paulo Henrique Silva <ph.silva@gmail.com>

  This file is part of movie2dng.

  movie2dng 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.
  
  movie2dng 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 movie2dng.  If not, see <http://www.gnu.org/licenses/>.
*/

if (!is_dir("tmp")){
  $old = umask(0);
  @mkdir("tmp");
  umask($old);
}

$url = $_REQUEST["url"];
$tmp_base = $_GET["n"];

if (isset($_GET['mode'])) $mode = $_GET['mode'];
else                      $mode = "jp4";

if (is_file("$tmp_base.jp4")) exec("rm $tmp_base.jp4");
if (is_file("$tmp_base.dng")) exec("rm $tmp_base.dng");
if (is_file("$tmp_base.jpeg")) exec("rm $tmp_base.jpeg");

file_put_contents("$tmp_base.$mode", file_get_contents($url));

if ($mode=="jp4") {
    exec("movie2dng --dng $tmp_base.jp4");
    exec("dcraw -c $tmp_base.dng | cjpeg -quality 75 > $tmp_base.jpeg");
}else{
    //even jpegs need to be flipped to be shown correctly, movie2dng flips aotumatically
    if ((substr($tmp_base,-1,1))%2!=0) exec("convert $tmp_base.jpeg -flip $tmp_base.jpeg");
}

$output = file_get_contents("$tmp_base.jpeg"); 

header("Content-type: image/jpeg");
print($output);

if (is_file("$tmp_base.jp4")) exec("rm $tmp_base.jp4");
if (is_file("$tmp_base.dng")) exec("rm $tmp_base.dng");
if (is_file("$tmp_base.jpeg")) exec("rm $tmp_base.jpeg");

?>

attic/jp4-to-jpeg.php

0 → 100644
+105 −0
Original line number Original line Diff line number Diff line
<?php
/*!***************************************************************************
*! FILE NAME  : jp4-2-jpeg.php
*! DESCRIPTION: based on Paulo's original jp4-proxy.php
*! CO-AUTHOR: Oleg K Dzhimiev <oleg@elphel.com>
*! Copyright (C) Paulo Henrique Silva <ph.silva@gmail.com>
*! -----------------------------------------------------------------------------**
*!  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.
*!
*!  The four essential freedoms with GNU GPL software:
*!  * the freedom to run the program for any purpose
*!  * the freedom to study how the program works and change it to make it do what you wish
*!  * the freedom to redistribute copies so you can help your neighbor
*!  * the freedom to distribute copies of your modified versions to others
*!
*!  You should have received a copy of the GNU General Public License
*!  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*!  $Log: jp4-to-jpeg.php,v $
*/

/*!
  Copyright 2010 Paulo Henrique Silva <ph.silva@gmail.com>

  This file is part of movie2dng.

  movie2dng 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.
  
  movie2dng 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 movie2dng.  If not, see <http://www.gnu.org/licenses/>.
*/

if (isset($_GET['source'])||(isset($argv[1])&&$argv[1]=='source')) {
  $source=file_get_contents ($_SERVER['SCRIPT_FILENAME']);
  header("Content-Type: text/php");
  header("Content-Length: ".strlen($source)."\n");
  header("Pragma: no-cache\n");
  echo $source;
  exit(0);
}

if (isset($_GET['help'])||isset($_GET['usage'])||(isset($argv[1])&&$argv[1]=="help"||$argv[1]=="usage")) {
	echo "<pre>\n";
	echo "web:\n\tconvert_image.php?file=<full-path-to-file>&mode=<jpeg|dng>&quality=<0-100>&print=<true|false>\n";
	echo "\t\tfile - full path to file\n";
	echo "\t\tmode - convert file into 'jpeg' or 'dng' (default - 'jpeg')\n";
	echo "\t\tquality - jpeg compression quality (default - 100)\n";
	echo "\t\tprint - show result contents (default - false)\n";
	echo "terminal:\n\tphp convert_image.php <file-full-path> <jpeg|dng> <0-100> <true|false>\n";
	exit(0);
}

if (isset($_GET['file']))  $file=$GET['file'];
else if (isset($argv[1]))  $file=$argv[1];
else die("file is not specified\n");

if (isset($_GET['mode'])) $mode = $_GET['mode'];
else if (isset($argv[2])) $mode = $argv[2];
else                      $mode = "jpeg";

if (isset($_GET['quality'])) $quality=$_GET['quality'];
else if (isset($argv[3]))    $quality=$argv[3];
else                         $quality=100;

if (isset($_GET['print'])) $print=true;
else if (isset($argv[4]))  $print=true;
else                       $print=false;

if (!is_file($file)) die("file does not exist\n");

$pathinfo = pathinfo($file);
$file_extension = $pathinfo['extension'];
$file_dng = $pathinfo['dirname']."/".$pathinfo['filename'].".dng";
$file_jpeg = $pathinfo['dirname']."/".$pathinfo['filename'].".jpeg";

if (($mode=="jpeg"||$mode=="dng")&&$file_extension=="jp4") exec("movie2dng --dng $file");

if ($mode=="jpeg"&&is_file($file_dng)) {
	exec("dcraw -c $file_dng | cjpeg -quality $quality > $file_jpeg");
	if ($file_extension=="jp4") exec("rm $file_dng");
}

if ($print){
  $output = file_get_contents($file_jpeg); 
  header("Content-type: image/jpeg");
  echo $output;
}

?>

attic/settings.php

0 → 100644
+13 −0
Original line number Original line Diff line number Diff line
<?php

$file=$_GET['file'];//"map_points.kml";


$xml=file_get_contents($file);

header("Content-Type: text/xml\n");
header("Content-Length: ".strlen($xml)."\n");
header("Pragma: no-cache\n");
echo ($xml);

?>
 No newline at end of file
Loading