Skip to content

Commit

Permalink
Grayscale Example Fixed (#218)
Browse files Browse the repository at this point in the history
* Updated Readme Grascale Example

* Updated Readme Grascale Example
  • Loading branch information
jeffin07 authored Jan 9, 2025
1 parent ca05a79 commit 3e64683
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,18 +133,36 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut gray_resized = Image::<f32, 1>::from_size_val(new_size, 0.0)?;
imgproc::resize::resize_native(
&gray, &mut gray_resized,
imgproc::resize::InterpolationMode::Bilinear,
imgproc::interpolation::InterpolationMode::Bilinear,
)?;

println!("gray_resize: {:?}", gray_resized.size());

// create a Rerun recording stream
let rec = rerun::RecordingStreamBuilder::new("Kornia App").connect()?;
let rec = rerun::RecordingStreamBuilder::new("Kornia App").spawn()?;

rec.log(
"image",
&rerun::Image::from_elements(
image_viz.as_slice(),
image_viz.size().into(),
rerun::ColorModel::RGB,
),
)?;

rec.log(
"gray",
&rerun::Image::from_elements(gray.as_slice(), gray.size().into(), rerun::ColorModel::L),
)?;

// log the images
let _ = rec.log("image", &rerun::Image::try_from(image_viz.data)?);
let _ = rec.log("gray", &rerun::Image::try_from(gray.data)?);
let _ = rec.log("gray_resize", &rerun::Image::try_from(gray_resized.data)?);
rec.log(
"gray_resize",
&rerun::Image::from_elements(
gray_resized.as_slice(),
gray_resized.size().into(),
rerun::ColorModel::L,
),
)?;

Ok(())
}
Expand Down

0 comments on commit 3e64683

Please sign in to comment.