Ask Your Question
0

Assertion failed (ssize.area > 0) cv::resize, Bus error on ARMHF

asked 2014-04-24 21:20:15 -0500

Josh123 gravatar image

updated 2014-05-20 13:43:02 -0500

Edit: I have found out that the error listed in the title also occurs on amd64 machines after attempting to debug the application and terminating it prematurely. All I can assume is buggy OpenCV/V4L code causing this. Once again a reboot fixes the issue until the next debug attempt. Running works fine.

This problem occurs only sometimes: when calling cv::resize my application crashes and prints "Assetion failed (ssize.area > 0)." I use the same size (30, 32) to scale my matrix every time and the src matrix is set by the camera. I have a feeling this is a bug in opencv or the camera API it uses (V4L). Using a different camera temporarily solves the problem. When I run this program on a machine using ARMHF instead of AMD64 the program quits printing "Bus error." The OpenCV version I used to write the application is 2.4.8, the version on the ARMHF machine is 2.3.1. I am using Debian and c++11 if it matters.

The offending code is

cv::resize(videoMat, scaled, scaledSize, 0, 0, CV_INTER_AREA);

Where videoMat is a cv::Mat updated by an instance of cv::VideoCapture, scaled is a cv::Mat to hold the scaled matrix information, and scaledSize is the size I wish to scaled to (30, 32).

edit retag flag offensive close merge delete

Comments

2

if assert(ssize>0) failed, it means that your src image had empty size(was invalid).

berak gravatar imageberak ( 2014-04-24 23:29:13 -0500 )edit

After a reboot the application stops crashing and printing that error message, it must be a bug in the camera API. I can probably work around this problem, but what about the bus error on ARMHF?

Josh123 gravatar imageJosh123 ( 2014-04-26 14:10:49 -0500 )edit

oh, dear, honestly - i got no idea, what you're talking about. (ARMHF ?)

might be a good idea now, to edit your question again, and show some (offending) code.

berak gravatar imageberak ( 2014-04-26 15:36:55 -0500 )edit

Sorry for the late reply, I have a cubieboard (an embeded system) which uses the ARMHF architecture (HF stands for hardware float, but it is not too important). The program is running on this embeded system. The offending code is simply a call to cv::resize(), however the error seems to cease on my AMD64 system (a laptop computer) after a reboot. On my embeded system I always get the error "Bus error" when trying to run the program.

Josh123 gravatar imageJosh123 ( 2014-05-03 11:26:41 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-05-20 14:56:06 -0500

Josh123 gravatar image

updated 2014-05-20 14:57:30 -0500

It appears there was two separate issues. The Bus error was caused by this line of code

if (scaled.at<double>(x, y) > AppUtils::BLACK_CUTOFF)

Because Mat::at returns a reference rather than the actual value, it seems that the comparison did not work the same way on a computer with the ARM arhitecture. I added

double pixel = scaled.at<double>(x, y);

to make sure the value was compared, rather then the address. As for the Assertion failed, it appears that is due to a buggy camera driver (probably).

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2014-04-24 21:20:15 -0500

Seen: 9,332 times

Last updated: May 20 '14