Why is this triggering EXC_BAD_ACCESS?
Sometimes this code triggers a critical error. I tried to put every condition I could think of to prevent bad input, but it's still not working sometimes.
- (Vec3f)extractColorWithKeyframe:(Keyframe*)keyframe WithPosition:(Point2f)position
{
Mat image = keyframe.originalImage;
if (image.rows < 1 || image.cols < 1 || ![keyframe.camera isInFrame:position withBoundary:0] || image.channels() < 4)
return Vec3f(0,0,0);
Vec4b bgra;
bgra = image.at<Vec4b>(position.x, position.y);
Any clue?
weird language:
![keyframe.camera isInFrame:position withBoundary:0]
please clarify / add a resp. language tag (and please without any # shit).
Ah that is Objective C. It's just a check to see if position is inside the image.
Added the beginning of the method as well.
PS: I was using the hashtags because they come up first in the auto-complete
yea, not your fault. known limitation/problem with the site in general.
(though a great litmus test to see, who cares...)
hey, again, apologies for sounding somewhat grumpy, you don't deserve it.
I solved it, had a stupid variable shadowing in an upper for loop that was passing a null reference for the position in this method, so it would "seem" valid to the compiler, but at runtime it would crash. No worries, everybody has a bad day, but keep contributing to the OpenCV community!
you might be able to answer your own question now...