Commit f99d7936 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

initial

parent 9217bd7e
...@@ -14,6 +14,10 @@ preview panoramas for Eyesis4Pi 393 ...@@ -14,6 +14,10 @@ preview panoramas for Eyesis4Pi 393
* http://localhost/panorama_preview/ * http://localhost/panorama_preview/
* Select "somedir" from the Choose Date dropdown list * Select "somedir" from the Choose Date dropdown list
## differences from the older version
* jp4s are converted with javascript
* switched maps to leaflet.js and OpenStreetMap tiles
## older version (for Eyesis4Pi based on 10353s) ## older version (for Eyesis4Pi based on 10353s)
[sourceforge.net][1] [sourceforge.net][1]
[1]:https://sourceforge.net/p/elphel/panorama_preview/ci/master/tree/ [1]:https://sourceforge.net/p/elphel/panorama_preview/ci/master/tree/
<?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
<?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);
}
?>
<?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");
?>
<?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;
}
?>
<?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
<?xml version="1.0" encoding="UTF-8"?>
<Document>
<image_0>
<ch0_flip_h>0</ch0_flip_h>
<ch0_flip_v>0</ch0_flip_v>
<ch1_flip_h>0</ch1_flip_h>
<ch1_flip_v>0</ch1_flip_v>
<ch2_flip_h>1</ch2_flip_h>
<ch2_flip_v>0</ch2_flip_v>
</image_0>
<image_1>
<ch0_flip_h>1</ch0_flip_h>
<ch0_flip_v>0</ch0_flip_v>
<ch1_flip_h>1</ch1_flip_h>
<ch1_flip_v>0</ch1_flip_v>
<ch2_flip_h>0</ch2_flip_h>
<ch2_flip_v>0</ch2_flip_v>
</image_1>
<image_2>
<ch0_flip_h>0</ch0_flip_h>
<ch0_flip_v>0</ch0_flip_v>
<ch1_flip_h>0</ch1_flip_h>
<ch1_flip_v>0</ch1_flip_v>
<ch2_flip_h>1</ch2_flip_h>
<ch2_flip_v>0</ch2_flip_v>
</image_2>
<image_3>
<ch0_flip_h>1</ch0_flip_h>
<ch0_flip_v>0</ch0_flip_v>
<ch1_flip_h>1</ch1_flip_h>
<ch1_flip_v>0</ch1_flip_v>
<ch2_flip_h>0</ch2_flip_h>
<ch2_flip_v>0</ch2_flip_v>
</image_3>
<image_4>
<ch0_flip_h>0</ch0_flip_h>
<ch0_flip_v>0</ch0_flip_v>
<ch1_flip_h>0</ch1_flip_h>
<ch1_flip_v>0</ch1_flip_v>
<ch2_flip_h>1</ch2_flip_h>
<ch2_flip_v>0</ch2_flip_v>
</image_4>
<image_5>
<ch0_flip_h>1</ch0_flip_h>
<ch0_flip_v>0</ch0_flip_v>
<ch1_flip_h>1</ch1_flip_h>
<ch1_flip_v>0</ch1_flip_v>
<ch2_flip_h>0</ch2_flip_h>
<ch2_flip_v>0</ch2_flip_v>
</image_5>
<image_6>
<ch0_flip_h>0</ch0_flip_h>
<ch0_flip_v>0</ch0_flip_v>
<ch1_flip_h>0</ch1_flip_h>
<ch1_flip_v>0</ch1_flip_v>
<ch2_flip_h>1</ch2_flip_h>
<ch2_flip_v>0</ch2_flip_v>
</image_6>
<image_7>
<ch0_flip_h>1</ch0_flip_h>
<ch0_flip_v>0</ch0_flip_v>
<ch1_flip_h>1</ch1_flip_h>
<ch1_flip_v>0</ch1_flip_v>
<ch2_flip_h>0</ch2_flip_h>
<ch2_flip_v>0</ch2_flip_v>
</image_7>
</Document>
<?php
/*!*******************************************************************************
*! FILE NAME : copy.php
*! DESCRIPTION : copies selected files to a specified destination
*! REVISION : 1.00
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! 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/>.
*! -----------------------------------------------------------------------------**
*/
$dest_folder = "/data/oleg/process_folder/src";
$folder = $_GET["folder"];
$file = $_GET["file"];
$imagej = $_GET["imagej"];
$dest_folder = $_GET["dest_path"];
if (!is_dir($dest_folder)){
$old = umask(0);
@mkdir($dest_folder);
umask($old);
}
if (!is_dir($imagej)){
$old = umask(0);
@mkdir($imagej);
umask($old);
}
if (substr($dest_folder,-1,1)!="/") $dest_folder = $dest_folder."/";
if (substr($folder,-1,1)!="/") $folder = $folder."/";
$file_prefix = substr($file,0,strlen($file)-6);
$file_ending = substr($file,strlen($file)-4,4);
if (strstr($file_prefix,"/")) $new_file_prefix = substr($file_prefix,strpos($file_prefix,"/")+1);
else $new_file_prefix = $file_prefix;
for ($i=1;$i<10;$i++){
exec("cp {$folder}{$file_prefix}_{$i}{$file_ending} {$dest_folder}{$new_file_prefix}_{$i}{$file_ending}");
}
?>
<?php
/*!*******************************************************************************
*! FILE NAME : copy_all.php
*! DESCRIPTION : copies all the files to a specified destination
*! REVISION : 1.00
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! 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/>.
*! -----------------------------------------------------------------------------**
*/
$folder = $_GET["src"];
$dest_folder = $_GET["dest"];
$imagej = $_GET["imagej"];
$ext = "jp4";
if (substr($dest_folder,-1,1)!="/") $dest_folder = $dest_folder."/";
if (substr($folder,-1,1)!="/") $folder = $folder."/";
if (substr($imagej,-1,1)!="/") $imagej = $imagej."/";
if (!is_dir($dest_folder)){
$old = umask(0);
@mkdir($dest_folder);
umask($old);
}
if (!is_dir($imagej)){
$old = umask(0);
@mkdir($imagej);
umask($old);
}
$subs = scandir($folder);
foreach($subs as $sub){
if (is_dir($folder.$sub)&&($sub!="trash")) {
exec("cp {$folder}{$sub}/*.$ext {$dest_folder}");
}
}
?>
<?php
/*!*******************************************************************************
*! FILE NAME : fullsize_canvas.php
*! DESCRIPTION : full size preview page
*! REVISION : 1.00
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! 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/>.
*! -----------------------------------------------------------------------------**
*/
if (!isset($_GET['path']) || !isset($_GET['name'])) echo("Too bad, some of the parameters are missing.\n");
$path = $_GET['path'];
$name = $_GET['name'];
$file_prefix = substr($name,0,strlen($name)-6);
$file_ending = substr($name,strlen($name)-4,4);
for($i=0;$i<8;$i++){
//$img_name[$i] = "{$path}/{$file_prefix}_".($i+1).$file_ending;
$img_name[$i] = "\"./jp4-proxy.php?n=tmp/".$i."&url={$path}/{$file_prefix}_".($i+1).$file_ending."\"";
}
if (isset($_GET['width'])) $w = $_GET['width'];
else $w = 400;
if (isset($_GET['height'])) $h = $_GET['height'];
else $h = 300;
?>
<html>
<head>
<title>Footage Viewer</title>
<link rel="stylesheet" type="text/css" href="js/fullsize_canvas.css" />
<script src="js/jquery-3.1.1.min.js" type="text/javascript"></script>
<script src="js/elphel.js"></script>
<script src="js/jcanvas.min.js"></script>
<script src="js/exif.js"></script>
<script src="js/jquery-jp4.js"></script>
<script src="js/fullsize_canvas.js"></script>
</head>
<body>
<div id="camerawindow" class="round_borders">
<canvas id="canvas"></canvas>
</div>
<script type="text/javascript">
var W = 2592;
var H = 1944;
var w = <?=$w?>;
var h = <?=$h?>;
var baseWidth = w;
var baseHeight = h;
$("#camerawindow").css({width:8*h,height:3*w});
var cnv;
var cContext;
cnv = document.getElementById('canvas');
cContext = cnv.getContext('2d');
cnv.setAttribute('width',baseHeight*8);cnv.setAttribute('height',baseWidth*3);
// init hidden canvases
for(var i=0;i<cams.length;i++){
append_hidden_div(i);
}
refresh_images();
function refresh_images(){
var image_name = new Array();
<?php
for($i=0;$i<8;$i++){
echo "\timage_name[$i]=".$img_name[$i].";\n";
}
?>
for (var i=0;i<8;i++){
$("#div_"+i).jp4({image:image_name[cams[i].index-1],width:w,fast:true});
}
}
</script>
</body>
</html>
\ No newline at end of file
<?php
$kmlFile=$_GET['kml'];//"map_points.kml";
$kml=file_get_contents($kmlFile);
header("Content-Type: text/xml\n");
header("Content-Length: ".strlen($kml)."\n");
header("Pragma: no-cache\n");
echo ($kml);
?>
\ No newline at end of file
<html>
<head>
<title>Eyesis4Pi (10393) Footage Preview</title>
<script src="js/jquery-3.1.1.min.js" type="text/javascript"></script>
<script src="js/jquery_list.js"></script>
<script src="js/elphel.js"></script>
<script src="js/jcanvas.min.js"></script>
<script src="js/exif.js"></script>
<script src="js/jquery-jp4.js"></script>
<script src="js/leaflet/leaflet.js"></script>
<script type="text/javascript" src="js/os_map.js"></script>
<script src="js/get_kml.js"></script>
<script src="js/map.js"></script>
<script src="js/panorama_preview.js"></script>
<link rel="stylesheet" type="text/css" href="js/leaflet/leaflet.css" />
<link rel="stylesheet" type="text/css" href="js/panorama_preview.css" />
<link rel="stylesheet" type="text/css" href="js/list.css" />
</head>
<body>
<div id=larger_preview ></div>
<div id=options>
Process files as JPEGs: <input type="checkbox" id="jpeg_mode">
</div>
<div id=input_date_list class=list>
</div>
<div id=input_text_div>
Image number
<a id=button1 class=button onclick="image_change(-1)">-</a>
<input type=text id=input_image_number value="0" onchange="refresh_map()"/>
<a id=button2 class=button onclick="image_change(1)">+</a>
</div>
<div id=filename_div>
Image name:&nbsp<div id=filename></div>
</div>
<div id="camerawindow" class="round_borders">
<a id=canvas_link href="#"><canvas id="canvas"></canvas></a>
</div>
<div id="status_div">
Status:&nbsp<div id=status>Idle</div>
</div>
<div id=osmap_wrap>
<div id=osmap>
</div>
</div>
<div id=copy_button_div>
<a id=copy_all_button class=button onclick="copy_all()">Copy All</a>
&nbsp;OR&nbsp;
<input type=text id=panos_number value="1"/>
image set(s)
<a id=copy_button class=button onclick="copy_files()">Copy to</a>
<input type=text id=copy_path value="/data/post-processing/src/"/>
</div>
</body>
</html>
\ No newline at end of file
<?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/>.
*/
$url = $_REQUEST["url"];
$output = file_get_contents($url);
header("Content-type: image/jpeg");
print($output);
?>
This diff is collapsed.
This diff is collapsed.
#camerawindow {
position: absolute;
top: 5px;
left: 5px;
/* width:1200px;
height:600px;*/
padding:5px;
/*background:#99ff99;*/
}
.invisible_element {
position:absolute;
top:0px;
left:0px;
visibility:hidden;
}
.round_borders {
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
}
\ No newline at end of file
/*!*******************************************************************************
*! FILE NAME : fullsize_canvas.js
*! DESCRIPTION : functions for creating a full size preview
*! REVISION : 1.00
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! 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/>.
*! -----------------------------------------------------------------------------**
*/
// sort
var cams = [
{"ip":"192.168.0.161","port":2326,"channel":3,"master":0,"logger":0,"index":4},
{"ip":"192.168.0.161","port":2325,"channel":2,"master":0,"logger":0,"index":3},
{"ip":"192.168.0.161","port":2323,"channel":0,"master":0,"logger":1,"index":1},
{"ip":"192.168.0.161","port":2324,"channel":1,"master":0,"logger":0,"index":2},
{"ip":"192.168.0.162","port":2326,"channel":3,"master":0,"logger":0,"index":8},
{"ip":"192.168.0.162","port":2325,"channel":2,"master":0,"logger":0,"index":7},
{"ip":"192.168.0.162","port":2323,"channel":0,"master":0,"logger":0,"index":5},
{"ip":"192.168.0.162","port":2324,"channel":1,"master":0,"logger":0,"index":6},
{"ip":"192.168.0.163","port":2325,"channel":2,"master":1,"logger":0,"index":9},
{"ip":"192.168.0.163","port":2326,"channel":3,"master":0,"logger":0,"index":10}
];
var settings_file = "settings.xml";
function draw_image(img,index){
var w = baseWidth;
var h = baseHeight;
index = +index;
cContext.rotate(90*Math.PI/180);
if (index%2==0) {
cContext.drawImage(img, 0,0*h,w,h, 0*w,-1*h*(index+1),w,h);
cContext.drawImage(img, 0,1*h,w,h, 1*w,-1*h*(index+1),w,h);
cContext.scale(-1,1);
cContext.drawImage(img, 0,2*h,w,h, -3*w, -1*h*(index+1), w, h);
cContext.scale(-1,1);
}else{
cContext.scale(1,-1); //mirror is needed
cContext.drawImage(img, 0,0*h,w,h, 0*w,index*h,w,h);
cContext.drawImage(img, 0,1*h,w,h, 1*w,index*h,w,h);
cContext.scale(-1,1);
cContext.drawImage(img, 0,2*h,w,h, -3*w,h*(index),w,h);
cContext.scale(-1,1);
cContext.scale(1,-1);
}
cContext.rotate(-90*Math.PI/180);
}
function append_hidden_div(index){
el = $("<div>",{
id: "div_"+index
}).css({
display: "none"
});
el.attr("index",index);
el.on("canvas_ready",function(){
//can draw on main canvas
var cnv = $(this).find("#scaled")[0];
var index = $(this).attr("index");
draw_image(cnv,index);
});
$("body").append(el);
}
/*!*******************************************************************************
*! FILE NAME : get_kml.js
*! DESCRIPTION: reads a kml certain record
*! Copyright (C) 2011 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! 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/>.
*! -----------------------------------------------------------------------------**
*/
var gXML_req;
function requestNode(url,callbacFunc) { // callbacFunc should accept array of panorama parameters as an argument
gXML_req=new XMLHttpRequest();
// made it sync (false = sync)
gXML_req.open("GET", url, false);
gXML_req.onreadystatechange = function() {
if (typeof(gXML_req)=="undefined") return; ///
if (gXML_req.readyState == 4) {
if (((gXML_req.status >= 200) && (gXML_req.status < 300)) || (gXML_req.status ==304) ||
((typeof(gXML_req.status) =='undefined' ) && ((navigator.userAgent.indexOf("Safari")>=0) ||
(navigator.userAgent.indexOf("Konqueror")>=0)))) {
parseRequest(gXML_req.responseXML,callbacFunc);
return;
} else {
if (gXML_req.status) {
alert("There was a problem retrieving the XML data:\n" + (gXML_req.status?gXML_req.statusText:"gXML_req.status==0")+
"\nYou may safely ignore this message if you just reloaded this page");
}
}
}
}
gXML_req.send(null);
}
function parseRequest(xml,callbacFunc) {
var node;
var links;
var panos=[];
var pano={};
if (xml.getElementsByTagName('NumberOfNodes').length>0) {
pano.numberofnodes = xml.getElementsByTagName('NumberOfNodes')[0].firstChild.nodeValue;
}
if (xml.getElementsByTagName('ThisNode').length>0) {
pano.thisnode = xml.getElementsByTagName('ThisNode')[0].firstChild.nodeValue;
}
if (xml.getElementsByTagName('PhotoOverlay').length>0) {
node=xml.getElementsByTagName('PhotoOverlay')[0];
if (node.getElementsByTagName('name').length>0) {
pano.name = node.getElementsByTagName('name')[0].firstChild.nodeValue;
}
if (node.getElementsByTagName('Camera').length>0) {
nodeCam=node.getElementsByTagName('Camera')[0];
if (nodeCam.getElementsByTagName('longitude').length>0) pano.longitude=parseFloat(nodeCam.getElementsByTagName('longitude')[0].firstChild.nodeValue);
if (nodeCam.getElementsByTagName('latitude' ).length>0) pano.latitude= parseFloat(nodeCam.getElementsByTagName('latitude' )[0].firstChild.nodeValue);
if (nodeCam.getElementsByTagName('altitude' ).length>0) pano.altitude= parseFloat(nodeCam.getElementsByTagName('altitude' )[0].firstChild.nodeValue);
if (nodeCam.getElementsByTagName('heading' ).length>0) pano.heading= parseFloat(nodeCam.getElementsByTagName('heading' )[0].firstChild.nodeValue);
if (nodeCam.getElementsByTagName('tilt' ).length>0) pano.tilt= parseFloat(nodeCam.getElementsByTagName('tilt' )[0].firstChild.nodeValue);
if (nodeCam.getElementsByTagName('roll' ).length>0) pano.roll= parseFloat(nodeCam.getElementsByTagName('roll' )[0].firstChild.nodeValue);
if (node.getElementsByTagName('Icon').length>0) {
nodeIcon=node.getElementsByTagName('Icon')[0];
if (nodeIcon.getElementsByTagName('href').length>0) pano.href=nodeIcon.getElementsByTagName('href')[0].firstChild.nodeValue;
}
// panos.push(pano);
}
}
if (xml.getElementsByTagName('Links').length>0) {
nodeLinks=xml.getElementsByTagName('Links')[0];
pano.links = [];
if (nodeLinks.getElementsByTagName('Link').length>0) {
for (var i=0;i<nodeLinks.getElementsByTagName('Link').length;i++) {
nodeLink=nodeLinks.getElementsByTagName('Link')[i];
pano.links[i] = {};
pano.links[i].pano = nodeLink.getElementsByTagName('href')[0].firstChild.nodeValue;
pano.links[i].description = nodeLink.getElementsByTagName('name')[0].firstChild.nodeValue;
pano.links[i].heading = nodeLink.getElementsByTagName('azimuth')[0].firstChild.nodeValue;
}
}
}
callbacFunc(pano);
}
This diff is collapsed.
This diff is collapsed.
(function ( $ ) {
//https://gist.github.com/leolux/c794fc63d9c362013448
var JP4 = function(element,options){
var elem = $(element);
var obj = this;
var settings = $.extend({
port: "",
image: "test.jp4",
refresh: false,
mosaic: [["Gr","R"],["B" ,"Gb"]],
fast: false,
precise: false,
width: 600,
channel: "all",
diff: false,
chn1: "red",
chn2: "green",
ndvi: false,
callback: function(){
console.log("callback");
}
},options);
var BAYER = settings.mosaic;
var FLIPV = 0;
var FLIPH = 0;
var IMAGE_FORMAT = "JPEG";
var SATURATION = [0,0,0,0];
var PIXELS = [];
var cnv_working = $("<canvas>",{id:"result"}).css({
display:"none"
});
var cnv_display = $("<canvas>",{id:"scaled"});
elem.append(cnv_working).append(cnv_display);
get_image();
//end
function get_image(){
var canvas = cnv_working;
var scaled_canvas = cnv_display;
//reset format
IMAGE_FORMAT = "JPEG";
var http = new XMLHttpRequest();
var rq = "";
if (settings.port!=""){
rq = "get-image.php?port="+settings.port+"&rel=bimg&ts="+Date.now();
settings.refresh = true;
}else{
rq = settings.image;
}
http.open("GET", rq, true);
http.responseType = "blob";
http.onload = function(e) {
if (this.status === 200) {
var heavyImage = new Image();
heavyImage.onload = function(){
EXIF.getData(this, function() {
//update canvas size
canvas.attr("width",this.width);
canvas.attr("height",this.height);
parseEXIFMakerNote(this);
canvas.drawImage({
x:0, y:0,
source: heavyImage,
load: redraw,
//scale: 1,
fromCenter: false
});
});
};
heavyImage.src = URL.createObjectURL(http.response);
}
};
http.send();
}
function redraw(){
$(this).draw({
fn: function(ctx){
var t0 = Date.now();
if ((IMAGE_FORMAT=="JP4")||(IMAGE_FORMAT=="JP46")){
if (settings.fast){
quickestPreview(ctx);
}else{
Elphel.reorderJP4Blocks(ctx,"JP4");
if (settings.precise){
PIXELS = Elphel.pixelsToArrayLinear(ctx);
Elphel.demosaicBilinear(ctx,PIXELS,settings.mosaic,true);
PIXELS = Elphel.pixelsToArray(ctx);
}else{
PIXELS = Elphel.pixelsToArray(ctx);
Elphel.demosaicBilinear(ctx,PIXELS,settings.mosaic,false);
PIXELS = Elphel.pixelsToArray(ctx);
}
if (settings.channel!="all"){
Elphel.showSingleColorChannel(ctx,settings.channel);
}
if (settings.diff){
Elphel.diffColorChannels(PIXELS,settings.chn1,settings.chn2,1);
Elphel.drawImageData(ctx,PIXELS);
}
if (settings.ndvi){
console.log(PIXELS[0]+" "+PIXELS[1]+" "+PIXELS[2]+" "+PIXELS[3]+" ");
PIXELS = Elphel.someIndex(PIXELS);
console.log(PIXELS[0]+" "+PIXELS[1]+" "+PIXELS[2]+" "+PIXELS[3]+" ");
Elphel.drawImageData(ctx,PIXELS);
}
}
// RGB -> YCbCr x SATURATION -> RGB
// Taking SATURATION[0] = 1/GAMMA[0] (green pixel of GR-line)
//saturation(ctx,SATURATION[0]);
}
Elphel.drawScaled(cnv_working,cnv_display,settings.width);
console.log("#"+elem.attr("id")+", time: "+(Date.now()-t0)/1000+" s");
$(this).trigger("canvas_ready");
if (settings.refresh) get_image();
}
});
}
function quickestPreview(ctx){
Elphel.reorderJP4Blocks(ctx,"JP4",settings.mosaic,settings.fast);
Elphel.applySaturation(ctx,SATURATION[0]);
}
function parseEXIFMakerNote(src){
var exif_orientation = EXIF.getTag(src,"Orientation");
//console.log("Exif:Orientation: "+exif_orientation);
var MakerNote = EXIF.getTag(src,"MakerNote");
//FLIPH & FLIPV
if (typeof MakerNote !== 'undefined'){
FLIPH = (MakerNote[10] )&0x1;
FLIPV = (MakerNote[10]>>1)&0x1;
var tmpBAYER = Array();
for (var i=0;i<BAYER.length;i++){tmpBAYER[i] = BAYER[i].slice();}
if (FLIPV==1){
for(i=0;i<4;i++){BAYER[(i>>1)][(i%2)] = tmpBAYER[1-(i>>1)][(i%2)];}
for(i=0;i<BAYER.length;i++){tmpBAYER[i] = BAYER[i].slice();}
}
if (FLIPH==1){
for(i=0;i<4;i++){BAYER[(i>>1)][(i%2)] = tmpBAYER[(i>>1)][1-(i%2)];}
}
}
//console.log("MakerNote: Flips: V:"+FLIPV+" H:"+FLIPH);
//COLOR_MODE ----------------------------------------------------------------
var color_mode = 0;
if (typeof MakerNote !== 'undefined') color_mode=(MakerNote[10]>>4)&0x0f;
switch(color_mode){
case 2: IMAGE_FORMAT = "JP46"; break;
case 5: IMAGE_FORMAT = "JP4"; break;
//default:
}
//var gains = Array();
//var blacks = Array();
var gammas = Array();
//var gamma_scales = Array();
//var blacks256 = Array();
//var rgammas = Array();
//SATURATION ----------------------------------------------------------------
if (typeof MakerNote !== 'undefined'){
for(i=0;i<4;i++){
//gains[i]= MakerNote[i]/65536.0;
//blacks[i]=(MakerNote[i+4]>>24)/256.0;
gammas[i]=((MakerNote[i+4]>>16)&0xff)/100.0;
//gamma_scales[i]=MakerNote[i+4] & 0xffff;
}
/*
for (i=0;i<4;i++) {
rgammas[i]=elphel_gamma_calc(gammas[i], blacks[i], gamma_scales[i]);
}
console.log(rgammas);
//adjusting gains to have the result picture in the range 0..256
min_gain=2.0*gains[0];
for (i=0;i<4;i++){
if (min_gain > (gains[i]*(1.0-blacks[i]))) min_gain = gains[i]*(1.0-blacks[i]);
}
for (i=0;i<4;i++) gains[i]/=min_gain;
for (i=0;i<4;i++) blacks256[i]=256.0*blacks[i];
*/
for (i=0;i<4;i++) {
//SATURATION[i] = 1/gammas[i];
//SATURATION[i] = 1.75; //nightmate time
SATURATION[i] = 2;
}
//console.log("MakerNote: Saturations: "+SATURATION[0]+" "+SATURATION[1]+" "+SATURATION[2]+" "+SATURATION[3]);
}
}
/*
function elphel_gamma_calc(gamma,black,gamma_scale){
gtable = Array();
rgtable = Array();
black256=black*256.0;
k=1.0/(256.0-black256);
if (gamma < 0.13) gamma=0.13;
if (gamma >10.0) gamma=10.0;
for (var i=0;i<257;i++) {
x=k*(i-black256);
if (x<0.0) x=0.0;
ig = 0.5+65535.0*Math.pow(x,gamma);
ig = (ig*gamma_scale)/0x400;
if (ig>0xffff) ig=0xffff;
gtable[i]=ig;
}
// now gtable[] is the same as was used in the camera
// FPGA was using linear interpolation between elements of the gamma table, so now we'll reverse that process
indx=0;
for (i=0;i<256;i++) {
outValue=128+(i<<8);
while ((gtable[indx+1]<outValue) && (indx<256)) indx++;
if (indx>=256) rgtable[i]=65535.0/256;
else if (gtable[indx+1]==gtable[indx])
rgtable[i]=i;
else
rgtable[i]=indx+(1.0*(outValue-gtable[indx]))/(gtable[indx+1] - gtable[indx]);
}
return rgtable;
}
*/
};
$.fn.jp4 = function(options){
var element = $(this);
// Return early if this element already has a plugin instance
if (element.data('jp4')) return element.data('jp4');
var jp4 = new JP4(this,options);
element.data('jp4',jp4);
var res = new Object();
res.cnv = element;
res.data = jp4;
return res;
};
}(jQuery));
function jquery_list(list, msg) {
var selectBoxContainer = $("#"+list);
//add the header box <div> to the list
selectBoxContainer.append("<div></div>");
//assign the default message to the list header
var selectBox = selectBoxContainer.find('div');
selectBox.html(msg);
selectBoxContainer.attr('value',msg);
//process the list
var dropDown = selectBoxContainer.find('ul');
selectBoxContainer.append(dropDown.hide());
dropDown.bind('show',function(){
if(dropDown.is(':animated')){
return false;
}
selectBox.addClass('expanded');
dropDown.slideDown();
}).bind('hide',function(){
if(dropDown.is(':animated')){
return false;
}
selectBox.removeClass('expanded');
dropDown.slideUp();
}).bind('toggle',function(){
if(selectBox.hasClass('expanded')){
dropDown.trigger('hide');
}
else dropDown.trigger('show');
});
selectBox.click(function(){
dropDown.trigger('toggle');
return false;
});
$(document).click(function(){
dropDown.trigger('hide');
});
//process all the list elements
dropDown.find('li').each(function(i) {
var li = $(this);
li.click(function(){
selectBox.html(li.html());
selectBoxContainer.attr('value',li.html());
dropDown.trigger('hide');
return false;
});
});
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
.list
{
width: 260px;
height: 25px;
line-height: 25px; /*should be the same as height*/
font-size: 12px;
}
.list li
{
list-style-type: none;
display: block;
position: relative;
top: 20px;
left: -30px;
border: 1px dotted #eaeaea;
background: white;
z-index: 100;
padding-left: 5px;
}
.list li:hover
{
background: rgba(128,200,128,1);
}
.list div
{
position:absolute;
width: 100%;
height: 100%;
text-align:center;
color: rgba(256,256,256,1);
background: #66aa66;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
}
.list div:hover
{
background: #66aa66;
color:rgba(220,220,256,1);
}
\ No newline at end of file
function get_kml_records_list(file) {
$.ajax({
url: "./get_kml.php?kml="+file,
success: function(data){
map_points = parse_kml($(data).find("PhotoOverlay"));
osm_place_points(map_points);
set_image_number(0);
}
});
}
function parse_kml(xml){
var points = new Array();
for (i=0;i<xml.length;i++) {
points[i] = new Array();
points[i].longitude=xml[i].getElementsByTagName("longitude")[0].firstChild.nodeValue;
points[i].latitude =xml[i].getElementsByTagName("latitude")[0].firstChild.nodeValue;
points[i].href =xml[i].getElementsByTagName("href")[0].firstChild.nodeValue;
points[i].thisnode = i;
}
return points;
}
/*!***************************************************************************
*! FILE NAME : os_map.js
*! DESCRIPTION: functions for OpenLayers Open Street Map API
*! Copyright (C) 2011 Elphel, Inc
*! -----------------------------------------------------------------------------**
*!
*! 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/>.
*! -----------------------------------------------------------------------------**
*!
*! $Log: os_map.js,v $
*!
*/
var osmap;
var osm_points = new Array();
var osm_CurrentMarker;
var zoom=18;
var icon_eyesis4pi;
var icon_dot_green;
var icon_dot_blue;
function osm_init(){
icon_eyesis4pi = L.icon({
iconUrl: "icons/eyesis4pi_icon.png",
iconSize: [30,70],
iconAnchor: [15,70]
});
icon_dot_green = L.icon({
iconUrl: "icons/small_dot.png",
iconSize: [12,12],
iconAnchor: [6,6]
});
icon_dot_blue = L.icon({
iconUrl: "icons/small_dot_blue.png",
iconSize: [12,12],
iconAnchor: [6,6]
});
osmap = L.map('osmap').setView([40.723407, -111.932970], 12);
L.tileLayer('http://a.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Map data and images &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
maxZoom: zoom,
}).addTo(osmap);
/*
L.marker([40.723407, -111.932970],{icon:icon_eyesis4pi}).addTo(osmap).on("click",function(e){
console.log("Youclicked "+e.latlng);
this.setIcon(icon_dot_green);
});
*/
}
function osm_place_points(){
for (var i=map_points.length-1;i>=0;i--) {
osm_place_point(map_points[i],i);
}
osm_CurrentMarker = map_points[0];
}
function osm_place_point(mark,n) {
var icon;
if (n==0) {
osmap.setView([mark.latitude, mark.longitude]);
}
if (n==0) var icon = icon_eyesis4pi;
else var icon = icon_dot_green;
osm_create_marker(mark,icon);
}
function osm_create_marker(mark,icon) {
var point = L.marker([mark.latitude, mark.longitude],{icon:icon});
$(point).attr("index",mark.thisnode);
point.on("click",function(){
//clearInterval(intvl);
osm_set_current_position(mark);
set_image_number(mark.thisnode);
});
point.on("mouseover",function(){
if (mark.href!=osm_CurrentMarker.href) this.setIcon(icon_dot_blue);
});
point.on("mouseout",function(){
if (mark.href!=osm_CurrentMarker.href) this.setIcon(icon_dot_green);
});
point.addTo(osmap);
osm_points[mark.thisnode] = point;
}
function osm_set_current_position(mark) {
osm_set_icon(osm_CurrentMarker,icon_dot_green);
osm_set_icon(mark,icon_eyesis4pi);
osm_CurrentMarker = mark;
}
function osm_remove_marker(i) {
map.removeLayer(osm_points[i]);
}
function osm_set_icon(mark,icon) {
osm_points[mark.thisnode].setIcon(icon);
}
function osm_remove_points(){
for (i=0;i<map_points.length;i++) {
osm_remove_marker(i);
}
}
#camerawindow {
position: absolute;
top: 5px;
left: 5px;
width:1170px;
height:585px;
padding:5px;
background:#99ff99;
}
.invisible_element {
position:absolute;
display:none;
visibility:hidden;
}
.round_borders {
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
}
#input_image_number {
width:45px;
height: 25px;
border: 1px solid #808080;
text-align: right;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
#sign_div { position: absolute; top: 420px; left: 0px; width: 2700px; height: 20px; padding:3px 3px 3px 3px;}
#left_div { position : absolute; top: 0px; left: 600px; width: 300px; text-align: center; font-weight: bold;}
#front_div { position : absolute; top: 0px; left: 1200px; width: 300px; text-align: center; font-weight: bold;}
#right_div { position : absolute; top: 0px; left: 1800px; width: 300px; text-align: center; font-weight: bold;}
#rear_div { position : absolute; top: 0px; left: 2400px; width: 300px; text-align: center; font-weight: bold;}
#larger_preview {
position: absolute;
top: 625px;
left: 430px;
}
#options {
position: absolute;
top: 660px;
left: 430px;
}
#input_date_list {
position: absolute;
top: 695px;
left: 430px;
}
#status_div {
position: absolute;
top: 860px;
left: 430px;
width: 300px;
height: 50px;
font-size: 20px;
font-weight: bold;
}
#status {
position: absolute;
top: 0px;
left: 100px;
font-size: 40px;
}
#copy_button_div {
position: absolute;
top: 820px;
left: 430px;
}
#input_text_div {
position: absolute;
top: 735px;
left: 430px;
}
#filename_div {
position: absolute;
top: 780px;
left: 430px;
}
#filename {
position: absolute;
top: 0px;
left: 120px;
font-size: 20px;
font-weight: bold;
}
#osmap_wrap {
position:absolute;
top: 625px;
left: 10px;
width: 400px;
height: 300px;
background: black;
padding: 3px;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
overflow: hidden;
}
#osmap {
width: 400px;
height: 300px;
overflow: hidden;
}
a.button {
font-size:12px;
color:#fff;
display:inline-block;
text-align:center;
-moz-border-radius:3px;
-webkit-border-radius:3px;
-o-border-radius:3px;
border-radius:3px;
background:#66aa66;
}
a.button:hover {
color:#fff;
background:#66bb66;
}
a.button:active {
background:#4195dd;
background:-webkit-gradient(linear, 0% 0%, 0% 100%, from(#003C82), to(#4195dd));
background:-moz-linear-gradient(0% 90% 90deg, #4195dd, #003C82);
}
#button1,
#button2
{
font-size:14px;
font-weight: bold;
width: 25px;
height: 25px;
line-height: 25px;
/*line-height: 15px; /*should be the same as height*/*/
}
#copy_button{
width: 60px;
height: 25px;
line-height: 25px;
}
#copy_all_button {
width: 60px;
height: 25px;
line-height: 25px;
}
#copy_path {
width: 220px;
height: 25px;
border: 1px solid #808080;
text-align: left;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
#panos_number {
width:45px;
height: 25px;
border: 1px solid #808080;
text-align: right;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
This diff is collapsed.
<?php
/*!*******************************************************************************
*! FILE NAME : panorama_preview.php
*! DESCRIPTION : gets the file list
*! REVISION : 1.00
*! AUTHOR : Oleg Dzhimiev <oleg@elphel.com>
*! Copyright (C) 2012 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! 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/>.
*! -----------------------------------------------------------------------------**
*/
$url = $_GET["folder"];
$type = $_GET["type"];
$filelist = scandir($url);
$i=0;
$pre_res_xml="";
//echo "<pre>";
foreach ($filelist as $value) {
//printf($value."\n");
process_folder($value,$type);
}
flush_xml($pre_res_xml);
function process_folder($file,$type) {
global $pre_res_xml;
global $url;
$ext=get_file_extension($file);
// exclude "." & ".."
if (substr($file,0,1)!=".") {
if ($ext=="") {
if (is_dir($url."/".$file)) {
//echo $url." ".$file."\n";
if ($type=="") {
$pre_res_xml .= "<f>$file</f>\n";
//echo "<f>$file</f>\n";
}
else {
$list = scandir($url."/".$file);
foreach($list as $elem){
if (get_file_extension($url."/".$file."/".$elem)==$type) {
if (strstr($elem,"_1.")) $pre_res_xml .= "<f>$file/$elem</f>\n";
//echo "<f>$elem</f>\n";
}
}
}
}
}else{
//if (($type=="jp4") && strstr($file,"_1.")) $pre_res_xml .= "<f>$file</f>\n";
}
}
}
function get_file_extension($filename) {
//return substr(strrchr($filename, '.'), 1);
return pathinfo($filename, PATHINFO_EXTENSION);
}
function flush_xml($pre_res_xml) {
$res_xml = "<?xml version='1.0' standalone='yes'?>\n";
$res_xml .="<folder_list>\n";
$res_xml .= $pre_res_xml;
$res_xml .="</folder_list>\n";
header("Content-Type: text/xml");
header("Content-Length: ".strlen($res_xml)."\n");
header("Pragma: no-cache\n");
printf("%s", $res_xml);
flush();
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment