fixed gpu::graphcut preconditions

pull/13383/head
Alexey Spizhevoy 14 years ago
parent ad693d7311
commit ca1584dd1f
  1. 24
      modules/gpu/src/graphcuts.cpp

@ -50,18 +50,22 @@ void cv::gpu::graphcut(GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, Gpu
void cv::gpu::graphcut(GpuMat& terminals, GpuMat& leftTransp, GpuMat& rightTransp, GpuMat& top, GpuMat& bottom, GpuMat& labels, GpuMat& buf)
{
CV_Assert(leftTransp.type() == CV_32S && rightTransp.type() == CV_32S);
CV_Assert(terminals.type() == CV_32S && bottom.type() == CV_32S && top.type() == CV_32S);
CV_Assert(terminals.size() == leftTransp.size());
CV_Assert(terminals.size() == rightTransp.size());
CV_Assert(terminals.size() == top.size() && terminals.size() == bottom.size());
CV_Assert(top.step == bottom.step && top.step == terminals.step && rightTransp.step == leftTransp.step);
labels.create(terminals.size(), CV_8U);
Size src_size = terminals.size();
CV_Assert(terminals.type() == CV_32S);
CV_Assert(leftTransp.size() == Size(src_size.height, src_size.width));
CV_Assert(leftTransp.type() == CV_32S);
CV_Assert(rightTransp.size() == Size(src_size.height, src_size.width));
CV_Assert(rightTransp.type() == CV_32S);
CV_Assert(top.size() == src_size);
CV_Assert(top.type() == CV_32S);
CV_Assert(bottom.size() == src_size);
CV_Assert(bottom.type() == CV_32S);
labels.create(src_size, CV_8U);
NppiSize sznpp;
sznpp.width = terminals.cols;
sznpp.height = terminals.rows;
sznpp.width = src_size.width;
sznpp.height = src_size.height;
int bufsz;
nppSafeCall( nppiGraphcutGetSize(sznpp, &bufsz) );

Loading…
Cancel
Save