Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/simpleocv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,30 @@ void resize(const Mat& src, Mat& dst, const Size& size, float sw, float sh, int

dst = tmp;
}

void copyMakeBorder(const Mat& src, Mat& dst, int top, int bottom, int left, int right, BorderType borderType, const Scalar& value = Scalar())
{
ncnn::BorderType ncnn_border_type;
switch (borderType)
{
case BORDER_CONSTANT:
ncnn_border_type = ncnn::BORDER_CONSTANT;
break;
case BORDER_REPLICATE:
ncnn_border_type = ncnn::BORDER_REPLICATE;
break;
case BORDER_REFLECT:
ncnn_border_type = ncnn::BORDER_REFLECT;
break;
case BORDER_TRANSPARENT:
ncnn_border_type = ncnn::BORDER_TRANSPARENT;
break;
default:
ncnn_border_type = ncnn::BORDER_CONSTANT;
break;
}
ncnn::copy_make_border(src, dst, top, bottom, left, right, ncnn_border_type, value[0]);
}
#endif // NCNN_PIXEL

#if NCNN_PIXEL_DRAWING
Expand Down
13 changes: 13 additions & 0 deletions src/simpleocv.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,19 @@ NCNN_EXPORT int waitKey(int delay = 0);

#if NCNN_PIXEL
NCNN_EXPORT void resize(const Mat& src, Mat& dst, const Size& size, float sw = 0.f, float sh = 0.f, int flags = 0);
enum BorderType
{
BORDER_CONSTANT = 0,
BORDER_REPLICATE = 1,
BORDER_REFLECT = 2,
BORDER_WRAP = 3,
BORDER_REFLECT_101 = 4,
BORDER_TRANSPARENT = 5,
BORDER_REFLECT101 = BORDER_REFLECT_101,
BORDER_DEFAULT = BORDER_REFLECT_101,
BORDER_ISOLATED = 16
};
NCNN_EXPORT void copyMakeBorder(const Mat& src, Mat& dst, int top, int bottom, int left, int right, BorderType borderType, const Scalar& value = Scalar());
#endif // NCNN_PIXEL

#if NCNN_PIXEL_DRAWING
Expand Down