Ask Your Question

Is it a bug? After imread cv crashes in mat.inl.hpp

asked 2016-06-09 23:36:47 -0500

VanGog gravatar image

updated 2016-06-11 11:29:18 -0500

When I try to open non existing file using imread it will crash

Unhandled exception at 0x00411c78 in ...exe ... 0xC00000 5 Access violation writing at location 0x00419257

mat.inl.hpp on line #681 u->refcount = -389532673 the non existent file is file = 0x0041b838 "../../data/subimage.jpg"

Visual Studio 2010, OpenCV 3.1

edit retag flag offensive close merge delete


the error msg looks more like a linker problem, wrong debug/release libs, wrong crt, something like this.

anyway, please show your code, so folks here can try to reproduce it.

oh, and os/opencv version required, too ! ;)

berak gravatar imageberak ( 2016-06-09 23:46:34 -0500 )edit

ok, I have temporally uploaded my project here: move lena.jpg to folder ../../data/lena.jpg that is all. The file ../../data/subimage.jpg doesn't exist . First image will be loaded successfully. Second image is generated successfully. Third image is non existent and is crashes @berak version 3.1; tested on Visual Studio 2010

VanGog gravatar imageVanGog ( 2016-06-10 00:23:10 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-06-11 11:59:14 -0500

LBerger gravatar image

After debugging your program when file="samples/data/subimage.jpg" file_no is equal 2 in method MyDFT::getSpectrum. There is problem at line this->images[file_no] because file_no is 2 and your array is declared in class myDFT as cv::Mat images[2]; Only images[0] and images[1] exist.

PS Now when I have got problem like this I use debugging and check everything. When I don't understand my error I never say that is a bug because it is easyer to rewrite my own code than opencv

edit flag offensive delete link more


Thanks for the information. I notices that program can crash when I type some nonsence parameter for example during typing text to image. So problem in my program.

VanGog gravatar imageVanGog ( 2016-06-11 14:20:46 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-06-09 23:36:47 -0500

Seen: 382 times

Last updated: Jun 11 '16