MCPcopy Create free account
hub / github.com/CMU-Perceptual-Computing-Lab/openpose / setFrom

Method setFrom

src/openpose/core/array.cpp:372–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370
371 template<typename T>
372 void Array<T>::setFrom(const Matrix& cvMat)
373 {
374 try
375 {
376 if (!cvMat.empty())
377 {
378 // New size
379 std::vector<int> newSize(cvMat.dims(),0);
380 for (auto i = 0u ; i < newSize.size() ; i++)
381 newSize[i] = cvMat.size(i);
382 // Reset data & volume
383 reset(newSize);
384 // Integrity checks
385 if (!mCvMatData.first || mCvMatData.second.type() != cvMat.type())
386 error("Array<T>: T type and cvMat type are different.", __LINE__, __FUNCTION__, __FILE__);
387 // Fill data
388 cvMat.copyTo(mCvMatData.second);
389 }
390 else
391 reset();
392 }
393 catch (const std::exception& e)
394 {
395 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
396 }
397 }
398
399 template<typename T>
400 void Array<T>::setTo(const T value)

Callers

nothing calls this directly

Calls 8

resetFunction · 0.85
dimsMethod · 0.80
copyToMethod · 0.80
whatMethod · 0.80
errorFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected