Ask Your Question

sirflippy's profile - activity

2018-11-28 13:53:00 -0500 received badge  Popular Question (source)
2016-07-22 20:35:24 -0500 received badge  Student (source)
2016-04-17 21:43:07 -0500 commented question How to train Local Binary Patterns to SVM

I have a problem. Using CV_32FC1 does not output an array inside H that looks like [0,1,0,1,0,0,1......] while using CV_8UC1 outputs the right array but will return a SEHException at svm->train().

2016-04-17 07:22:17 -0500 commented question How to train Local Binary Patterns to SVM

^^^updated

2016-04-17 07:21:37 -0500 received badge  Editor (source)
2016-04-17 06:40:50 -0500 commented question How to train Local Binary Patterns to SVM

It triggered a breakpoint at normalize();

2016-04-17 06:18:17 -0500 commented question How to train Local Binary Patterns to SVM
  1. I am trying to make a classifier that will classify images with similar patterns, like grass and stones.
  2. Done
  3. I changed it to float and it won't run
  4. 3.0.0
  5. Done
2016-04-16 18:46:20 -0500 asked a question How to train Local Binary Patterns to SVM
 public: cv::Mat LBP(Mat pic1){
        bool affiche = true;
        Mat Image(pic1.rows, pic1.cols, CV_8UC1), lbp(pic1.rows, pic1.cols, CV_8UC1);
        cvtColor(pic1, Image, CV_BGR2GRAY);
        unsigned center = 0, center_lbp = 0;
        Mat H(1, 256, CV_32FC1, Scalar::all(0));
        for (int row = 1; row < Image.rows - 1; row++)
        {
            for (int col = 1; col < Image.cols - 1; col++)
            {
                center = Image.at<float>(row, col);
                center_lbp = 0;
                if (center <= Image.at<float>(row - 1, col - 1))
                    center_lbp += 1;
                if (center <= Image.at<float>(row - 1, col))
                    center_lbp += 2;
                if (center <= Image.at<float>(row - 1, col + 1))
                    center_lbp += 4;
                if (center <= Image.at<float>(row, col - 1))
                    center_lbp += 8;
                if (center <= Image.at<float>(row, col + 1))
                    center_lbp += 16;
                if (center <= Image.at<float>(row + 1, col - 1))
                    center_lbp += 32;
                if (center <= Image.at<float>(row + 1, col))
                    center_lbp += 64;
                if (center <= Image.at<float>(row + 1, col + 1))
                    center_lbp += 128;
                lbp.at<float>(row, col) = center_lbp;
                H.at<float>(center_lbp) += 1;
            }
        }
        normalize(H, H, 0, 1, NORM_MINMAX, -1, Mat());
        textureData.push_back(H);
        return H;
    }

I am a beginner in openCV. The code above is inside a function that should return the finished training data. My problem is that I don't know how to get the numbers inside H and how to create the training data for the SVM. Can somebody help me with this?

2016-04-14 14:47:22 -0500 asked a question How to add more data to an already trained SVM?

I'm experimenting with the SVM shown as an example in the opencv docs.