| 316 | } |
| 317 | |
| 318 | void 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 | |
| 337 | void Segmentation::runERF(cv::Mat& rImg, cv::Mat& maskImg){ |
| 338 | cv::Mat pImg(rImg.rows, rImg.cols, CV_32FC2, cv::Scalar(0)); |
nothing calls this directly
no outgoing calls
no test coverage detected