void Illustrate::drawPrittyResults(const vector<vector<Vec4i>> &boxesTests) { cout << __FUNCTION__ << " called:(" << __LINE__ << ")" << endl; CStr resDir = _resDir + "PrittyResults/"; CmFile::MkDir(resDir); for (int i = 0; i < _voc.testSet.size(); i++) { const vector<Vec4i> &boxesGT = _voc.gtTestBoxes[i]; const vector<Vec4i> &boxes = boxesTests[i]; const int gtNumCrnt = boxesGT.size(); vecD score(gtNumCrnt); vector<Vec4i> bboxMatch(gtNumCrnt); for (int j = 0; j < boxes.size(); j++) { const Vec4i &bb = boxes[j]; for (int k = 0; k < gtNumCrnt; k++) { double mVal = Common::interUnio(boxes[j], boxesGT[k]); if (mVal < score[k]) continue; score[k] = mVal; bboxMatch[k] = boxes[j]; } } CStr src = format(_S(_voc.imgPathW), _S(_voc.testSet[i])); CStr dst = resDir + CmFile::GetNameNE(src) + ".jpg"; __drawImage(src, dst, bboxMatch); } }
void Illustrate::drawAllResults(const vector<vector<Vec4i>> &boxesTests, const int drawNum) { cout << __FUNCTION__ << " called:(" << __LINE__ << ")" << endl; CStr resDir = _resDir + "AllResults/"; CmFile::MkDir(resDir); const int TEST_NUM = _voc.testSet.size(); for (int i = 0; i < TEST_NUM; i++) { const vector<Vec4i> &boxes = boxesTests[i]; vector<Vec4i> bboxMatch(drawNum); for (int j = 0; j < drawNum; j++) { bboxMatch.push_back(boxes[j]); } CStr src = format(_S(_voc.imgPathW), _S(_voc.testSet[i])); CStr dst = resDir + CmFile::GetNameNE(src) + ".jpg"; __drawImage(src, dst, bboxMatch); } return; }
void Objectness::illuTestReults(const vector<vector<Vec4i> > &boxesTests) { CStr resDir = _voc.localDir + "ResIlu/"; CmFile::MkDir(resDir); const int TEST_NUM = _voc.testSet.size(); for (int i = 0; i < TEST_NUM; i++) { const vector<Vec4i> &boxesGT = _voc.gtTestBoxes[i]; const vector<Vec4i> &boxes = boxesTests[i]; const int gtNumCrnt = boxesGT.size(); CStr imgPath = format(_S(_voc.imgPathW), _S(_voc.testSet[i])); CStr resNameNE = CmFile::GetNameNE(imgPath); Mat img = imread(imgPath); Mat bboxMatchImg = Mat::zeros(img.size(), CV_32F); vecD score(gtNumCrnt); vector<Vec4i> bboxMatch(gtNumCrnt); for (int j = 0; j < boxes.size(); j++) { const Vec4i &bb = boxes[j]; for (int k = 0; k < gtNumCrnt; k++) { double mVal = DataSetVOC::interUnio(boxes[j], boxesGT[k]); if (mVal < score[k]) continue; score[k] = mVal; bboxMatch[k] = boxes[j]; } } for (int k = 0; k < gtNumCrnt; k++) { const Vec4i &bb = bboxMatch[k]; rectangle(img, Point(bb[0], bb[1]), Point(bb[2], bb[3]), Scalar(0), 3); rectangle(img, Point(bb[0], bb[1]), Point(bb[2], bb[3]), Scalar(255, 255, 255), 2); rectangle(img, Point(bb[0], bb[1]), Point(bb[2], bb[3]), Scalar(0, 0, 255), 1); } imwrite(resDir + resNameNE + "_Match.jpg", img); } }