Strange behavior and BorderInterpolate

Hello, I am writing a cross-platform application for pc and android using opencv, the purpose of my application is streaming video, but there was a problem with borderInterpolate on android, then I thought that the problem might be in the image from the smartphone camera, and just took a picture on the camera and inserted a photo into the program for checking, as a result, everything works fine on the PC version, all points are found, the face is recognized, but on android, when trying to recognize the face, a segfault appears "Unknown/unsupported border type in function 'borderInterpolate'"
it happens in the line
cv::warpAffine(im,I,A,wsize,cv::INTER_LINEAR+cv::WARP_INVERSE_MAP);
but this does not happen in the pc version of the application, the code is the same, the picture is also the same.
pc opencv 420
android opencv 4.5.4
if i can attach some pictures of debug info it would be nice, but I don’t know if I have such permissions on this forum.

that’s not a segfault, but a runtime assertion (and it should happen in 4.2.0, too)

what is your borderType, actually ? the default (BORDER_CONSTANT) is well supported.

yes, it’s default BORDER_CONSTANT, it’s really strange, since I set the same conditions for two applications, the picture is loaded in rgb32 format, since the pictures from the phone are always upside down, I rotate it counterclockwise using cv::rotate.

here some code snippets:
void Processor::updateFrame(const cv::Mat &frame)
{
vectorcv::Rect faces = faceDetector->detect(frame);
}

this function returns 0 faces for some reason, when i output faces.size(), app crashes with borderInterpolate
vector FaceDetector::detect(const Mat &image, const float scaleFactor, const int minNeighbours, const Size minSize)
{
Mat gray;
if(image.channels()==1)
gray = image;
else
cvtColor(image,gray,cv::COLOR_RGB2GRAY);
vector faces;
Mat eqIm;
equalizeHist(gray,eqIm);
cascadeClassifier.detectMultiScale(eqIm,faces,scaleFactor,minNeighbours,0|cv::CASCADE_FIND_BIGGEST_OBJECT |cv::CASCADE_SCALE_IMAGE,minSize);
return faces;
}

Do you have any idea why this might be happening? Or does this not happen often? The most annoying thing is that the problem occurs only on android, if the PC application also crashed, it would be easier to understand what the problem is.

I solved the problem by building opencv 4.2.0 on android, I don’t know why it occurs on the latest version, but everything works fine on 4.2.0, maybe it will come in handy for someone

1 Like