Skip to content

Commit

Permalink
add process adding padding to input plane before filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
WL-Amigo committed May 31, 2015
1 parent b994489 commit eacd34c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/convertRoutine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ bool convertWithModels(cv::Mat &inputPlane, cv::Mat &outputPlane,
std::unique_ptr<std::vector<cv::Mat> > outputPlanes = std::unique_ptr<
std::vector<cv::Mat> >(new std::vector<cv::Mat>());

//insert padding to inputPlane
cv::Mat tempMat;
int nModel = models.size();
cv::Size outputSize = inputPlane.size();
cv::copyMakeBorder(inputPlane, tempMat, nModel, nModel, nModel,
nModel, cv::BORDER_REPLICATE);

inputPlanes->clear();
inputPlanes->push_back(inputPlane);
inputPlanes->push_back(tempMat);

for (int index = 0; index < models.size(); index++) {
std::cout << "Iteration #" << (index + 1) << "..." << std::endl;
Expand All @@ -35,7 +42,11 @@ bool convertWithModels(cv::Mat &inputPlane, cv::Mat &outputPlane,
}
}

outputPlanes->at(0).copyTo(outputPlane);
tempMat = outputPlanes->at(0)(cv::Range(nModel,outputSize.height + nModel),
cv::Range(nModel,outputSize.width + nModel));
assert(tempMat.size().width == outputSize.width && tempMat.size().height == outputSize.height);

tempMat.copyTo(outputPlane);

return true;

Expand Down

0 comments on commit eacd34c

Please sign in to comment.