Skip to content

Commit eb7c61f

Browse files
committed
Merge pull request #2091 from berak:optflow_sparse_rlof_gray
2 parents eda4575 + 5bf9827 commit eb7c61f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

modules/optflow/src/rlofflow.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ class SparseRLOFOpticalFlowImpl : public SparseRLOFOpticalFlow
281281
CV_Assert(!prevImg.empty() && prevImg.depth() == CV_8U && (prevImg.channels() == 3 || prevImg.channels() == 1));
282282
CV_Assert(!nextImg.empty() && nextImg.depth() == CV_8U && (nextImg.channels() == 3 || nextImg.channels() == 1));
283283
CV_Assert(prevImg.sameSize(nextImg));
284+
if ((param->supportRegionType == SR_CROSS) && (prevImg.channels() != 3 || nextImg.channels() != 3))
285+
CV_Error(cv::Error::BadNumChannels, "if SR_CROSS is used, both images need to have 3 channels.");
284286

285287
Mat prevImage = prevImg.getMat();
286288
Mat nextImage = nextImg.getMat();

0 commit comments

Comments
 (0)