diff --git a/juno_samples/edge_detection/Cargo.toml b/juno_samples/edge_detection/Cargo.toml
index fc5fb451f277897cd3fa5004f953380ee2ed2f46..483724d8e4c2c7bcd057990ce5e149923e90cc3b 100644
--- a/juno_samples/edge_detection/Cargo.toml
+++ b/juno_samples/edge_detection/Cargo.toml
@@ -15,7 +15,6 @@ required-features = ["opencv"]
 
 [lib]
 path = "src/lib.rs"
-required-features = ["opencv"]
 
 [build-dependencies]
 juno_build = { path = "../../juno_build" }
diff --git a/juno_samples/edge_detection/src/lib.rs b/juno_samples/edge_detection/src/lib.rs
index 37268b561f2c0104a89f097b88abde5d3a34692a..6c2a15bd394a8fed3828ea79f2f8470856ead846 100644
--- a/juno_samples/edge_detection/src/lib.rs
+++ b/juno_samples/edge_detection/src/lib.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "opencv")]
 #![feature(concat_idents)]
 
 mod edge_detection_rust;