MCPcopy Create free account
hub / github.com/creatale/node-dv / copyMakeConstBorder_8u

Function copyMakeConstBorder_8u

deps/opencv/modules/imgproc/src/utils.cpp:162–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160
161
162static void copyMakeConstBorder_8u( const uchar* src, size_t srcstep, Size srcroi,
163 uchar* dst, size_t dststep, Size dstroi,
164 int top, int left, int cn, const uchar* value )
165{
166 int i, j;
167 AutoBuffer<uchar> _constBuf(dstroi.width*cn);
168 uchar* constBuf = _constBuf;
169 int right = dstroi.width - srcroi.width - left;
170 int bottom = dstroi.height - srcroi.height - top;
171
172 for( i = 0; i < dstroi.width; i++ )
173 {
174 for( j = 0; j < cn; j++ )
175 constBuf[i*cn + j] = value[j];
176 }
177
178 srcroi.width *= cn;
179 dstroi.width *= cn;
180 left *= cn;
181 right *= cn;
182
183 uchar* dstInner = dst + dststep*top + left;
184
185 for( i = 0; i < srcroi.height; i++, dstInner += dststep, src += srcstep )
186 {
187 if( dstInner != src )
188 memcpy( dstInner, src, srcroi.width );
189 memcpy( dstInner - left, constBuf, left );
190 memcpy( dstInner + srcroi.width, constBuf, right );
191 }
192
193 dst += dststep*top;
194
195 for( i = 0; i < top; i++ )
196 memcpy(dst + (i - top)*dststep, constBuf, dstroi.width);
197
198 for( i = 0; i < bottom; i++ )
199 memcpy(dst + (i + srcroi.height)*dststep, constBuf, dstroi.width);
200}
201
202}
203

Callers 1

copyMakeBorderMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected