MCPcopy Create free account
hub / github.com/KumarRobotics/sloam / _argmax

Method _argmax

sloam/src/segmentation/inference.cpp:318–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

316}
317
318void Segmentation::_argmax(const float *in, cv::Mat& maskImg){
319 std::vector<unsigned char> max;
320 size_t numClasses_ = 2;
321 size_t outSize = _img_h * _img_w * numClasses_;
322 for (unsigned int i = 0; i < outSize; i += numClasses_) {
323 unsigned int maxIdx = i;
324 unsigned char outIdx = 0;
325 for (unsigned int c = 1; c < numClasses_; c++) {
326 if (in[maxIdx] < in[i + c]) {
327 maxIdx = i + c;
328 outIdx = c;
329 }
330 }
331 if(outIdx == 1) outIdx = 255;
332 max.push_back(outIdx);
333 }
334 memcpy(maskImg.data, max.data(), max.size()*sizeof(unsigned char));
335}
336
337void Segmentation::runERF(cv::Mat& rImg, cv::Mat& maskImg){
338 cv::Mat pImg(rImg.rows, rImg.cols, CV_32FC2, cv::Scalar(0));

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected