Compilation errror: XY was no declared in this scope

asked 2014-10-03 21:23:16 -0600

maxdoom gravatar image

updated 2014-10-04 00:18:00 -0600

I there,

i was trying to follow this tutorial: http://docs.opencv.org/doc/tutorials/core/how_to_scan_images/how_to_scan_images.html#howtoscanimagesopencv and tried to compile the sample code given here: http://docs.opencv.org/_downloads/how_to_scan_images.cpp and get the following error:

wx@yz:~/Workspace/OpenCV/scan images$ g++ `pkg-config --cflags opencv` how_to_scan_images.cpp `pkg-config --libs opencv` -o test
how_to_scan_images.cpp: In function ‘int main(int, char**)’:
how_to_scan_images.cpp:38:29: error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope
how_to_scan_images.cpp:40:29: error: ‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope

I was using the following compilation command

g++ `pkg-config --cflags opencv` how_to_scan_images.cpp `pkg-config --libs opencv` -o test

The Code itself is correct, so why do I still get this error. Edit: I'm using Debian Linux and OpenCV 3.

Thanks in advance!

edit retag flag offensive close merge delete

Comments

1

ah, another tutorial bug.

should be cv::IMREAD_GRAYSCALE and cv::IMREAD_COLOR

(btw, for 3.0, use: http://docs.opencv.org/trunk [still wrong there, too] )

berak gravatar imageberak ( 2014-10-04 01:33:07 -0600 )edit
1

Nice you fixed it, thanks a lot. Btw thanks for the link, very useful stuff. Anyhow I'am new to OpenCV so I'll need to work through the tutorials.

maxdoom gravatar imagemaxdoom ( 2014-10-04 01:51:20 -0600 )edit

@berak is this fix included in your PR?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-06 06:40:10 -0600 )edit
1

no ;) those were only the rst files.

( i didn't dare to change more in one go (49 files already, hey),

what's your opinion, - have another run at it, change all the tutorial code too ? (so it's in sync) - or do a seperate pr for this ?)

berak gravatar imageberak ( 2014-10-06 07:01:43 -0600 )edit

btw, above link to how_to_scan_images.cpp is from 2.4, it's fixed in 3.0

berak gravatar imageberak ( 2014-10-06 07:14:01 -0600 )edit

I would do a seperate PR for that. But it needs to be done ... because there are still enough wrong tutorials out there. Already tried to fix some of them in the past.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-10-06 07:16:02 -0600 )edit
1

yep, thanks, what i'm thinking, too. (actually, there's only a few CV_CAP_* things left in the user guide code and a few CV_BGR2* in the winrt section.

(but right. i'll send out a 2nd pr later the day ..)

berak gravatar imageberak ( 2014-10-06 07:19:19 -0600 )edit