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

Method getVolume

src/openpose/core/array.cpp:470–500  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

468
469 template<typename T>
470 size_t Array<T>::getVolume(const int indexA, const int indexB) const
471 {
472 try
473 {
474 const auto indexBFinal = (indexB != -1 ? indexB : (int)mSize.size()-1);
475 if (indexA < indexBFinal)
476 {
477 // 0 <= indexA < indexBFinal < mSize.size()
478 if (0 <= indexA && (unsigned int)indexBFinal < mSize.size())
479 return std::accumulate(
480 mSize.begin()+indexA, mSize.begin()+indexBFinal+1, 1ull, std::multiplies<size_t>());
481 else
482 {
483 error("Indexes out of dimension.", __LINE__, __FUNCTION__, __FILE__);
484 return 0;
485 }
486 }
487 else if (indexA == indexBFinal)
488 return mSize.at(indexA);
489 else // if (indexA > indexBFinal)
490 {
491 error("indexA > indexB.", __LINE__, __FUNCTION__, __FILE__);
492 return 0;
493 }
494 }
495 catch (const std::exception& e)
496 {
497 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
498 return 0;
499 }
500 }
501
502 template<typename T>
503 std::vector<int> Array<T>::getStride() const

Callers 15

formatToCvMatMethod · 0.45
ArrayCpuGpuMethod · 0.45
ArrayMethod · 0.45
keepTopPeopleMethod · 0.45
getNonZeroKeypointsFunction · 0.45
getDistanceAverageFunction · 0.45
renderFaceInheritedMethod · 0.45
Forward_oclMethod · 0.45
Forward_gpuMethod · 0.45
forwardPassMethod · 0.45
connectBodyPartsOclFunction · 0.45

Calls 3

whatMethod · 0.80
errorFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected