#include "CUDA/CudaCutPaste.H"
#include "CUDA/CudaMathOps.H"
#include "CUDA/CudaImage.H"
#include "Image/Pixels.H"
#include "Util/Assert.H"
#include <algorithm>
Go to the source code of this file.
Functions | |
CudaImage< float > | cudaCrop (const CudaImage< float > &src, const Point2D< int > &pt, const Dims &dims, const bool zerofill) |
Extract a subimage from the input image. | |
CudaImage< float > | cudaCrop (const CudaImage< float > &src, const Rectangle &rect, const bool zerofill) |
Overload of crop() using a Rectangle instead of a Point2D<int>+Dims. | |
CudaImage< float > | cudaShiftImage (const CudaImage< float > &src, const float dx, const float dy) |
Shift an image by a non even amount of pixels, need to interpolate. | |
CudaImage< float > | cudaShiftClean (const CudaImage< float > &src, const int dx, const int dy, const float bgval) |
void | cudaInplacePaste (CudaImage< float > &dst, const CudaImage< float > &img, const Point2D< int > &pos) |
Paste an image onto an existing image. | |
void | cudaInplacePaste (CudaImage< PixRGB< float > > &dst, const CudaImage< PixRGB< float > > &img, const Point2D< int > &pos) |
Paste a PixRGB image onto an existing image. | |
void | cudaInplaceOverlay (CudaImage< float > &dst, const CudaImage< float > &img, const Point2D< int > &pos) |
Overlay an image onto an existing image, only overwriting an old pixel if new pixel is nonzero. | |
void | cudaInplaceOverlay (CudaImage< PixRGB< float > > &dst, const CudaImage< PixRGB< float > > &img, const Point2D< int > &pos) |
Overlay a PixRGB image onto an existing image, only overwriting an old pixel if new pixel is nonzero. |
Cut+paste operations from/to CudaImage subregions
Definition in file CudaCutPaste.C.
CudaImage<float> cudaCrop | ( | const CudaImage< float > & | src, | |
const Rectangle & | rect, | |||
const bool | zerofill | |||
) |
Overload of crop() using a Rectangle instead of a Point2D<int>+Dims.
Definition at line 73 of file CudaCutPaste.C.
References cudaCrop(), Rectangle::height(), Rectangle::left(), Rectangle::top(), and Rectangle::width().
CudaImage<float> cudaCrop | ( | const CudaImage< float > & | src, | |
const Point2D< int > & | upperLeft, | |||
const Dims & | size, | |||
const bool | zerofill = false | |||
) |
Extract a subimage from the input image.
The upper left corner of the subimage is given by a Point2D<int>, and the size of the subimage is given by the Dims. If zerofill is false, then the rectangle given by Point2D<int>+Dims must be wholly contained within the bounds of the input image. If zerofill is true, then any output region that lies outside the bounds of the input will be zero-filled (where zero means the default value for type T).
Definition at line 46 of file CudaCutPaste.C.
References ASSERT, CudaImage< T >::coordsOk(), CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getDims(), CudaImage< T >::getHeight(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getMemoryPolicy(), CudaImage< T >::getWidth(), Dims::h(), HOST_MEMORY, Point2D< T >::i, min(), NO_INIT, and Dims::w().
Referenced by cudaCrop(), CudaHmaxFLSal::extractRandC1Patches(), and CudaHmaxFL::extractRandC1Patches().
void cudaInplaceOverlay | ( | CudaImage< PixRGB< float > > & | dst, | |
const CudaImage< PixRGB< float > > & | img, | |||
const Point2D< int > & | pos | |||
) |
Overlay a PixRGB image onto an existing image, only overwriting an old pixel if new pixel is nonzero.
Definition at line 180 of file CudaCutPaste.C.
References ASSERT, Dims::h(), Point2D< T >::i, and Dims::w().
void cudaInplaceOverlay | ( | CudaImage< float > & | dst, | |
const CudaImage< float > & | img, | |||
const Point2D< int > & | pos | |||
) |
Overlay an image onto an existing image, only overwriting an old pixel if new pixel is nonzero.
Definition at line 168 of file CudaCutPaste.C.
References ASSERT, CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getHeight(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getWidth(), Dims::h(), Point2D< T >::i, and Dims::w().
void cudaInplacePaste | ( | CudaImage< PixRGB< float > > & | dst, | |
const CudaImage< PixRGB< float > > & | img, | |||
const Point2D< int > & | pos | |||
) |
Paste a PixRGB image onto an existing image.
Definition at line 155 of file CudaCutPaste.C.
References ASSERT, Dims::h(), Point2D< T >::i, and Dims::w().
void cudaInplacePaste | ( | CudaImage< float > & | dst, | |
const CudaImage< float > & | img, | |||
const Point2D< int > & | pos | |||
) |
Paste an image onto an existing image.
Definition at line 143 of file CudaCutPaste.C.
References ASSERT, CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getHeight(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getWidth(), Dims::h(), Point2D< T >::i, and Dims::w().
Referenced by CudaFramework::setText(), and CudaFramework::updateCanvas().
Shift an image by a non even amount of pixels, need to interpolate.
Definition at line 82 of file CudaCutPaste.C.
References ASSERT, CudaImage< T >::getCudaArrayPtr(), CudaImage< T >::getDims(), CudaImage< T >::getMemoryDevice(), CudaImage< T >::getMemoryPolicy(), Dims::h(), CudaImage< T >::initialized(), Dims::w(), and ZEROS.
Referenced by CudaReichardtPyrBuilder< T >::build().