Skip to content

Commit

Permalink
Merge pull request #160 from Sensing-Dev/example/update-bb-input-type
Browse files Browse the repository at this point in the history
updated the gain/exposuretime type
  • Loading branch information
iitaku authored Nov 30, 2023
2 parents 4db0c31 + 883ecac commit de782b2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions example/u3v_camera1_opencv/u3v_camera1_opencv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ using namespace ion;
// Resize it according to the resolution of the sensor.
const int32_t width = 640;
const int32_t height = 480;
int32_t gain = 400;
int32_t exposure = 400;
double gain = 400;
double exposure = 400;

#ifdef _WIN32
#define MODULE_NAME "ion-bb.dll"
Expand Down Expand Up @@ -54,10 +54,10 @@ int main(int argc, char *argv[])
// Define the input port
// Port class is used to define dynamic I/O for each node.
Port dispose_p{ "dispose", Halide::type_of<bool>() };
Port gain0_p{ "gain0", Halide::type_of<int32_t>() };
Port gain1_p{ "gain1", Halide::type_of<int32_t>() };
Port exposure0_p{ "exposure0", Halide::type_of<int32_t>() };
Port exposure1_p{ "exposure1", Halide::type_of<int32_t>() };
Port gain0_p{ "gain0", Halide::type_of<double>() };
Port gain1_p{ "gain1", Halide::type_of<double>() };
Port exposure0_p{ "exposure0", Halide::type_of<double>() };
Port exposure1_p{ "exposure1", Halide::type_of<double>() };

// Connect the input port to the Node instance created by b.add().
Node n = b.add("image_io_u3v_camera1_u16x2")(dispose_p, gain0_p, exposure0_p)
Expand Down
6 changes: 3 additions & 3 deletions example/u3v_camera1_opencv/u3v_camera1_opencv.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# Port class would be used to define dynamic O/O for each node.
t = Type(TypeCode.Uint, 1, 1)
dispose_p = Port('dispose', t, 0)
t = Type(TypeCode.Int, 32, 1)
t = Type(TypeCode.Float, 64, 1)
gain0_p = Port('gain0', t, 0)
exposure0_p = Port('exposure0', t, 0)

Expand All @@ -59,8 +59,8 @@
port_map = PortMap()

# input values
port_map.set_i32(gain0_p, gain)
port_map.set_i32(exposure0_p, exposure)
port_map.set_f64(gain0_p, gain)
port_map.set_f64(exposure0_p, exposure)

# output values
buf_size = (width, height, )
Expand Down
12 changes: 6 additions & 6 deletions example/u3v_camera2_opencv/u3v_camera2_opencv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ using namespace ion;
// Resize it according to the resolution of the sensor.
const int32_t width = 1920;
const int32_t height = 1080;
int32_t gain = 400;
int32_t exposure = 400;
double gain = 400;
double exposure = 400;

#ifdef _WIN32
#define MODULE_NAME "ion-bb.dll"
Expand Down Expand Up @@ -54,10 +54,10 @@ int main(int argc, char *argv[])
// Define the input port
// Port class is used to define dynamic I/O for each node.
Port dispose_p{ "dispose", Halide::type_of<bool>() };
Port gain0_p{ "gain0", Halide::type_of<int32_t>() };
Port gain1_p{ "gain1", Halide::type_of<int32_t>() };
Port exposure0_p{ "exposure0", Halide::type_of<int32_t>() };
Port exposure1_p{ "exposure1", Halide::type_of<int32_t>() };
Port gain0_p{ "gain0", Halide::type_of<double>() };
Port gain1_p{ "gain1", Halide::type_of<double>() };
Port exposure0_p{ "exposure0", Halide::type_of<double>() };
Port exposure1_p{ "exposure1", Halide::type_of<double>() };

// Connect the input port to the Node instance created by b.add().
Node n = b.add("image_io_u3v_camera2_u16x2")(dispose_p, gain0_p, gain1_p, exposure0_p, exposure1_p)
Expand Down
10 changes: 5 additions & 5 deletions example/u3v_camera2_opencv/u3v_camera2_opencv.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# Port class would be used to define dynamic O/O for each node.
t = Type(TypeCode.Uint, 1, 1)
dispose_p = Port('dispose', t, 0)
t = Type(TypeCode.Int, 32, 1)
t = Type(TypeCode.Float, 64, 1)
gain0_p = Port('gain0', t, 0)
gain1_p = Port('gain1', t, 0)
exposure0_p = Port('exposure0', t, 0)
Expand Down Expand Up @@ -62,10 +62,10 @@
port_map = PortMap()

# input values
port_map.set_i32(gain0_p, gain)
port_map.set_i32(gain1_p, gain)
port_map.set_i32(exposure0_p, exposure)
port_map.set_i32(exposure1_p, exposure)
port_map.set_f64(gain0_p, gain)
port_map.set_f64(gain1_p, gain)
port_map.set_f64(exposure0_p, exposure)
port_map.set_f64(exposure1_p, exposure)

# output values
buf_size = (width, height, )
Expand Down

0 comments on commit de782b2

Please sign in to comment.