Skip to content

Commit 8a79ba0

Browse files
committed
c_api expose Mat border processing api
1 parent e8645e9 commit 8a79ba0

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

src/c_api.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,29 @@ int ncnn_extractor_extract_index(ncnn_extractor_t ex, int index, ncnn_mat_t* mat
14171417
return ret;
14181418
}
14191419

1420+
void ncnn_copy_make_border(const ncnn_mat_t src, ncnn_mat_t dst, int top, int bottom, int left, int right, int type, float v, const ncnn_option_t opt)
1421+
{
1422+
const Option _opt = opt == nullptr ? Option() : *((const Option*)opt);
1423+
copy_make_border(*(const Mat*)src, *(Mat*)dst, top, bottom, left, right, type, v, _opt);
1424+
}
1425+
1426+
void ncnn_copy_make_border_3d(const ncnn_mat_t src, ncnn_mat_t dst, int top, int bottom, int left, int right, int front, int behind, int type, float v, const ncnn_option_t opt)
1427+
{
1428+
const Option _opt = opt == nullptr ? Option() : *((const Option*)opt);
1429+
copy_make_border_3d(*(const Mat*)src, *(Mat*)dst, top, bottom, left, right, front, behind, type, v, _opt);
1430+
}
1431+
1432+
void ncnn_copy_cut_border(const ncnn_mat_t src, ncnn_mat_t dst, int top, int bottom, int left, int right, const ncnn_option_t opt) {
1433+
const Option _opt = opt == nullptr ? Option() : *((const Option*)opt);
1434+
copy_cut_border(*(const Mat*)src, *(Mat*)dst, top, bottom, left, right, _opt);
1435+
}
1436+
1437+
void ncnn_copy_cut_border_3d(const ncnn_mat_t src, ncnn_mat_t dst, int top, int bottom, int left, int right, int front, int behind, const ncnn_option_t opt)
1438+
{
1439+
const Option _opt = opt == nullptr ? Option() : *((const Option*)opt);
1440+
copy_cut_border_3d(*(const Mat*)src, *(Mat*)dst, top, bottom, left, right, front, behind, _opt);
1441+
}
1442+
14201443
#ifdef __cplusplus
14211444
} /* extern "C" */
14221445
#endif

src/c_api.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,16 @@ NCNN_EXPORT int ncnn_extractor_extract(ncnn_extractor_t ex, const char* name, nc
327327
NCNN_EXPORT int ncnn_extractor_input_index(ncnn_extractor_t ex, int index, const ncnn_mat_t mat);
328328
NCNN_EXPORT int ncnn_extractor_extract_index(ncnn_extractor_t ex, int index, ncnn_mat_t* mat);
329329

330+
/* mat process api */
331+
#define NCNN_BORDER_CONSTANT = 0,
332+
#define NCNN_BORDER_REPLICATE = 1,
333+
#define NCNN_BORDER_REFLECT = 2,
334+
#define NCNN_BORDER_TRANSPARENT = -233,
335+
NCNN_EXPORT void ncnn_copy_make_border(const ncnn_mat_t src, ncnn_mat_t dst, int top, int bottom, int left, int right, int type, float v, const ncnn_option_t opt);
336+
NCNN_EXPORT void ncnn_copy_make_border_3d(const ncnn_mat_t src, ncnn_mat_t dst, int top, int bottom, int left, int right, int front, int behind, int type, float v, const ncnn_option_t opt);
337+
NCNN_EXPORT void ncnn_copy_cut_border(const ncnn_mat_t src, ncnn_mat_t dst, int top, int bottom, int left, int right, const ncnn_option_t opt);
338+
NCNN_EXPORT void ncnn_copy_cut_border_3d(const ncnn_mat_t src, ncnn_mat_t dst, int top, int bottom, int left, int right, int front, int behind, const ncnn_option_t opt);
339+
330340
#ifdef __cplusplus
331341
} /* extern "C" */
332342
#endif

0 commit comments

Comments
 (0)