MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / border

Function border

examples/image_processing/morphing.cpp:37–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37array border(const array& img, const int left, const int right, const int top,
38 const int bottom, const float value = 0.0) {
39 if ((int)img.dims(0) < (top + bottom))
40 printf("input does not have enough rows\n");
41 if ((int)img.dims(1) < (left + right))
42 fprintf(stderr, "input does not have enough columns\n");
43
44 dim4 imgDims = img.dims();
45 array ret = constant(value, imgDims);
46 ret(seq(top, imgDims[0] - bottom), seq(left, imgDims[1] - right), span,
47 span) = img(seq(top, imgDims[0] - bottom),
48 seq(left, imgDims[1] - right), span, span);
49
50 return ret;
51}
52
53array border(const array& img, const int w, const int h,
54 const float value = 0.0) {

Callers 1

morphing_demoFunction · 0.85

Calls 3

constantFunction · 0.85
seqClass · 0.85
dimsMethod · 0.45

Tested by

no test coverage detected