Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
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
imagej-elphel
Commits
c40c2e9e
Commit
c40c2e9e
authored
Dec 14, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding sennor_port to Eyesis correction
parent
200313d9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
PixelMapping.java
src/main/java/PixelMapping.java
+51
-0
No files found.
src/main/java/PixelMapping.java
View file @
c40c2e9e
...
@@ -25,10 +25,14 @@
...
@@ -25,10 +25,14 @@
**
**
*/
*/
import
java.awt.Point
;
import
java.awt.Rectangle
;
import
java.awt.Rectangle
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.BitSet
;
import
java.util.BitSet
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.concurrent.atomic.AtomicInteger
;
...
@@ -147,6 +151,8 @@ public class PixelMapping {
...
@@ -147,6 +151,8 @@ public class PixelMapping {
return
(
this
.
sensors
!=
null
)
&&
(
channel
>=
0
)
&&
(
channel
<
this
.
sensors
.
length
)
&&
(
this
.
sensors
[
channel
]!=
null
);
return
(
this
.
sensors
!=
null
)
&&
(
channel
>=
0
)
&&
(
channel
<
this
.
sensors
.
length
)
&&
(
this
.
sensors
[
channel
]!=
null
);
}
}
/*
public int [] channelsForSubCamera(int subCamera){
public int [] channelsForSubCamera(int subCamera){
if (this.sensors == null) return null;
if (this.sensors == null) return null;
int numChannels=0;
int numChannels=0;
...
@@ -156,6 +162,51 @@ public class PixelMapping {
...
@@ -156,6 +162,51 @@ public class PixelMapping {
for (int i=0;i<this.sensors.length;i++) if ((this.sensors[i]!=null) &&(this.sensors[i].subcamera==subCamera)) result[numChannels++]=i;
for (int i=0;i<this.sensors.length;i++) if ((this.sensors[i]!=null) &&(this.sensors[i].subcamera==subCamera)) result[numChannels++]=i;
return result;
return result;
}
}
*/
// Updating for nc393. subCamera here is 0..9 for Eyesis4pi393 - 0-based index of the file, so it combines physical camera (separate IP)
// as stored in "subcamera" field of the calibration file and "sensor_port". sensor_port may start from non-0, so we need to count all combinations
public
int
[]
channelsForSubCamera
(
int
subCamera
){
// ArrayList<ArrayList<ArrayList<Integer>>> camera_IPs = new ArrayList<ArrayList<ArrayList<Integer>>>();
ArrayList
<
Point
>
cam_port
=
new
ArrayList
<
Point
>();
for
(
int
i
=
0
;
i
<
this
.
sensors
.
length
;
i
++)
if
(
this
.
sensors
[
i
]!=
null
)
{
Point
cp
=
new
Point
(
this
.
sensors
[
i
].
subcamera
,
this
.
sensors
[
i
].
sensor_port
);
if
(!
cam_port
.
contains
(
cp
)){
cam_port
.
add
(
cp
);
}
}
Point
[]
cam_port_arr
=
cam_port
.
toArray
(
new
Point
[
0
]);
Arrays
.
sort
(
cam_port_arr
,
new
Comparator
<
Point
>()
{
@Override
public
int
compare
(
Point
o1
,
Point
o2
)
{
return
(
o1
.
x
>
o2
.
x
)?
1
:((
o1
.
x
<
o2
.
x
)?-
1
:(
o1
.
y
>
o2
.
y
)?
1
:((
o1
.
y
<
o2
.
y
)?-
1
:
0
));
}
});
for
(
int
i
=
0
;
i
<
cam_port_arr
.
length
;
i
++){
System
.
out
.
println
(
"----- physical camera #"
+
cam_port_arr
[
i
].
x
+
", sensor_port="
+
cam_port_arr
[
i
].
y
);
}
System
.
out
.
println
(
"----- This ("
+
subCamera
+
") physical camera #"
+
cam_port_arr
[
subCamera
].
x
+
", sensor_port="
+
cam_port_arr
[
subCamera
].
y
);
if
(
subCamera
>=
cam_port_arr
.
length
)
{
System
.
out
.
println
(
"Error: Subcamera "
+
subCamera
+
" > that total namera of sensor ports in the system = "
+
cam_port_arr
.
length
);
return
null
;
}
if
(
this
.
sensors
==
null
)
return
null
;
int
numChannels
=
0
;
for
(
int
i
=
0
;
i
<
this
.
sensors
.
length
;
i
++)
if
(
this
.
sensors
[
i
]!=
null
)
{
if
(
new
Point
(
this
.
sensors
[
i
].
subcamera
,
this
.
sensors
[
i
].
sensor_port
).
equals
(
cam_port_arr
[
subCamera
]))
numChannels
++;
}
int
[]
result
=
new
int
[
numChannels
];
numChannels
=
0
;
for
(
int
i
=
0
;
i
<
this
.
sensors
.
length
;
i
++)
if
(
this
.
sensors
[
i
]!=
null
){
if
(
new
Point
(
this
.
sensors
[
i
].
subcamera
,
this
.
sensors
[
i
].
sensor_port
).
equals
(
cam_port_arr
[
subCamera
]))
result
[
numChannels
++]=
i
;
}
return
result
;
}
public
void
removeChannel
(
int
channel
){
public
void
removeChannel
(
int
channel
){
if
((
this
.
sensors
!=
null
)
&&
(
channel
>=
0
)
&&
(
channel
<
this
.
sensors
.
length
))
this
.
sensors
[
channel
]=
null
;
if
((
this
.
sensors
!=
null
)
&&
(
channel
>=
0
)
&&
(
channel
<
this
.
sensors
.
length
))
this
.
sensors
[
channel
]=
null
;
}
}
...
...
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