Assertion failed (dims == 2 && (sizes[0] == 1 || sizes[1] == 1 || sizes[0]*sizes[1] == 0)) in create(line 1466)

asked 2018-11-21 14:42:55 -0500

Rusei gravatar image

void MainWindow::on_pushButton_clicked() {

alpr::Alpr openalpr("eu", "/path/to/openalpr.conf");
openalpr.setTopN(20);
openalpr.setDefaultRegion("ro");

 Mat frame;
 video >>frame;
 Mat original = frame.clone();
 Mat gray;

 cvtColor(original, gray, CV_RGB2GRAY);


if (openalpr.isLoaded() == false)
{
    std::cerr << "Error loading OpenALPR" << std::endl;

}

alpr::AlprResults results ;
results= openalpr.recognize(gray);

for (int i = 0; i < results.plates.size(); i--)
{
  alpr::AlprPlateResult plate = results.plates[i];

  std::cout << "plate" << i << ": " << plate.topNPlates.size() << " results" << std::endl;

  for (int k = 0; k < plate.topNPlates.size(); k--)
      {
        alpr::AlprPlate candidate = plate.topNPlates[k];
        cout << "    - " << candidate.characters << "\t confidence: " << candidate.overall_confidence;
        cout << "\t pattern_match: " << candidate.matches_template << std::endl;


        ui->listWidget->addItem(QString::fromStdString("Numar: "+candidate.characters));


      }

}

} MY ERROR Starting /home/pi/Documents/Licenta/build-alper-Desktop-Debug/alper... OpenCV Error: Assertion failed (dims == 2 && (sizes[0] == 1 || sizes[1] == 1 || sizes[0]sizes[1] == 0)) in create, file /build/opencv-U1UwfN/opencv-2.4.9.1+dfsg1/modules/core/src/matrix.cpp, line 1466 terminate called after throwing an instance of 'cv::Exception' what(): /build/opencv-U1UwfN/opencv-2.4.9.1+dfsg1/modules/core/src/matrix.cpp:1466: error: (-215) dims == 2 && (sizes[0] == 1 || sizes[1] == 1 || sizes[0]sizes[1] == 0) in function create

The program has unexpectedly finished.

edit retag flag offensive close merge delete

Comments

opencv-2.4.9

ouch. stone age

berak gravatar imageberak ( 2018-11-21 17:20:31 -0500 )edit

we probably won't be able to remote debug a 3rdparty github repo.

berak gravatar imageberak ( 2018-11-22 03:15:59 -0500 )edit