Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perhaps two different versions of crate image are being used? #4

Open
teodargent opened this issue Apr 25, 2023 · 8 comments
Open

Perhaps two different versions of crate image are being used? #4

teodargent opened this issue Apr 25, 2023 · 8 comments

Comments

@teodargent
Copy link

teodargent commented Apr 25, 2023

Hi,
total noob here! I'm getting this error while compiling. Can anyone help?

error[E0308]: mismatched types
  --> src/qrcode.rs:31:39
   |
31 |           let barcodes = decoder.decode(&image::DynamicImage::ImageRgb8(
   |  ________________________________------_^
   | |                                |
   | |                                arguments to this method are incorrect
32 | |             ImageBuffer::from_raw(frame_img.width(), frame_img.height(), raw_img.to_owned())
33 | |                 .expect("Freshly exported image must be valid"),
34 | |         ));
   | |_________^ expected `image::dynimage::DynamicImage`, found `DynamicImage`
   |
   = note: `DynamicImage` and `image::dynimage::DynamicImage` have similar names, but are actually distinct types
note: `DynamicImage` is defined in crate `image`
  --> /Users/teo/.cargo/registry/src/github.com-1ecc6299db9ec823/image-0.23.14/./src/dynimage.rs:43:1
   |
43 | pub enum DynamicImage {
   | ^^^^^^^^^^^^^^^^^^^^^
note: `image::dynimage::DynamicImage` is defined in crate `image`
  --> /Users/teo/.cargo/registry/src/github.com-1ecc6299db9ec823/image-0.24.6/./src/dynimage.rs:57:1
   |
57 | pub enum DynamicImage {
   | ^^^^^^^^^^^^^^^^^^^^^
   = note: perhaps two different versions of crate `image` are being used?
note: method defined here
  --> /Users/teo/.cargo/registry/src/github.com-1ecc6299db9ec823/bardecoder-0.4.1/src/decoder.rs:26:12
   |
26 |     pub fn decode(&self, source: &IMG) -> Vec<Result<RESULT, Error>> {
   |            ^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `hyperbacked` due to previous error

@teodargent
Copy link
Author

An update on this. I was able to compile and run this using bardecoder = "=0.4.0" instead of bardecoder = "0.4" in the Cargo.toml file as someone on reddit suggested, more info here.

However, the Restore Backup feature does not work for me. I get this error in the terminal:

Running `target/debug/hyperbacked`
Failed to scan code!

I tried on Windows and got the same error. Although I don't have a webcam on Windows so I used Droidcam in order to use my smartphone as one. Not sure if that's compatible with Hyperbacked.

@teodargent
Copy link
Author

It looks like the issue is with nokhwa. Check the link in the comment above. @Twometer

@oneofthehorses
Copy link

It looks like the issue is with nokhwa. Check the link in the comment above. @Twometer

Hi! If it works for you at the end?

@teodargent
Copy link
Author

teodargent commented Nov 29, 2023

Hi! If it works for you at the end?

No, I used a different app in the end.

@oneofthehorses
Copy link

oneofthehorses commented Nov 30, 2023

Hi! If it works for you at the end?

No, I used a different app in the end.

Wich one if not secret ?

@Twometer
Copy link
Owner

nokhwa and image together does not seem to be very stable, I've seen such problems before.

I'll see what the latest compatible version pair is and pin it to that

@teodargent
Copy link
Author

Hi! If it works for you at the end?

No, I used a different app in the end.

Wich one if not secret ?

https://bs.parity.io/#/

Twometer added a commit that referenced this issue Jan 12, 2024
@Twometer
Copy link
Owner

I have added a Cargo.lock and locked the image versions, which should fix this problem. Can you try it again, if it works now?

Just run:

$ git pull
$ cargo clean
$ cargo run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants