1

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?

David
  • 53
  • 5

2 Answers2

1

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;
}
Akira
  • 213
  • 2
  • 11
0

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().

FutureJJ
  • 2,368
  • 1
  • 19
  • 30
  • Unfortunately this function makes opposite action - it copies all except given region. – David Jun 27 '18 at 13:55
  • For creating the bounding rectangle you can subtract total frame height from expected bounding rectangle height and same for width. – FutureJJ Jun 29 '18 at 06:36