| 35 | } |
| 36 | |
| 37 | array 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 | |
| 53 | array border(const array& img, const int w, const int h, |
| 54 | const float value = 0.0) { |
no test coverage detected