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

Method split

deps/opencv/modules/core/src/convert.cpp:221–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219}
220
221void cv::split(const Mat& src, Mat* mv)
222{
223 int k, depth = src.depth(), cn = src.channels();
224 if( cn == 1 )
225 {
226 src.copyTo(mv[0]);
227 return;
228 }
229
230 SplitFunc func = getSplitFunc(depth);
231 CV_Assert( func != 0 );
232
233 int esz = (int)src.elemSize(), esz1 = (int)src.elemSize1();
234 int blocksize0 = (BLOCK_SIZE + esz-1)/esz;
235 AutoBuffer<uchar> _buf((cn+1)*(sizeof(Mat*) + sizeof(uchar*)) + 16);
236 const Mat** arrays = (const Mat**)(uchar*)_buf;
237 uchar** ptrs = (uchar**)alignPtr(arrays + cn + 1, 16);
238
239 arrays[0] = &src;
240 for( k = 0; k < cn; k++ )
241 {
242 mv[k].create(src.dims, src.size, depth);
243 arrays[k+1] = &mv[k];
244 }
245
246 NAryMatIterator it(arrays, ptrs, cn+1);
247 int total = (int)it.size, blocksize = cn <= 4 ? total : std::min(total, blocksize0);
248
249 for( size_t i = 0; i < it.nplanes; i++, ++it )
250 {
251 for( int j = 0; j < total; j += blocksize )
252 {
253 int bsz = std::min(total - j, blocksize);
254 func( ptrs[0], &ptrs[1], bsz, cn );
255
256 if( j + blocksize < total )
257 {
258 ptrs[0] += bsz*esz;
259 for( k = 0; k < cn; k++ )
260 ptrs[k+1] += bsz*esz1;
261 }
262 }
263 }
264}
265
266void cv::split(InputArray _m, OutputArrayOfArrays _mv)
267{

Callers

nothing calls this directly

Calls 14

getSplitFuncFunction · 0.85
alignPtrFunction · 0.85
splitFunction · 0.85
fixedTypeMethod · 0.80
minFunction · 0.70
depthMethod · 0.45
channelsMethod · 0.45
copyToMethod · 0.45
elemSizeMethod · 0.45
elemSize1Method · 0.45
createMethod · 0.45
getMatMethod · 0.45

Tested by

no test coverage detected