Hi everyone,
I'm trying to draw the bouding box of a shape using the function cvRectangle as written below: cvRectangle(img,cvPoint(box.x, box.y),cvPoint(box.x+box.width, box.y+box.height),cvScalarAll(255),CV_FILLED); But the complier says the following: too few arguments to function 'cvRectangle' I already checked the function on the net and on the O'Reilly book of Opencv and the number of arguments seems correct. Any help is appreciated. Thanks. [Non-text portions of this message have been removed] |
Are you compiling with a c compiler gcc?
cvRectangle has some default parameters , you have to compile your code using a c++ compiler!!! Carlos Frederico On Tue, Mar 17, 2009 at 9:37 AM, Thiago J. <[hidden email]>wrote: > Hi everyone, > > I'm trying to draw the bouding box of a shape using the function > cvRectangle as written below: > > cvRectangle(img,cvPoint(box.x, box.y),cvPoint(box.x+box.width, > box.y+box.height),cvScalarAll(255),CV_FILLED); > > But the complier says the following: > too few arguments to function 'cvRectangle' > > I already checked the function on the net and on the O'Reilly book of > Opencv and the number of arguments seems correct. > > Any help is appreciated. > > Thanks. > > [Non-text portions of this message have been removed] > > > [Non-text portions of this message have been removed] |
In reply to this post by thiagoj_silva
well, this should work...
cvRectangle(img, cvPoint(box.x, box.y), cvPoint(box.x+box.width, box.y+box.height), CV_RGB(255,0,0),2); Regards, 2009/3/17 Thiago J. <[hidden email]> > Hi everyone, > > I'm trying to draw the bouding box of a shape using the function > cvRectangle as written below: > > cvRectangle(img,cvPoint(box.x, box.y),cvPoint(box.x+box.width, > box.y+box.height),cvScalarAll(255),CV_FILLED); > > But the complier says the following: > too few arguments to function 'cvRectangle' > > I already checked the function on the net and on the O'Reilly book of > Opencv and the number of arguments seems correct. > > Any help is appreciated. > > Thanks. > > [Non-text portions of this message have been removed] > > > [Non-text portions of this message have been removed] |
In reply to this post by thiagoj_silva
"Thiago J." <[hidden email]> writes:
> cvRectangle(img,cvPoint(box.x, box.y),cvPoint(box.x+box.width, box.y+box.height),cvScalarAll(255),CV_FILLED); > > But the complier says the following: > too few arguments to function 'cvRectangle' > > I already checked the function on the net and on the O'Reilly book > of Opencv and the number of arguments seems correct. There's an additional final "shift" parameter in the function, that you can leave as 0. I think if you're using a C++ compiler, it has a default value and thus can be left off, but that's probably not true with a pure C compiler. So try just adding the additional 0 parameter. Looks like most/all of the drawing operations have such a final parameter. Not sure when they were added, but they're in OpenCV 1.0, so I agree that I would have thought that the book would include it. In any event, the docs that came with your OpenCV version should have shown it (I know that the included documentation with the 1.0 package on Windows does, for example). Certainly should you run into these sorts of compiler errors in the future, I would suggest just checking your load header files before the net or book. Regardless of what the other sources say, the compiler is going to be obeying what is in the header files. -- David |
In reply to this post by thiagoj_silva
Try this: cvRectangle(img, cvPoint(box.x, box.y), cvPoint(box.x+box.width, box.y+box.height), cvScalarAll(255), CV_FILLED, 0, 0); the two last argument (line_type, shift) should be optional. but when you leave it, the compiler will complain. --- In [hidden email], "Thiago J." <thiagoj_silva@...> wrote: > > Hi everyone, > > I'm trying to draw the bouding box of a shape using the function cvRectangle as written below: > > cvRectangle(img,cvPoint(box.x, box.y),cvPoint(box.x+box.width, box.y+box.height),cvScalarAll(255),CV_FILLED); > > But the complier says the following: > too few arguments to function 'cvRectangle' > > I already checked the function on the net and on the O'Reilly book of Opencv and the number of arguments seems correct. > > Any help is appreciated. > > Thanks. > > > > [Non-text portions of this message have been removed] > |
Free forum by Nabble | Edit this page |