Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt run time error in using compute function of HOG descriptor

Qt run time error in using compute function of HOG descriptor

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sai Kamat
    wrote on last edited by
    #1

    I am using Qt-Creator 5.2.0 to create a GUI to display the Image and a binary classifier to detect the object is present or absent using Dalal & triggs HOG extraction algorithm.

    I am facing the mentioned Run time error & need help to solve this issue.
    mainwindow.h
    @#ifndef MAINWINDOW_H
    #define MAINWINDOW_H

    #include <QMainWindow>
    #include<QDebug>
    #include <opencv2/calib3d/calib3d.hpp>
    //#include <opencv2/calib3d/calib3d.hpp>
    #include<opencv2/core/core.hpp>
    #include<opencv2/features2d/features2d.hpp>
    #include<opencv2/highgui/highgui.hpp>
    #include<opencv2/imgproc/imgproc.hpp>
    #include<opencv2/ml/ml.hpp>
    #include<opencv2/objdetect/objdetect.hpp>
    using namespace cv;
    
    namespace Ui {
    class MainWindow;
    }
    
    class MainWindow : public QMainWindow
    {
        Q_OBJECT
    
    public:
        explicit MainWindow(QWidget *parent = 0);
        ~MainWindow();
    

    private:
    Ui::MainWindow *ui;
    };
    float SVM_classifier(Mat image);

    #endif // MAINWINDOW_H@
    

    mainwindow.cpp
    @#include "mainwindow.h"
    #include "ui_mainwindow.h"

    MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent),
        ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    
       IplImage *oMatDeltaImage  = cvLoadImage("E:\\Wihart\\Car_Images\\(785).jpg",CV_LOAD_IMAGE_UNCHANGED);
    
        Mat mat_img(oMatDeltaImage );
        float oMatResult =  SVM_classifier(mat_img);
    //    qDebug()<<oMatResult;
    
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    float SVM_classifier(Mat image)
    {
    
            resize(image, image, Size(64,128) );
    
            HOGDescriptor extract_features;
            vector<float> descriptorsValues;
            vector<Point> locations;
            extract_features.compute( image, descriptorsValues, Size(0,0), Size(0,0), locations);
    
            Mat feature_vector(descriptorsValues);// = Mat::zeros((descriptorsValues.size(),1));
            CvSVM SVM;
            SVM.load("SVM_classifier_data.xml");
            float result= SVM.predict(feature_vector);
            return result;
    }@
    

    main.cpp
    @#include "mainwindow.h"
    #include <QApplication>

    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        MainWindow w;
        w.show();
    
        return a.exec&#40;&#41;;
    }@
    

    This is the error i faced at
    Line:
    @ extract_features.compute( image, descriptorsValues, Size(0,0), Size(0,0), locations);@

    Exception triggered:
    "The inferior stopped because it triggered an exception.
    Stopped in thread 0 by Exception 0xf8b3b11, code: 0xc0000005: write access violation at 0x1, flags= 0x0 (first chance)."

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Since you don't tell exactly what error you have, I would say that your application can't find the OpenCV dlls. So you need to update the Run panel PATH environment variable and add the path to OpenCV dlls there

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Sai Kamat
        wrote on last edited by
        #3

        Hi SGaist, sorry about that. I've included the error now.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then you should run your application through the debugger to see exactly where you are accessing something invalid

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved