Skip to content

How to resize image with keep length-width ratio? #6256

@zengjie617789

Description

@zengjie617789

I want to resize a face with keep length-width ration and paste it into a target size image with padding zero.
I use the code below, but I donot know how to paste it into a target size image fastly

 scale_size = min_side / 640.0;
            int target_w = image_w / scale_size;
            int target_h = image_h / scale_size;
            in_resized = ncnn::Mat::from_pixels_resize(cv_mat_in.data,
                                                       ncnn::Mat::PIXEL_RGB, image_w, image_h,
                                                       target_w,
                                                       target_h);

Anyone who can help will be appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions