Adaptive_threshold: expected reference `&image::buffer_::ImageBuffer<image::color::Luma<u8>, Vec<u8>>


Need help on call to adaptive_threshold:

let img3=adaptive_threshold(&imgg,1);

Issues error
= note: expected reference &image::buffer_::ImageBuffer<image::color::Luma<u8>, Vec<u8>>
found reference &ImageBuffer<Luma<u8>, Vec<u8>>
= note: perhaps two different versions of crate image are being used?

use image::GenericImageView;
use image::DynamicImage;
use std::env;
use imageproc::contrast::adaptive_threshold;

fn main() {
  let cwd = env::current_dir().unwrap();
  println!("The current directory is {}", cwd.as_os_str().to_str().unwrap().to_string());

fn img_to_text(path: &str) {
  // Use the open function to load an image from a Path.
  // `open` returns a `DynamicImage` on success.
  let mut img = image::open(path).unwrap();


  // The dimensions method returns the images width and height.
  println!("dimensions {:?}", img.dimensions());

  // The color method returns the image's `ColorType`.
  println!("{:?}", img.color());
  let width=img.width();
  let height = img.height();

  let img2 = image::imageops::crop(&mut img,40,40,width-80,height-80).to_image();
  println!("crop dimensions {:?}", img2.dimensions());

  let imgg = DynamicImage::ImageRgba8(img2).into_luma8();
  // The color method returns the image's `ColorType`.
  // println!("{:?}", gray.color());

//  = note: expected reference `&image::buffer_::ImageBuffer<image::color::Luma<u8>, Vec<u8>>`
//  found reference `&ImageBuffer<Luma<u8>, Vec<u8>>`
// = note: perhaps two different versions of crate `image` are being used?
  let img3=adaptive_threshold(&imgg,1);

  // Write the contents of this image to the Writer in PNG format.
image = "0.22.0"
imageproc = "0.22.0"

The DynamicImage::into_luma8() method didn't exist until image 0.23.12. Try writing image = "0.23.12" in your [dependencies] and running cargo update. Does that fix the issue?

Thank you !
Fixed using

image = "0.24.1"
imageproc = { git = "" }

and into_luma8