Copying a part of Simd::View

149 views Asked by At

I use Simd::View class from Simd Library. It is a container which holds an image. I need to copy a part (the right bottom corner) of image into another image.

As I know there is a function Simd::Copy which allows to copy one image to other. But it copies image as whole. Of course I could write my own function to do this. But maybe anybody know any good-looking solution of this question?

2

There are 2 answers

1
Akira On BEST ANSWER

I would recommend to use method Simd::View::Region. It returns reference to subregion in given image. So you can easy copy this subregion with using of Simd::Copy:

#include "Simd/SimdLib.hpp"

int main()
{
    typedef Simd::View<Simd::Allocator> View;
    View a(200, 200, View::Gray8);
    View b(100, 100, View::Gray8);
    // Copying of a part (the rigth bottom corner) of image a to the image b:
    Simd::Copy(a.Region(b.Size(), View::RightBottom), b);
    return 0;
}
2
FutureJJ On

There is a function named Simd::CopyFrame which accepts source, bounding frame and destination as input parameters. Using this function you may be able to copy the bottom right corner of your input image to another output image.

The bounding frame can be created by using Simd::Rectangle().