Ask Your Question
0

Guarantee continuous Mat Image

asked 2014-10-28 14:02:41 -0600

roosemberth gravatar image

updated 2014-11-02 03:45:42 -0600

Hello, I would like to ensure a continuous frame for a mat image. I tryed the solution described Here, but I get compilation errors of no candidate for operator= on Mat (in header is defined for Mat&), so there's my question, how can I allocate the continuous frame?

Best Regards!

Here is the error I get:

Building file: ../src/Sandbox.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/local/include/opencv2 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Sandbox.d" -MT"src/Sandbox.d" -o "src/Sandbox.o" "../src/Sandbox.cpp"
../src/Sandbox.cpp: In function ‘int main(int, char**)’:
../src/Sandbox.cpp:196:13: error: ‘class cv::Mat’ has no member named ‘isContinous’
   if(!Frame.isContinous()) Frame=Frame.clone;
                ^
../src/Sandbox.cpp:196:33: error: no match for ‘operator=’ (operand types are ‘cv::Mat’ and ‘<unresolved overloaded function type>’)
   if(!Frame.isContinous()) Frame=Frame.clone;
                             ^
../src/Sandbox.cpp:196:33: note: candidates are:
In file included from /usr/local/include/opencv2/core/core.hpp:4856:0,
                 from /usr/local/include/opencv2/opencv.hpp:47,
                 from ../src/Sandbox.cpp:1:
/usr/local/include/opencv2/core/mat.hpp:281:13: note: cv::Mat& cv::Mat::operator=(const cv::Mat&)
 inline Mat& Mat::operator = (const Mat& m)
             ^
/usr/local/include/opencv2/core/mat.hpp:281:13: note:   no known conversion for argument 1 from ‘<unresolved overloaded function type>’ to ‘const cv::Mat&’
In file included from /usr/local/include/opencv2/core/core.hpp:4856:0,
                 from /usr/local/include/opencv2/opencv.hpp:47,
                 from ../src/Sandbox.cpp:1:
/usr/local/include/opencv2/core/mat.hpp:1417:13: note: cv::Mat& cv::Mat::operator=(const cv::MatExpr&)
 inline Mat& Mat::operator = (const MatExpr& e)
         ^
/usr/local/include/opencv2/core/mat.hpp:1417:13: note:   no known conversion for argument 1 from ‘<unresolved overloaded function type>’ to ‘const cv::MatExpr&’
In file included from /usr/local/include/opencv2/opencv.hpp:47:0,
             from ../src/Sandbox.cpp:1:
/usr/local/include/opencv2/core/core.hpp:1775:10: note: cv::Mat& cv::Mat::operator=(const Scalar&)
 Mat& operator = (const Scalar& s);
      ^
/usr/local/include/opencv2/core/core.hpp:1775:10: note:   no known conversion for argument 1 from ‘<unresolved overloaded function type>’ to ‘const Scalar& {aka const     cv::Scalar_<double>&}’
make: *** [src/Sandbox.o] Error 1

The code I'm using is

Mat Frame
VideoCapture VideoStream;
VideoStream.read(Frame);                            // Get Frame
if(!Frame.isContinous()) Frame=Frame.clone;
edit retag flag offensive close merge delete

Comments

btw: Mat Frame; (semicolon required) and Frame=Frame.clone(); (missing ())

berak gravatar imageberak ( 2014-11-02 05:40:41 -0600 )edit

1 answer

Sort by » oldest newest most voted
0

answered 2014-10-30 05:34:50 -0600

updated 2014-10-30 05:36:34 -0600

Hi! Are you sure your images are not continuous (img.isContinuous())?

If they aren't, the solution you post seems correct, it's working for me. Can you give use more details on your code and error?

edit flag offensive delete link more

Comments

I Updated the post with the information you requested

roosemberth gravatar imageroosemberth ( 2014-11-02 03:46:27 -0600 )edit

Hi,

your code is correct, you just made small mistakes: you forgot the "u" in isContinuous, and the function clone() should have parenthesis :

  if(!Frame.isContinuous()) Frame=Frame.clone();
petititi gravatar imagepetititi ( 2014-11-03 15:48:50 -0600 )edit

Oh, I missed that silly error... I'm so sorry, Thank you!

roosemberth gravatar imageroosemberth ( 2014-11-04 05:12:05 -0600 )edit

Please mark it as solved ;-)

petititi gravatar imagepetititi ( 2014-11-04 11:20:16 -0600 )edit

Question Tools

Stats

Asked: 2014-10-28 14:02:41 -0600

Seen: 2,223 times

Last updated: Nov 02 '14