aashari/example-android-camera-scanner

Null array of points issue

Closed this issue · 2 comments

i get this error when i try to call "nativeClass.getPoint(tempBitmap);"
// this is my error
Attempt to invoke virtual method 'org.opencv.core.Point[] org.opencv.core.MatOfPoint2f.toArray()' on a null object reference

it always calls this block of code
List rectangles = getPoints(downscaled);
if (rectangles.size() == 0) {
return null;
}

try this it sovle your issue. it show error when not detect rectangle in scan image

 if (isRectangle(approx, srcArea)) {
      rectangles.add(approx);
 }else{
       rectangles.add(approx);
 }