Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ bbox-sys = { path = "crates/bbox-sys" }
cargo-acap-build = { path = "crates/cargo-acap-build" }
cli-version = { path = "crates/cli-version" }
device-manager = { path = "crates/device-manager" }
larod-sys = { path = "crates/larod-sys" }
licensekey = { path = "crates/licensekey" }
licensekey-sys = { path = "crates/licensekey-sys" }
mdb = { path = "crates/mdb" }
Expand Down
1 change: 1 addition & 0 deletions apps-aarch64.checksum
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dfd925c003c30164c00dfc51676b6e1317a0fa6d target-aarch64/acap/consume_analytics_
5712d955c8ea45a774597a6032a16af72a24e118 target-aarch64/acap/hello_world_0_0_0_aarch64.eap
222f821339cf36e88596d85427740de3536573bf target-aarch64/acap/inspect_env_0_0_0_aarch64.eap
74d6106b8f0afe7e3342ae3b470d8b81e7aa5150 target-aarch64/acap/licensekey_handler_0_0_0_aarch64.eap
9deb95dbb3d67596d9f7cbc2aa05b3fb4d812025 target-aarch64/acap/object_detection_1_0_0_aarch64.eap
5dc0969dcbe6ca09aabcef9530a0f77786932b22 target-aarch64/acap/reverse_proxy_0_0_0_aarch64.eap
c94b3ba49a3897617dc13599ffbc0642681133e5 target-aarch64/acap/send_event_1_0_0_aarch64.eap
9df8dead66b245aa19d3aafa758871118b8cc25f target-aarch64/acap/using_a_build_script_0_0_0_aarch64.eap
Expand Down
1 change: 1 addition & 0 deletions apps-aarch64.filesize
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
1406 target-aarch64/acap/hello_world_0_0_0_aarch64.eap
1441 target-aarch64/acap/inspect_env_0_0_0_aarch64.eap
1430 target-aarch64/acap/licensekey_handler_0_0_0_aarch64.eap
1408 target-aarch64/acap/object_detection_1_0_0_aarch64.eap
10362 target-aarch64/acap/reverse_proxy_0_0_0_aarch64.eap
3430 target-aarch64/acap/send_event_1_0_0_aarch64.eap
899 target-aarch64/acap/using_a_build_script_0_0_0_aarch64.eap
Expand Down
12 changes: 12 additions & 0 deletions apps/object_detection/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "object_detection"
version = "0.0.0"
edition.workspace = true
publish = false

[dependencies]
anyhow = { workspace = true }
log = { workspace = true }

acap-logging = { workspace = true }
larod-sys = { workspace = true }
11 changes: 11 additions & 0 deletions apps/object_detection/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"schemaVersion": "1.4.0",
"acapPackageConf": {
"setup": {
"appName": "object_detection",
"vendor": "Axis Communications",
"runMode": "never",
"version": "1.0.0"
}
}
}
35 changes: 35 additions & 0 deletions apps/object_detection/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//! This application loads a larod model which takes an image as input and outputs values
//! corresponding to the class, score and location of detected objects in the image.
//!
//! # Arguments
//!
//! 1. `MODEL`: a string describing the path to the model.
//! 2. `WIDTH`: an integer for the input width. ß
//! 3. `HEIGHT`: an integer for the input height.
//! 4. `QUALITY`: an integer for the desired jpeg quality.
//! 5. `RAW_WIDTH`: an integer for camera width resolution.
//! 6. `RAW_HEIGHT`: an integer for camera height resolution.
//! 7. `THRESHOLD`: an integer ranging from 0 to 100 to select good detections.
//! 8. `LABELSFILE`: a string describing the path to the label txt.

use log::{error, info};

fn main() {
acap_logging::init_logger();
let mut conn: *mut larod_sys::larodConnection = std::ptr::null_mut();
let mut error: *mut larod_sys::larodError = std::ptr::null_mut();
if unsafe { !larod_sys::larodConnect(&mut conn, &mut error) } {
error!("Could not connect to larod");
return;
}
assert!(error.is_null());

let mut num_sessions = u64::MAX;
if unsafe { !larod_sys::larodGetNumSessions(conn, &mut num_sessions, &mut error) } {
error!("Could not get the number of sessions");
return;
}

info!("Number of sessions: {num_sessions}");
todo!("Implement the real example")
}
10 changes: 10 additions & 0 deletions crates/larod-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
build = "build.rs"
name = "larod-sys"
version = "0.0.0"
edition.workspace = true
license = "MIT"

[build-dependencies]
bindgen = { workspace = true }
pkg-config = { workspace = true }
27 changes: 27 additions & 0 deletions crates/larod-sys/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use std::{env, path};

fn populated_bindings(dst: &path::PathBuf) {
let library = pkg_config::Config::new().probe("liblarod").unwrap();
let mut bindings = bindgen::Builder::default()
.header("wrapper.h")
.allowlist_recursively(false)
.allowlist_function("^(larod.*)$")
.allowlist_type("^(_?larod.*)$")
.default_enum_style(bindgen::EnumVariation::NewType {
is_global: false,
is_bitfield: true,
})
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
.layout_tests(false);
for path in library.include_paths {
bindings = bindings.clang_args(&["-F", path.to_str().unwrap()]);
}
bindings.generate().unwrap().write_to_file(dst).unwrap();
}

fn main() {
let dst = path::PathBuf::from(env::var("OUT_DIR").unwrap()).join("bindings.rs");
if env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default() != "x86_64" {
populated_bindings(&dst);
}
}
Loading