Ask Your Question
0

How to do Unit testing in OpenCV?

asked 2018-01-31 01:28:37 -0600

Chandra Sekar gravatar image

updated 2018-01-31 06:40:11 -0600

OpenCV v3.3.1:

Say for example, there is an API named get/set in VideoCapture Class, how to unit test that API?

There is Code for doing unit testing the get/set API's in doTEST() of doTEST() function in this link

I would like to Know, how to run this test case?

If there is Any possible way to add a new test case in this code, and would like to test on that? Also, is there any excel sheet saved for this output of the unit testing.?

My TRY: Making OpenCV_videoio.cpp as startup project and building, running. ocl_test.cpp from openCvCode Reference for initial running runs and shows me in Command Line, that too without my knowledge it closes, as it is finished executing.

So, please let me know how to do this testing in the opencv(unit testing) for an API check? Thanks in Advance...

edit retag flag offensive close merge delete

Comments

may be this page will help you :https://github.com/opencv/opencv/wiki/HowToWritePerfTests and https://github.com/opencv/opencv/wiki...

LBerger gravatar imageLBerger ( 2018-01-31 02:06:26 -0600 )edit

yeah, i have been checking that one also, but how to run the test_accuracy and test_performances in the openCV, i could never get an answer on that?

I've checked this github's

QA Testing

HowToUsePerfTests

HowToWritePerfTests

opencv

Still i couldn't get a specific solution on that?

If it's possible try to be more stepwise instruction on how to do unit testing in c++ for opencv codes? Thanks

Chandra Sekar gravatar imageChandra Sekar ( 2018-01-31 02:16:24 -0600 )edit

A way to learn unit test is to use a debugger. My own experience is only here

LBerger gravatar imageLBerger ( 2018-01-31 02:36:54 -0600 )edit

unfortunately a pretty broad question, can you be more specific ?

berak gravatar imageberak ( 2018-01-31 05:16:46 -0600 )edit
1

i've edited little bit with some broad explaination, i think this will help you with what problem i'm facing..

Chandra Sekar gravatar imageChandra Sekar ( 2018-01-31 06:44:25 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-01-31 06:55:27 -0600

berak gravatar image

updated 2018-01-31 07:34:00 -0600

OpenCV v3.3.1

don't waste any time with that. if you want to contribute anything, you have to work with latest master

I would like to Know, how to run this test case?

it's just an exe, like any other opencv program. (though iirc they don't come prebuilt with the binary distribution)

you would either run all tests by calling test_videoio or specific, single ones by calling test_videoio --gtest_filter=videoio/Videoio_Bunny.read_position/0

Making OpenCV_videoio.cpp as startup project

well, usually the unit tests get built along with the libs, so you're expected to build the opencv libs locally, with cmake -DBUILD_TESTS=ON, which will generate project files for the tests, too, so you can just choose the videoio one for your startup project.

however, it somehow sounds, like you wanted to use the prebuilt libs, and make a new project for this. then you will need test_main.cpp (as a minimum, better add the whole folder), too. also you have to link opencv_ts340.lib (do you have it ?) and have opencv/ts/include in your "additional include path"

in Command Line, that too without my knowledge it closes, as it is finished

yes that's expected. rather run it from a cmd, than from your ide.

is there any excel sheet saved

nope. opencv's buildbots run python scripts which generate reports e.g. here

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-01-31 01:28:37 -0600

Seen: 7,127 times

Last updated: Jan 31 '18