Skip to content

Using imgproc::find_contours ? #416

@Tramac

Description

@Tramac
// gray_image_slice is slice &[u8]
let gray_image = image::GrayImage::from_raw(240, 360, gray_image_slice.to_vec()).unwrap();
// gray_image.save(&"gray_image.png");

let mut contours_cv = VectorOfVectorOfPoint::new();
imgproc::find_contours(
    &gray_image, 
    &mut contours_cv, 
    imgproc::RETR_EXTERNAL,
    imgproc::CHAIN_APPROX_SIMPLE,
    core::Point::new(0, 0),
).unwrap();

The following error occurred when compiling:
image

The gray_image is type of ImageBuffer, but imgproc::find_contours need ToInputArray, I have no idea how to convert ImageBuffer to ToInputArray format, help please.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions