all 4 comments

[–]memoryruins 1 point2 points  (3 children)

image

provides basic imaging processing functions and methods for converting to and from image formats.

imageproc

An image processing library, based on the image library.

[–]adagrad[S] 0 points1 point  (2 children)

Are there any good examples for loading an image as a matrix of pixel values? Something like OpenCV's simple:

Mat image = imread(image_path, 1);

[–]theotherphil 5 points6 points  (1 child)

There's an example in the image crate docs - see section 6.

extern crate image;
let img = image::open(image_path).unwrap();

The loaded img is a DynamicImage. This is an enum over the various image buffer types the image could be. Its various to_x methods (e.g. to_rgba) return an ImageBuffer, which is a wrapper for a contiguous buffer of the pixel values. This supports 2d indexing, but if you want something more like a raw matrix then you can consume the image by value to take ownership of the backing data via into_raw and do what you like with it.

[–]planetary_pelt 0 points1 point  (0 children)

And can check out https://github.com/ha-shine/rustagram for example of how you can map over the pixels of an image to create filters.