Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Opencv + Hog + SVM... i want to know the recipe please

I train my SVM and create a vector file:

clasificador = new CvSVM(); clasificador.train_auto(trainingData, classes, new Mat(), new Mat(), params); clasificador.save("asdf.xml");

now am lost... ok, i load the xml file with CVSVM

how i implement the CVSVM with the HogDescriptor ?

sorry about the spanglish

Opencv + Hog + SVM... i want to know the recipe please

I train my SVM and create a vector file:

clasificador = new CvSVM();

clasificador.train_auto(trainingData, classes, new Mat(), new Mat(), params); clasificador.save("asdf.xml");

now am lost... ok, i load the xml file with CVSVM

how i implement the CVSVM with the HogDescriptor ?

sorry about the spanglish

This is my LOAD and image analisis. Where "imag" its the captured frame, "clasificador" its a CVSVM, "hog" its a HogDescriptor

private static void buscar_hog_svm() {

    if (clasificador == null) {
        clasificador = new CvSVM();
        clasificador.load(path_vectores);
    }

    Mat img_gray = new Mat();

    Imgproc.cvtColor(imag, img_gray, Imgproc.COLOR_BGR2GRAY);

    hog = new HOGDescriptor(
            _winSize //new Size(32, 16)
            , _blockSize, _blockStride, _cellSize, _nbins);
    MatOfFloat descriptorsValues = new MatOfFloat();
    MatOfPoint locations = new MatOfPoint();
    hog.compute(img_gray,
            descriptorsValues,
            _winSize,
            _padding, locations);
    Mat fm = descriptorsValues;
    float result = clasificador.predict(fm);
}

Opencv + Hog + SVM... i want to know the recipe please

I train my SVM and create a vector file:

clasificador = new CvSVM();
CvSVM(); clasificador.train_auto(trainingData, classes, new Mat(), new Mat(), params); clasificador.save("asdf.xml");

clasificador.train_auto(trainingData, classes, new Mat(), new Mat(), params); clasificador.save("asdf.xml");

now am lost... ok, i load the xml file with CVSVM

how i implement the CVSVM with the HogDescriptor ?

This is my LOAD and image analisis. Where "imag" its the captured frame, "clasificador" its a CVSVM, "hog" its a HogDescriptor

private static void buscar_hog_svm() {

    if (clasificador == null) {
        clasificador = new CvSVM();
        clasificador.load(path_vectores);
    }

    Mat img_gray = new Mat();

    Imgproc.cvtColor(imag, img_gray, Imgproc.COLOR_BGR2GRAY);

    hog = new HOGDescriptor(
            _winSize //new Size(32, 16)
            , _blockSize, _blockStride, _cellSize, _nbins);
    MatOfFloat descriptorsValues = new MatOfFloat();
    MatOfPoint locations = new MatOfPoint();
    hog.compute(img_gray,
            descriptorsValues,
            _winSize,
            _padding, locations);
    Mat fm = descriptorsValues;
    float result = clasificador.predict(fm);
}