Coder Social home page Coder Social logo

f32 example about fast_image_resize HOT 2 CLOSED

cykooz avatar cykooz commented on June 14, 2024
f32 example

from fast_image_resize.

Comments (2)

Cykooz avatar Cykooz commented on June 14, 2024 1

ImageView is a generic struct that doesn't own the image data. It owns only vector of slices with an image rows.
Method ImageView::new() takes Vec<&[P]>, where P is generic parameter and must be one of pixel types are provided by fast_image_resize (U8, U8x2,... U8x4,... U16x4, ... F32).

Also you can create ImageView instance from following slice types:

let buffer: &[u8] = ...;
let img_view: ImageView<F32> = ImageView::from_buffer(width, height, buffer).unwrap();
let f32_pixels: &[F32] = ...;
let img_view = ImageView::from_pixels(width, height, f32_pixels).unwrap();

Result of all of these methods will be ImageView<F32>.


If you want to get a struct that owns an image data, then you may use Image struct as a simple implementation of such type of container.

let empty_image = Image::new(width, height, PixelType::F32);
...
let image_data: Vec<u8> = ...;
let image = Image::from_vec_u8(width, height, image_data, PixelType::F32).unwrap();

from fast_image_resize.

manzt avatar manzt commented on June 14, 2024

Thank you very much for the detailed explanation. I will give this a try! I appreciate you taking the time to explain this to me.

from fast_image_resize.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.