Ask Your Question
0

Runtime error with OpenCV C++

asked 2018-09-19 01:34:40 -0600

khaalidi gravatar image
habib@Habib-PC:~/Documents/Projects$ g++ fingerprint_process.cpp -o program.out `pkg-config --cflags --libs opencv`
habib@Habib-PC:~/Documents/Projects$ ./program.out 
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(3.4.3-dev) /home/habib/Documents/Projects/Packages/opencv/modules/core/src/matrix_wrap.cpp:1660: error: (-215:Assertion failed) !fixedSize() in function 'release'

Aborted (core dumped)

Why Am I getting this error on runtime? (︶︹︺) (︶︹︺)

edit retag flag offensive close merge delete

Comments

please show the code around the line , that throws the error. (in your code)

you're probably trying to manipulate a const Mat (or an invalid one)

berak gravatar imageberak ( 2018-09-19 01:55:50 -0600 )edit
1
khaalidi gravatar imagekhaalidi ( 2018-09-19 03:40:56 -0600 )edit

The code is pretty straight forward , there is no exception statements.

khaalidi gravatar imagekhaalidi ( 2018-09-19 03:43:52 -0600 )edit

The error is thrown from inside the Library , matrix_wrap.cpp ,

khaalidi gravatar imagekhaalidi ( 2018-09-19 03:47:01 -0600 )edit

but the reason for that is in your code, so, try to find out, where it happens there, and show us.

and learn how to use a debugger, please.

berak gravatar imageberak ( 2018-09-19 04:17:36 -0600 )edit

1 answer

Sort by » oldest newest most voted
2

answered 2018-09-20 02:55:30 -0600

berak gravatar image

updated 2018-09-20 03:21:25 -0600

your input image was not read .

you have to change the hardcoded image path in the code before running this !

lines 76 / 143 , it also should be like: "datasets/fingerprints/DB1_B/101_1.tif"

and ofc. you have to CHECK the outcome of each imread() call:

if (image.empty()) // FAIL !
edit flag offensive delete link more

Comments

berak gravatar imageberak ( 2018-09-20 03:22:18 -0600 )edit

Thanks , It worked.

khaalidi gravatar imagekhaalidi ( 2018-09-21 01:34:50 -0600 )edit
1

Thanks for the pointer @berak! I can indeed add a line of code that checks whether the image is actually read correctly.

StevenPuttemans gravatar imageStevenPuttemans ( 2018-10-17 04:57:24 -0600 )edit
StevenPuttemans gravatar imageStevenPuttemans ( 2018-10-17 04:59:03 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-09-19 01:34:40 -0600

Seen: 2,273 times

Last updated: Sep 20 '18