Skip to content

Commit

Permalink
Merge branch 'main' into fix/bb_name_revise
Browse files Browse the repository at this point in the history
  • Loading branch information
richardfixstars committed Sep 10, 2024
2 parents 47656f5 + 767b6ad commit d3a8a4f
Show file tree
Hide file tree
Showing 128 changed files with 20,081 additions and 18,997 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
SortIncludes: false
SpaceBeforeParens: ControlStatements
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/python_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,14 @@ jobs:
cp windows/bin/Halide.dll python/ionpy/module/windows/Halide.dll
cp windows/bin/ion-core.dll python/ionpy/module/windows/ion-core.dll
cp windows/bin/ion-bb.dll python/ionpy/module/windows/ion-bb.dll
mkdir aravis
curl -L https://github.com/Sensing-Dev/aravis/releases/download/v0.8.31/aravis-0.8.31-x86-64-windows.zip -o aravis/aravis-bin.zip
cd aravis && tar -xf aravis-bin.zip && cd ../
curl -L https://github.com/Sensing-Dev/aravis/releases/download/v0.8.31/aravis-0.8.31-x86-64-windows.zip -o aravis-bin.zip
tar -xf aravis-bin.zip
cp aravis/bin/aravis-0.8-0.dll python/ionpy/module/windows/aravis-0.8-0.dll
mkdir dependency
curl -L https://github.com/Sensing-Dev/aravis/releases/download/v0.8.31/aravis-0.8.31-dependencies.zip -o dependency/dependency-bin.zip
cd dependency && tar -xf dependency-bin.zip && cd ../
mv dependency/*.dll python/ionpy/module/windows/
curl -L https://github.com/Sensing-Dev/aravis/releases/download/v0.8.31/aravis-0.8.31-dependencies.zip -o dependency-bin.zip
tar -xf dependency-bin.zip
mv aravis_dependencies/bin/*.dll python/ionpy/module/windows/
ls python/ionpy/module/windows
Expand Down
5 changes: 2 additions & 3 deletions example/demo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) {
// IMX219
Node imx = b.add("image_io_imx219")
.set_params(Param("index", i),
Param("url", "http://ion-kit.s3.us-west-2.amazonaws.com/images/pedestrian.png"));
Param("url", "http://ion-kit.s3.us-west-2.amazonaws.com/images/pedestrian.png"));

// ISP
Node downscale = b.add("image_processing_bayer_downscale_uint16")
Expand Down Expand Up @@ -205,7 +205,6 @@ int main(int argc, char *argv[]) {
d435["output_d"].bind(depth_buf);
sgm["output"].bind(sgm_buf);


{
// Execution execution
b.run();
Expand All @@ -220,7 +219,7 @@ int main(int argc, char *argv[]) {
// cv::imwrite("demo-depth.png", depth_img);
cv::imwrite("demo-sgm.png", sgm_img);
cv::imwrite("demo-yolo.png", yolo_img);
std::cout<<"Passed"<<std::endl;
std::cout << "Passed" << std::endl;
}

} catch (const std::exception &e) {
Expand Down
2 changes: 1 addition & 1 deletion example/demo_compile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) {
// IMX219
Node imx = b.add("image_io_imx219")
.set_params(Param{"index", std::to_string(i)},
Param{"url", "http://ion-kit.s3.us-west-2.amazonaws.com/images/pedestrian.png"});
Param{"url", "http://ion-kit.s3.us-west-2.amazonaws.com/images/pedestrian.png"});

// ISP
Node downscale = b.add("image_processing_bayer_downscale_uint16")
Expand Down
7 changes: 3 additions & 4 deletions example/fpga_dnn_compile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ int main(int argc, char *argv[]) {
Node n;
n = b.add("image_io_color_data_loader").set_params(Param{"url", "http://ion-kit.s3.us-west-2.amazonaws.com/images/pedestrian.jpg"});
n = b.add("fpga_normalize_3d_chw_uint8")
.set_params(
Param{"width", "512"},
Param{"height", "512"}
)(n["output"]);
.set_params(
Param{"width", "512"},
Param{"height", "512"})(n["output"]);
n = b.add("base_reorder_buffer_3d_float")(n["output"]).set_params(Param{"dim0", "2"}, Param{"dim1", "0"}, Param{"dim2", "1"}); // CHW -> HWC
n = b.add("dnn_object_detection")(n["output"]);
n = b.add("base_denormalize_3d_uint8")(n["output"]);
Expand Down
2 changes: 1 addition & 1 deletion example/gender_count.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int main(int argc, char *argv[]) {
out_p1.bind(out1);
Halide::Buffer<int32_t> out2 = Halide::Buffer<int32_t>::make_scalar();
out_p2.bind(out2);
for (int i=0; i<100; ++i) {
for (int i = 0; i < 100; ++i) {
b.run();
}
} catch (const std::exception &e) {
Expand Down
9 changes: 4 additions & 5 deletions example/imx219_isp_display.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int main(int argc, char *argv[]) {
constexpr int32_t num = 2;
Node n;
Node ns[num];
for (int i=0; i<num; ++i) {
for (int i = 0; i < num; ++i) {
n = b.add("image_io_imx219").set_params(Param("index", i));
n = b.add("image_processing_bayer_downscale_uint16")(n["output"]).set_params(Param("input_width", width_v), Param("input_height", height_v), Param("downscale_factor", "2"));
n = b.add("image_processing_normalize_raw_image")(n["output"]).set_params(Param("bit_width", "10"), Param("bit_shift", "6"));
Expand All @@ -46,21 +46,20 @@ int main(int argc, char *argv[]) {

b.save("graph.json");

for (int i=0; i<100; ++i) {
for (int i = 0; i < 100; ++i) {
b.run();
std::cout << "." << std::flush;
}

} catch (Halide::Error& e) {
} catch (Halide::Error &e) {
std::cerr << e.what() << std::endl;
return 1;
} catch (const std::exception& e) {
} catch (const std::exception &e) {
std::cerr << e.what() << std::endl;
return 1;
}

std::cout << "Passed" << std::endl;


return 0;
}
168 changes: 84 additions & 84 deletions example/isp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,108 +79,108 @@ int main(int argc, char *argv[]) {
Node debug_output;

loader = b.add("image_io_grayscale_data_loader")
.set_params(
Param("width", 3264),
Param("height", 2464),
Param("url", "http://ion-kit.s3.us-west-2.amazonaws.com/images/IMX219-3264x2464-RG10.raw"));
.set_params(
Param("width", 3264),
Param("height", 2464),
Param("url", "http://ion-kit.s3.us-west-2.amazonaws.com/images/IMX219-3264x2464-RG10.raw"));

normalize = b.add("image_processing_normalize_raw_image")
.set_params(
Param("bit_width", 10),
Param("bit_shift", 0))(
loader["output"]);
.set_params(
Param("bit_width", 10),
Param("bit_shift", 0))(
loader["output"]);

offset = b.add("image_processing_bayer_offset")
.set_params(
bayer_pattern)(
&offset_r,
&offset_g,
&offset_b,
normalize["output"]);
.set_params(
bayer_pattern)(
&offset_r,
&offset_g,
&offset_b,
normalize["output"]);

shading_correction = b.add("image_processing_lens_shading_correction_linear")
.set_params(
bayer_pattern,
Param("width", width),
Param("height", height))(
&shading_correction_slope_r,
&shading_correction_slope_g,
&shading_correction_slope_b,
&shading_correction_offset_r,
&shading_correction_offset_g,
&shading_correction_offset_b,
offset["output"]);
.set_params(
bayer_pattern,
Param("width", width),
Param("height", height))(
&shading_correction_slope_r,
&shading_correction_slope_g,
&shading_correction_slope_b,
&shading_correction_offset_r,
&shading_correction_offset_g,
&shading_correction_offset_b,
offset["output"]);
white_balance = b.add("image_processing_bayer_white_balance")
.set_params(
bayer_pattern)(
&gain_r,
&gain_g,
&gain_b,
shading_correction["output"]);
.set_params(
bayer_pattern)(
&gain_r,
&gain_g,
&gain_b,
shading_correction["output"]);
demosaic = b.add("image_processing_bayer_demosaic_filter")
.set_params(
bayer_pattern,
Param("width", width),
Param("height", height))(
white_balance["output"]);
.set_params(
bayer_pattern,
Param("width", width),
Param("height", height))(
white_balance["output"]);
luminance = b.add("image_processing_calc_luminance")
.set_params(
Param("luminance_method", "Average"))(
demosaic["output"]);
.set_params(
Param("luminance_method", "Average"))(
demosaic["output"]);
luminance_filter = b.add("base_constant_buffer_2d_float")
.set_params(
Param("values", 0.04),
Param("extent0", 5),
Param("extent1", 5));
.set_params(
Param("values", 0.04),
Param("extent0", 5),
Param("extent1", 5));
filtered_luminance = b.add("image_processing_convolution_2d")
.set_params(
Param("boundary_conditions_method", "MirrorInterior"),
Param("window_size", 2),
Param("width", width),
Param("height", height))(
luminance_filter["output"],
luminance["output"]);
.set_params(
Param("boundary_conditions_method", "MirrorInterior"),
Param("window_size", 2),
Param("width", width),
Param("height", height))(
luminance_filter["output"],
luminance["output"]);
noise_reduction = b.add("image_processing_bilateral_filter_3d")
.set_params(
Param("color_difference_method", "Average"),
Param("window_size", 2),
Param("width", width),
Param("height", height))(
&coef_color,
&coef_space,
filtered_luminance["output"],
demosaic["output"]);
.set_params(
Param("color_difference_method", "Average"),
Param("window_size", 2),
Param("width", width),
Param("height", height))(
&coef_color,
&coef_space,
filtered_luminance["output"],
demosaic["output"]);
color_matrix = b.add("base_constant_buffer_2d_float")
.set_params(
Param{"values", "2.20213000 -1.27425000 0.07212000 "
"-0.25650000 1.45961000 -0.20311000 "
"0.07458000 -1.35791000 2.28333000"},
Param("extent0", 3),
Param("extent1", 3));
.set_params(
Param{"values", "2.20213000 -1.27425000 0.07212000 "
"-0.25650000 1.45961000 -0.20311000 "
"0.07458000 -1.35791000 2.28333000"},
Param("extent0", 3),
Param("extent1", 3));
color_conversion = b.add("image_processing_color_matrix")(
color_matrix["output"],
noise_reduction["output"]);
distortion_correction = b.add("image_processing_lens_distortion_correction_model_3d")
.set_params(
Param("width", width),
Param("height", height))(
&k1,
&k2,
&k3,
&p1,
&p2,
&fx,
&fy,
&cx,
&cy,
&output_scale,
color_conversion["output"]);
.set_params(
Param("width", width),
Param("height", height))(
&k1,
&k2,
&k3,
&p1,
&p2,
&fx,
&fy,
&cx,
&cy,
&output_scale,
color_conversion["output"]);
resize = b.add("image_processing_resize_area_average_3d")
.set_params(
Param("width", width),
Param("height", height),
Param("scale", resize_scale))(
distortion_correction["output"]);
.set_params(
Param("width", width),
Param("height", height),
Param("scale", resize_scale))(
distortion_correction["output"]);
gamma_correction = b.add("image_processing_gamma_correction_3d")(
&gamma,
resize["output"]);
Expand Down
16 changes: 8 additions & 8 deletions example/isp_and_sgm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ int main(int argc, char *argv[]) {
Node color_matrix_r, color_conversion_r, gamma_correction_r, distortion_lut_r, distortion_correction_r, resize_r, final_luminance_r;

loader = b.add("image_io_grayscale_data_loader")
.set_params(
Param("width", raw_width),
Param("height", raw_height),
Param("url", "http://ion-kit.s3.us-west-2.amazonaws.com/images/OV5647x2-5184x1944-GB10.raw"));
.set_params(
Param("width", raw_width),
Param("height", raw_height),
Param("url", "http://ion-kit.s3.us-west-2.amazonaws.com/images/OV5647x2-5184x1944-GB10.raw"));

normalize = b.add("image_processing_normalize_raw_image")
.set_params(
Param("bit_width", "10"),
Param("bit_shift", "6"))(
loader["output"]);
.set_params(
Param("bit_width", "10"),
Param("bit_shift", "6"))(
loader["output"]);

crop_l = b.add("image_processing_crop_image_2d_float")
.set_params(
Expand Down
7 changes: 3 additions & 4 deletions example/opencv_bb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ int main(int argc, char *argv[]) {
n = b.add("opencv_display")(n["output"]);

Halide::Buffer<uint8_t> in_buf(3, width, height);
for (int y=0; y<height; ++y) {
for (int x=0; x<width; ++x) {
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
in_buf(0, x, y) = y * width + x;
in_buf(1, x, y) = y * width + x;
in_buf(2, x, y) = y * width + x;
Expand All @@ -28,11 +28,10 @@ int main(int argc, char *argv[]) {

Halide::Buffer<int32_t> r = Halide::Buffer<int32_t>::make_scalar();


in.bind(in_buf);
n["output"].bind(r);

for (int i=0; i<1000; ++i) {
for (int i = 0; i < 1000; ++i) {
b.run();
}

Expand Down
Loading

0 comments on commit d3a8a4f

Please sign in to comment.