]> OzVa Git service - rust_fft/commitdiff
Killing babies production
authorMax Value <greenwoodw50@gmail.com>
Tue, 4 Mar 2025 19:23:46 +0000 (19:23 +0000)
committerMax Value <greenwoodw50@gmail.com>
Tue, 4 Mar 2025 19:23:46 +0000 (19:23 +0000)
build.rs
src/main.rs
src/perspective.cpp

index 771e13dd883a4f04f50aae92b054ccef8b97aa35..35e6a840fd3f812dc96d80973beae02a6d2e6631 100644 (file)
--- a/build.rs
+++ b/build.rs
@@ -5,7 +5,7 @@ fn main() {
        cc::Build::new()
                .file("src/perspective.cpp")
                .cpp(true)
-               .include("/usr/share/include/opencv4/")
+               .include("/usr/include/opencv4/")
                .compile("perspective.a");
 
        println!("cargo::rustc-flags=-lopencv_core -lopencv_highgui -lopencv_xfeatures2d -lopencv_calib3d -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc -lopencv_features2d");
index b2f0cb8bfaecf98c6b4d3020d2d04c53733f2cb7..904af4f4d3e567dfebc21076a3bc16774df5470f 100644 (file)
@@ -60,10 +60,11 @@ impl ImageArray {
                        homography,
                        camera_buffer: vec![0u8; IMAGE_AREA],
 
-                       camera: Camera::new("/dev/video0").unwrap(),
+                       camera: Camera::new("/dev/video2").unwrap(),
 
                        chunks: SPECTOGRAM_AREA
                };
+
                array.camera.start(&Config {
                        interval: (1, FPS as u32),
                        resolution: (IMAGE_WIDTH as u32, IMAGE_HEIGHT as u32),
@@ -82,7 +83,7 @@ impl ImageArray {
        fn calibrate (&mut self) {
                // rscam gives and empty image if its not prompted a couple times
                for _i in 0..10 {
-                       self.camera_buffer = self.camera.capture().unwrap()[..].try_into().expect("Image is wrong size");
+                       self.camera_buffer = self.camera.capture().unwrap()[..].try_into().expect("Image is wrong size"); //delete assignment
                }
 
                // enter unsafe and get the homography array
@@ -229,14 +230,18 @@ fn main () -> Result<(), Box<dyn std::error::Error>> {
        let homography = [0f64; 9]; // homography is a 3x3 matrix of 64-bit floats
        let mut image_array = ImageArray::new(homography);
 
+       println!("registered image array");
+
        // create the debug window
        let debug_window = create_window("Debug", Default::default())?;
 
+
        // create window for displaying images and display calibration image
        let display_window = create_window("Display", Default::default())?;
-       let calibration_image = ImageReader::open("calibration.jpg")?.decode()?;
+       let calibration_image = ImageReader::open("src/calibration.jpg")?.decode()?;
        display_window.set_image("Display", calibration_image)?;
 
+
        // wait for the user to press a key before continuing
        for event in display_window.event_channel()? {
                if let event::WindowEvent::KeyboardInput(event) = event {
@@ -246,11 +251,12 @@ fn main () -> Result<(), Box<dyn std::error::Error>> {
                }
        }
 
+
        // calibrate camera
        image_array.calibrate();
 
        // open audio file
-       let mut reader = hound::WavReader::open("/home/will/Downloads/Adducci - Around the Horn.wav").unwrap();
+       let mut reader = hound::WavReader::open("/home/will/Music/Adducci - Around the Horn.wav").unwrap();
        let file_rate = reader.spec().sample_rate;
 
        // setup audio output and build output stream
index 493a61dd1b95057aa8e19b8f6af1971c76a1aaef..b88b394d904672bffacd2eb8111bd6f2eddbe188 100644 (file)
@@ -24,7 +24,7 @@ extern "C"
        {
                try
                {
-                       Mat img1 = imread( samples::findFile("calibration.jpg")/*, IMREAD_GRAYSCALE */);
+                       Mat img1 = imread( samples::findFile("src/calibration.jpg")/*, IMREAD_GRAYSCALE */);
                        Mat img2(IMAGE_HEIGHT, IMAGE_WIDTH, CV_8UC3, camera_ptr);
 
                        // detect keypoints and compute descriptors