Hi again Rust community I hope everyone is good in these bad days of virus!!
Now i need help, When I run ;
use rscam::{Camera, Config};
use std::fs;
use std::io::Write;
fn main() {
let mut camera = Camera::new("/dev/video0").unwrap();
camera.start(&Config {
interval: (1, 30), // 30 fps.
resolution: (640, 480),
format: b"RGB3",
..Default::default()
}).unwrap();
for i in 0..10 {
let frame = camera.capture().unwrap();
let mut file = fs::File::create(&format!("frame-{}.jpg", i)).unwrap();
file.write_all(&frame[..]).unwrap();
}}
It executes without any problem,and its saves 10 captured images with jpg format.
But when i try opening image with eye of gnome it prints me a message ;
Could not load frame-1.jpg.
Error interpreting JPEG image file (Not a JPEG file: starts with 0xfc 0xfc)
Anyone can help me how to fix this issue ?
The example on the front page of the documentation of the rscam crate appears to be able to perform the conversion by setting the format to "MJPG". You can try that.
Well when i run with MJPG formatt it outputs me a compile error ;
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: BadResolution', src/main.rs:8:2
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace