Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-web-393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-web-393
Commits
e3e752ef
Commit
e3e752ef
authored
Dec 16, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
script tod raw
parent
fc1bb195
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
0 deletions
+87
-0
raw.php
src/php_top/raw.php
+87
-0
No files found.
src/php_top/raw.php
0 → 100644
View file @
e3e752ef
#!/usr/local/sbin/php -q
<?php
/*!*******************************************************************************
*! FILE NAME : raw.php
*! DESCRIPTION:
*! Copyright (C) 2008 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: raw.php,v $
*! Revision 1.2 2010/02/01 20:21:46 dzhimiev
*! 1. updated the code
*! 2. added 'stop' option in order not to return the sensor in continuous mode and thus keep the raw frame in buffer
*! 3. added setting 8/16 bits for BITS
*!
*! Revision 1.1 2009/10/15 19:42:16 oneartplease
*! added raw demo files
*!
*! Revision 1.2 2008/08/18 06:00:34 elphel
*! Made it acquire one image at a time
*!
*! Revision 1.1 2008/08/18 03:27:06 kimstig
*! Raw image access demo
*!
*!
*/
$sensor_port
=
0
;
if
(
$_GET
[
'sensor_port'
]
!=
NULL
)
{
$sensor_port
=
$_GET
[
'sensor_port'
];
}
function
myval
(
$s
)
{
$s
=
trim
(
$s
,
"
\"
"
);
if
(
strtoupper
(
substr
(
$s
,
0
,
2
))
==
"0X"
)
return
intval
(
hexdec
(
$s
));
else
return
intval
(
$s
);
}
$stop
=
false
;
$parsForRaw
=
array
(
'SENSOR_RUN'
=>
1
,
'BITS'
=>
8
);
foreach
(
$_GET
as
$key
=>
$value
)
switch
(
$key
){
case
'stop'
:
$stop
=
true
;
break
;
default
:
/// treat as camera native parameters
$parsForRaw
[
$key
]
=
myval
(
$value
);
}
$name
=
"/dev/image_raw"
;
$parsSaved
=
elphel_get_P_arr
(
$sensor_port
,
$parsForRaw
);
$thisFrameNumber
=
elphel_get_frame
(
$sensor_port
);
elphel_set_P_arr
(
$sensor_port
,
$parsForRaw
,
$thisFrameNumber
);
elphel_wait_frame_abs
(
$sensor_port
,
$thisFrameNumber
);
$fp
=
fopen
(
$name
,
'rb'
);
fseek
(
$fp
,
0
,
SEEK_END
);
/// file pointer at the end of the file (to find the file size)
$fsize
=
ftell
(
$fp
);
/// get file size
fseek
(
$fp
,
0
,
SEEK_SET
);
/// rewind to the start of the file
/// send the headers
header
(
"Content-Type: application/octet-stream"
);
header
(
'Content-Disposition: attachment; '
.
'filename="image.raw"'
);
header
(
"Content-Length: "
.
$fsize
.
"
\n
"
);
header
(
"Pragma: no-cache
\n
"
);
fpassthru
(
$fp
);
/// send the raw data itself
fclose
(
$fp
);
if
(
!
$stop
)
{
$parsSaved
[
'SENSOR_RUN'
]
=
2
;
elphel_set_P_arr
(
$sensor_port
,
$parsSaved
,
$thisFrameNumber
);
}
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment