Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
eyesis4pi-393-gui
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
eyesis4pi-393-gui
Commits
5d783d7f
Commit
5d783d7f
authored
Apr 22, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quicker preview
parent
59142704
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
110 additions
and
28 deletions
+110
-28
elphel.js
js/elphel.js
+52
-1
eyesis4pi.js
js/eyesis4pi.js
+1
-1
jquery-jp4.js
js/jquery-jp4.js
+40
-5
webworker.js
js/webworker.js
+14
-18
preview.html
preview.html
+1
-1
settings.xml
settings.xml
+2
-2
No files found.
js/elphel.js
View file @
5d783d7f
...
@@ -105,6 +105,55 @@ var Elphel = {
...
@@ -105,6 +105,55 @@ var Elphel = {
// Pixel manipulation
// Pixel manipulation
Pixels
:{
Pixels
:{
reorderBlocksJP4_lowres
:
function
(
pixels
,
width
,
height
,
format
=
"JP4"
,
mosaic
=
[[
"Gr"
,
"R"
],[
"B"
,
"Gb"
]],
lowres
){
var
oPixels
=
new
Uint8Array
(
pixels
.
length
/
4
);
// check
if
((
lowres
!=
1
)
&&
(
lowres
!=
2
)
&&
(
lowres
!=
4
)
&&
(
lowres
!=
8
)){
lowres
=
4
;
}
var
K0
=
3
-
Math
.
log
(
lowres
)
/
Math
.
log
(
2
);
var
K1
=
1
<<
K0
;
var
K2
=
K1
-
1
;
for
(
var
y
=
0
;
y
<
height
/
2
;
y
++
){
for
(
var
x
=
0
;
x
<
width
/
2
;
x
++
){
offset
=
y
*
width
/
2
+
x
;
y0
=
2
*
K1
*
(
y
>>
K0
)
+
(
y
&
K2
);
x0
=
4
*
K1
*
(
x
>>
K0
)
+
(
x
&
K2
);
if
(
x0
>=
width
){
x0
=
x0
-
width
;
y0
=
y0
+
K1
;
}
offset0
=
width
*
y0
+
x0
;
for
(
var
k
=
0
;
k
<
4
;
k
++
){
ym
=
(
k
>>
1
)
&
1
;
xm
=
k
&
1
;
if
(
mosaic
[
ym
][
xm
]
==
"R"
)
r
=
pixels
[
4
*
(
offset0
+
K1
*
k
)
+
0
];
else
if
(
mosaic
[
ym
][
xm
]
==
"Gr"
)
gr
=
pixels
[
4
*
(
offset0
+
K1
*
k
)
+
0
];
else
if
(
mosaic
[
ym
][
xm
]
==
"Gb"
)
gb
=
pixels
[
4
*
(
offset0
+
K1
*
k
)
+
0
];
else
if
(
mosaic
[
ym
][
xm
]
==
"B"
)
b
=
pixels
[
4
*
(
offset0
+
K1
*
k
)
+
0
];
}
g
=
(
gr
+
gb
)
>>
1
;
oPixels
[
4
*
(
offset
)
+
0
]
=
r
;
//pixels[4*(4*offset+1)+0];
oPixels
[
4
*
(
offset
)
+
1
]
=
g
;
//pixels[4*(4*offset+0)+0];
oPixels
[
4
*
(
offset
)
+
2
]
=
b
;
//pixels[4*(4*offset+2)+0];
oPixels
[
4
*
(
offset
)
+
3
]
=
255
;
}
}
return
oPixels
;
},
/**
/**
* Name: reorderJP4Blocks
* Name: reorderJP4Blocks
* Description: clear from the function's name
* Description: clear from the function's name
...
@@ -130,6 +179,8 @@ var Elphel = {
...
@@ -130,6 +179,8 @@ var Elphel = {
*/
*/
reorderBlocksJPx
:
function
(
pixels
,
width
,
height
,
format
=
"JP4"
,
mosaic
=
[[
"Gr"
,
"R"
],[
"B"
,
"Gb"
]],
nwd
=
false
){
reorderBlocksJPx
:
function
(
pixels
,
width
,
height
,
format
=
"JP4"
,
mosaic
=
[[
"Gr"
,
"R"
],[
"B"
,
"Gb"
]],
nwd
=
false
){
var
nwd2
=
true
;
var
t0
=
Date
.
now
();
var
t0
=
Date
.
now
();
// pixels is a long 1-D array with the following structure:
// pixels is a long 1-D array with the following structure:
...
@@ -175,7 +226,7 @@ var Elphel = {
...
@@ -175,7 +226,7 @@ var Elphel = {
macroblock
[((
y
<<
1
)
&
0xe
)
|
((
y
>>
3
)
&
0x1
)][((
x
<<
1
)
&
0xe
)
|
((
x
>>
3
)
&
0x1
)]
=
pixels
[
4
*
(
offset
+
x
)];
macroblock
[((
y
<<
1
)
&
0xe
)
|
((
y
>>
3
)
&
0x1
)][((
x
<<
1
)
&
0xe
)
|
((
x
>>
3
)
&
0x1
)]
=
pixels
[
4
*
(
offset
+
x
)];
}
}
}
}
}
}
if
(
nwd
){
if
(
nwd
){
for
(
y
=
0
;
y
<
8
;
y
++
){
for
(
y
=
0
;
y
<
8
;
y
++
){
...
...
js/eyesis4pi.js
View file @
5d783d7f
...
@@ -569,7 +569,7 @@ function refresh_images_eyesis(){
...
@@ -569,7 +569,7 @@ function refresh_images_eyesis(){
for
(
var
i
=
0
;
i
<
cams
.
length
;
i
++
){
for
(
var
i
=
0
;
i
<
cams
.
length
;
i
++
){
remove_hidden_div
(
i
);
remove_hidden_div
(
i
);
append_hidden_div
(
i
);
append_hidden_div
(
i
);
$
(
"#div_"
+
i
).
jp4
({
ip
:
cams
[
i
].
ip
,
port
:
cams
[
i
].
port
,
width
:
200
,
fast
:
true
});
$
(
"#div_"
+
i
).
jp4
({
ip
:
cams
[
i
].
ip
,
port
:
cams
[
i
].
port
,
width
:
200
,
fast
:
true
,
lowres
:
4
});
}
}
}
}
...
...
js/jquery-jp4.js
View file @
5d783d7f
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
mosaic
:
[[
"Gr"
,
"R"
],[
"B"
,
"Gb"
]],
mosaic
:
[[
"Gr"
,
"R"
],[
"B"
,
"Gb"
]],
fast
:
false
,
fast
:
false
,
precise
:
false
,
precise
:
false
,
lowres
:
0
,
// valid values: 1,2,4,8. 0 to disable
width
:
600
,
width
:
600
,
channel
:
"all"
,
channel
:
"all"
,
diff
:
false
,
diff
:
false
,
...
@@ -69,6 +70,13 @@
...
@@ -69,6 +70,13 @@
// hide working canvas
// hide working canvas
cnv_working
.
css
({
display
:
"none"
});
cnv_working
.
css
({
display
:
"none"
});
/*
cnv_working.css({
position:"absolute",
top: "500px",
left: "500px"
});
*/
elem
.
append
(
cnv_working
);
elem
.
append
(
cnv_working
);
elem
.
append
(
cnv_display
);
elem
.
append
(
cnv_display
);
...
@@ -112,17 +120,36 @@
...
@@ -112,17 +120,36 @@
heavyImage
.
onload
=
function
(){
heavyImage
.
onload
=
function
(){
EXIF
.
getData
(
this
,
function
()
{
EXIF
.
getData
(
this
,
function
()
{
var
cnv_w
;
var
cnv_h
;
if
(
settings
.
lowres
!=
0
){
cnv_w
=
this
.
width
/
settings
.
lowres
;
cnv_h
=
this
.
height
/
settings
.
lowres
;
}
else
{
cnv_w
=
this
.
width
;
cnv_h
=
this
.
height
;
}
//update canvas size
//update canvas size
canvas
.
attr
(
"width"
,
this
.
width
);
canvas
.
attr
(
"width"
,
cnv_w
);
canvas
.
attr
(
"height"
,
this
.
height
);
canvas
.
attr
(
"height"
,
cnv_h
);
parseEXIFMakerNote
(
this
);
parseEXIFMakerNote
(
this
);
canvas
.
drawImage
({
canvas
.
drawImage
({
x
:
0
,
y
:
0
,
x
:
0
,
y
:
0
,
source
:
this
,
source
:
this
,
width
:
cnv_w
,
height
:
cnv_h
,
//source: heavyImage,
//source: heavyImage,
load
:
redraw
,
load
:
redraw
,
sx
:
0
,
sy
:
0
,
sWidth
:
this
.
width
,
sHeight
:
this
.
height
,
//scale: scale,
fromCenter
:
false
fromCenter
:
false
});
});
});
});
...
@@ -142,7 +169,7 @@
...
@@ -142,7 +169,7 @@
//IMAGE_FORMAT="JPEG";
//IMAGE_FORMAT="JPEG";
$
(
this
).
draw
({
$
(
this
).
draw
({
fn
:
function
(
ctx
){
fn
:
function
(
ctx
){
console
.
log
(
"#"
+
elem
.
attr
(
"id"
)
+
", raw image drawn time: "
+
(
Date
.
now
()
-
TX
)
/
1000
+
" s"
);
console
.
log
(
"#"
+
elem
.
attr
(
"id"
)
+
", raw image drawn time: "
+
(
Date
.
now
()
-
TX
)
/
1000
+
" s"
);
TX
=
Date
.
now
();
TX
=
Date
.
now
();
...
@@ -208,6 +235,13 @@
...
@@ -208,6 +235,13 @@
var
worker
=
new
Worker
(
'js/webworker.js'
);
var
worker
=
new
Worker
(
'js/webworker.js'
);
TX
=
Date
.
now
();
//ctx.canvas.width = ctx.canvas.width/2;
//ctx.canvas.height = ctx.canvas.height/2;
//ctx.canvas.style.width = ctx.canvas.style.width/4;
//ctx.canvas.style.height = ctx.canvas.style.height/4;
var
width
=
ctx
.
canvas
.
width
;
var
width
=
ctx
.
canvas
.
width
;
var
height
=
ctx
.
canvas
.
height
;
var
height
=
ctx
.
canvas
.
height
;
var
image
=
ctx
.
getImageData
(
0
,
0
,
width
,
height
);
var
image
=
ctx
.
getImageData
(
0
,
0
,
width
,
height
);
...
@@ -226,7 +260,8 @@
...
@@ -226,7 +260,8 @@
fast
:
settings
.
fast
,
fast
:
settings
.
fast
,
channel
:
settings
.
channel
,
channel
:
settings
.
channel
,
diff
:
settings
.
diff
,
diff
:
settings
.
diff
,
ndvi
:
settings
.
ndvi
ndvi
:
settings
.
ndvi
,
lowres
:
settings
.
lowres
},
},
},[
pixels
.
buffer
]);
},[
pixels
.
buffer
]);
...
...
js/webworker.js
View file @
5d783d7f
...
@@ -12,31 +12,27 @@ self.onmessage = function(e) {
...
@@ -12,31 +12,27 @@ self.onmessage = function(e) {
var
Pixels
=
new
Uint8Array
(
e
.
data
.
pixels
);
var
Pixels
=
new
Uint8Array
(
e
.
data
.
pixels
);
if
(
Format
!=
"JPEG"
){
if
(
settings
.
lowres
==
0
){
var
reorderedPixels
=
Elphel
.
Pixels
.
reorderBlocksJPx
(
Pixels
,
W
,
H
,
Format
,
Mosaic
,
settings
.
fast
);
var
reorderedPixels
=
Elphel
.
Pixels
.
reorderBlocksJPx
(
Pixels
,
W
,
H
,
Format
,
Mosaic
,
settings
.
fast
);
//reorder first then downscale
//reorder first then downscale
if
(
settings
.
fast
){
if
(
settings
.
fast
){
W
=
W
/
2
;
W
=
W
/
2
;
H
=
H
/
2
;
H
=
H
/
2
;
}
}
Elphel
.
Pixels
.
applySaturation
(
reorderedPixels
,
W
,
H
,
2
);
postMessage
({
width
:
W
,
height
:
H
,
pixels
:
reorderedPixels
.
buffer
},[
reorderedPixels
.
buffer
]);
}
else
{
}
else
{
var
reorderedPixels
=
Elphel
.
Pixels
.
reorderBlocksJP4_lowres
(
Pixels
,
W
,
H
,
Format
,
Mosaic
,
settings
.
lowres
);
//just send back
W
=
W
/
2
;
postMessage
({
H
=
H
/
2
;
width
:
W
,
height
:
H
,
pixels
:
Pixels
.
buffer
},[
Pixels
.
buffer
]);
}
}
Elphel
.
Pixels
.
applySaturation
(
reorderedPixels
,
W
,
H
,
2
);
postMessage
({
width
:
W
,
height
:
H
,
pixels
:
reorderedPixels
.
buffer
},[
reorderedPixels
.
buffer
]);
//Elphel.test();
};
};
\ No newline at end of file
preview.html
View file @
5d783d7f
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
// init hidden canvases
// init hidden canvases
for
(
var
i
=
0
;
i
<
cams
.
length
;
i
++
){
for
(
var
i
=
0
;
i
<
cams
.
length
;
i
++
){
append_hidden_div
(
i
);
append_hidden_div
(
i
);
$
(
"#div_"
+
i
).
jp4
({
ip
:
cams
[
i
].
ip
,
port
:
cams
[
i
].
port
,
width
:
baseWidth
,
fast
:
true
});
$
(
"#div_"
+
i
).
jp4
({
ip
:
cams
[
i
].
ip
,
port
:
cams
[
i
].
port
,
width
:
baseWidth
,
fast
:
true
,
lowres
:
4
});
}
}
}
}
...
...
settings.xml
View file @
5d783d7f
...
@@ -7,10 +7,10 @@
...
@@ -7,10 +7,10 @@
<footage_limit>
3000
</footage_limit>
<footage_limit>
3000
</footage_limit>
<gpsimu_device_name>
/dev/sda1
</gpsimu_device_name>
<gpsimu_device_name>
/dev/sda1
</gpsimu_device_name>
<box_force_jp4>
checked
</box_force_jp4>
<box_force_jp4>
checked
</box_force_jp4>
<input_quality>
9
8
</input_quality>
<input_quality>
9
6
</input_quality>
<input_trigger_period>
2000
</input_trigger_period>
<input_trigger_period>
2000
</input_trigger_period>
<input_hdrvexpos>
0x36000
</input_hdrvexpos>
<input_hdrvexpos>
0x36000
</input_hdrvexpos>
<input_autoexp_max>
30
</input_autoexp_max>
<input_autoexp_max>
1
</input_autoexp_max>
<input_autoexp_lvl>
220
</input_autoexp_lvl>
<input_autoexp_lvl>
220
</input_autoexp_lvl>
<input_autoexp_fracpix>
98
</input_autoexp_fracpix>
<input_autoexp_fracpix>
98
</input_autoexp_fracpix>
<input_autoexp_frames_ahead>
1
</input_autoexp_frames_ahead>
<input_autoexp_frames_ahead>
1
</input_autoexp_frames_ahead>
...
...
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