Commit 644f4289 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #2095 from alalek:rlof_fix_check

parents eb7c61fa 8fce7e9f
......@@ -281,18 +281,23 @@ class SparseRLOFOpticalFlowImpl : public SparseRLOFOpticalFlow
CV_Assert(!prevImg.empty() && prevImg.depth() == CV_8U && (prevImg.channels() == 3 || prevImg.channels() == 1));
CV_Assert(!nextImg.empty() && nextImg.depth() == CV_8U && (nextImg.channels() == 3 || nextImg.channels() == 1));
CV_Assert(prevImg.sameSize(nextImg));
if ((param->supportRegionType == SR_CROSS) && (prevImg.channels() != 3 || nextImg.channels() != 3))
CV_Error(cv::Error::BadNumChannels, "if SR_CROSS is used, both images need to have 3 channels.");
Mat prevImage = prevImg.getMat();
Mat nextImage = nextImg.getMat();
Mat prevPtsMat = prevPts.getMat();
if (param.empty())
{
param = Ptr<RLOFOpticalFlowParameter>(new RLOFOpticalFlowParameter);
param = makePtr<RLOFOpticalFlowParameter>();
}
CV_DbgAssert(!param.empty());
if (param->supportRegionType == SR_CROSS)
{
CV_CheckChannelsEQ(prevImg.channels(), 3, "SR_CROSS mode requires images with 3 channels");
CV_CheckChannelsEQ(nextImg.channels(), 3, "SR_CROSS mode requires images with 3 channels");
}
Mat prevImage = prevImg.getMat();
Mat nextImage = nextImg.getMat();
Mat prevPtsMat = prevPts.getMat();
if (param->useInitialFlow == false)
nextPts.create(prevPtsMat.size(), prevPtsMat.type(), -1, true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment