Skip to content

Commit 0819f67

Browse files
committed
s: Add simple example
Something needs to compile the sys crate for the requested target or the make target for the bindings file will not work.
1 parent 6c6d751 commit 0819f67

File tree

6 files changed

+71
-1
lines changed

6 files changed

+71
-1
lines changed

Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps-aarch64.checksum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ adbf3ad9c2af82886e5a3aefef58e05296d89b2f target-aarch64/acap/consume_analytics_
66
16310c12bb50db85d69c744d13c93ebf0c628953 target-aarch64/acap/embedded_web_page_0_0_0_aarch64.eap
77
ad7eaec0d3ad651fa3e6aee874f5d5d70a687c9e target-aarch64/acap/event_subscribe_1_0_0_aarch64.eap
88
1fc3cae517186fe2697bb92a6e1e1f2114da1fe1 target-aarch64/acap/hello_world_0_0_0_aarch64.eap
9-
e90ac26398107f9e9458296cf62f22362f038619 target-aarch64/acap/inspect_env_0_0_0_aarch64.eap
9+
e76203e6d34370cb4a3922f46d1c71ae3bd6f18d target-aarch64/acap/inspect_env_0_0_0_aarch64.eap
1010
2ab612a20c88a7a7bc606724d73560d2e3bee3bc target-aarch64/acap/licensekey_handler_0_0_0_aarch64.eap
11+
edddaf543f69182c974f625530105cf64ee7ec6b target-aarch64/acap/object_detection_1_0_0_aarch64.eap
1112
d0d8f34a79c037b9f9ad8a15c39bc62330426a7e target-aarch64/acap/reverse_proxy_0_0_0_aarch64.eap
1213
8ce0692d6d4eb41d335533e5bedf2dfa35ca890d target-aarch64/acap/send_event_1_0_0_aarch64.eap
1314
9df8dead66b245aa19d3aafa758871118b8cc25f target-aarch64/acap/using_a_build_script_0_0_0_aarch64.eap

apps-aarch64.filesize

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
1947 target-aarch64/acap/hello_world_0_0_0_aarch64.eap
99
1982 target-aarch64/acap/inspect_env_0_0_0_aarch64.eap
1010
1969 target-aarch64/acap/licensekey_handler_0_0_0_aarch64.eap
11+
1950 target-aarch64/acap/object_detection_1_0_0_aarch64.eap
1112
10873 target-aarch64/acap/reverse_proxy_0_0_0_aarch64.eap
1213
3982 target-aarch64/acap/send_event_1_0_0_aarch64.eap
1314
899 target-aarch64/acap/using_a_build_script_0_0_0_aarch64.eap

apps/object_detection/Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[package]
2+
name = "object_detection"
3+
version = "0.0.0"
4+
edition.workspace = true
5+
publish = false
6+
7+
[dependencies]
8+
anyhow = { workspace = true }
9+
log = { workspace = true }
10+
11+
acap-logging = { workspace = true }
12+
larod-sys = { workspace = true }
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"schemaVersion": "1.4.0",
3+
"acapPackageConf": {
4+
"setup": {
5+
"appName": "object_detection",
6+
"vendor": "Axis Communications",
7+
"runMode": "never",
8+
"version": "1.0.0"
9+
}
10+
}
11+
}

apps/object_detection/src/main.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//! This application loads a larod model which takes an image as input and outputs values
2+
//! corresponding to the class, score and location of detected objects in the image.
3+
//!
4+
//! # Arguments
5+
//!
6+
//! 1. `MODEL`: a string describing the path to the model.
7+
//! 2. `WIDTH`: an integer for the input width. ß
8+
//! 3. `HEIGHT`: an integer for the input height.
9+
//! 4. `QUALITY`: an integer for the desired jpeg quality.
10+
//! 5. `RAW_WIDTH`: an integer for camera width resolution.
11+
//! 6. `RAW_HEIGHT`: an integer for camera height resolution.
12+
//! 7. `THRESHOLD`: an integer ranging from 0 to 100 to select good detections.
13+
//! 8. `LABELSFILE`: a string describing the path to the label txt.
14+
15+
use log::{error, info};
16+
17+
fn main() {
18+
acap_logging::init_logger();
19+
let mut conn: *mut larod_sys::larodConnection = std::ptr::null_mut();
20+
let mut error: *mut larod_sys::larodError = std::ptr::null_mut();
21+
if unsafe{!larod_sys::larodConnect(&mut conn, &mut error)} {
22+
error!("Could not connect to larod");
23+
return;
24+
}
25+
assert!(error.is_null());
26+
27+
let mut num_sessions = u64::MAX;
28+
if unsafe{!larod_sys::larodGetNumSessions(conn, &mut num_sessions, &mut error)} {
29+
error!("Could not get the number of sessions");
30+
return;
31+
}
32+
33+
info!("Number of sessions: {num_sessions}");
34+
todo!("Implement the real example")
35+
}

0 commit comments

Comments
 (0)