# Strange behavior and BorderInterpolate

**URL:** <https://forum.opencv.org/t/strange-behavior-and-borderinterpolate/7466>\
**Category:** C++\
**Tags:** android\
**Created:** [February 7, 2022, 11:05am UTC](https://forum.opencv.org/t/strange-behavior-and-borderinterpolate/7466 "2022-02-07T11:05:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Deymos\_s](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/deymos_s/32/3976_2.png) [@Deymos\_s](https://forum.opencv.org/u/Deymos_s)\
**Post date:** [February 7, 2022, 11:05am UTC](https://forum.opencv.org/t/strange-behavior-and-borderinterpolate/7466/1 "2022-02-07T11:05:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [February 7, 2022, 1:32pm UTC](https://forum.opencv.org/t/strange-behavior-and-borderinterpolate/7466/3 "2022-02-07T13:32:25Z")

</div>

> [@Deymos\_s](#):
>
> a segfault appears `"Unknown/unsupported border type in function 'borderInterpolate'"`

that’s not a segfault, but a runtime assertion ([and it should happen in 4.2.0, too](https://github.com/opencv/opencv/blob/4.2.0/modules/core/src/copy.cpp#L791))

what is your borderType, actually ? the default (BORDER\_CONSTANT) is well supported.

---

<div class="post-metadata">

**Author:** ![Deymos\_s](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/deymos_s/32/3976_2.png) [@Deymos\_s](https://forum.opencv.org/u/Deymos_s)\
**Post date:** [February 7, 2022, 5:14pm UTC](https://forum.opencv.org/t/strange-behavior-and-borderinterpolate/7466/4 "2022-02-07T17:14:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Deymos\_s](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/deymos_s/32/3976_2.png) [@Deymos\_s](https://forum.opencv.org/u/Deymos_s)\
**Post date:** [February 9, 2022, 9:11am UTC](https://forum.opencv.org/t/strange-behavior-and-borderinterpolate/7466/5 "2022-02-09T09:11:45Z")

</div>

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
