Ask Your Question

NathanSn's profile - activity

2019-08-14 02:20:34 -0600 received badge  Notable Question (source)
2018-07-11 10:39:57 -0600 received badge  Popular Question (source)
2016-04-10 14:34:00 -0600 commented question Active Contours OpenCV 3.1.0

@berak, I have round low contrast objects which are very close to each other. Sometimes they overlap. I need to segment them.

2016-04-10 12:27:38 -0600 commented question Active Contours OpenCV 3.1.0

@berak, for segmentation.

2016-04-10 12:00:41 -0600 asked a question Active Contours OpenCV 3.1.0

Can anyone tell me if OpenCV 3.1.0 has implementation of Active Contours?

2016-04-05 13:02:02 -0600 received badge  Supporter (source)
2016-04-04 05:40:51 -0600 asked a question ml::TrainData responses difference between type CV_32F and CV_32S

In the documentation to OpenCV 3.1.0 I've found

If the responses are scalar, they should be stored as a single row or as a single column. The matrix should have type CV_32F or CV_32S (in the former case the responses are considered as ordered by default; in the latter case - as categorical)

Can anyone explain, please, what is the actual difference between storing responses in CV_32F and CV_32S? Meaning of this

(in the former case the responses are considered as ordered by default; in the latter case - as categorical)

sentence from the documentation.

2016-04-04 04:01:52 -0600 received badge  Student (source)
2016-04-04 03:06:41 -0600 commented question OpenCV BoW assert error while computing histograms for SVM training

If I do not use cross check option in BFMatcher then everything works fine for any value of K. Can someone explain what means this cross check option? I thought that for each keypoint it gives exactly one codeword from dictionary.

2016-04-04 01:34:23 -0600 received badge  Editor (source)
2016-04-04 01:29:13 -0600 asked a question OpenCV BoW assert error while computing histograms for SVM training

I am trying to do classification of images with combining SIFT features, Bag of Visual Words and SVM. Now I am on training part. I need to get BoW histograms for each training image to be able to train SVM. For this I am using BOWImgDescriptorExtractor from OpenCV. I am using OpenCV version 3.1.0. The problem is that it computes histogram for some images, but for some of images it gives me this error:

OpenCV Error: Assertion failed (queryIdx == (int)i) in compute, 
file /Users/opencv-3.1.0/modules/features2d/src/bagofwords.cpp, line 200

libc++abi.dylib: terminating with uncaught exception of type 
cv::Exception: /Users/opencv-3.1.0/modules/feature/src/bagofwords.cpp:200: error: (-215) queryIdx == (int)i in function compute

Training images are all of the same size, all have same number of channels. For creating dictionary I use another image set than for training SVM.

Here's part of code:

Ptr<FeatureDetector> detector(cv::xfeatures2d::SIFT::create());
Ptr<DescriptorMatcher> matcher(new BFMatcher(NORM_L2, true));
BOWImgDescriptorExtractor bow_descr(det, matcher);
bow_descr.setVocabulary(dict);
Mat features_svm;
for (int i = 0; i < num_svm_data; ++i) {
    Mat hist;
    std::vector<KeyPoint> keypoints;
    detector->detect(data_svm[i], keypoints);
    bow_descr.compute(data_svm[i], keypoints, hist);
    features_svm.push_back(hist);
}

data_svm is a vector<Mat> type. It is my training set images which I will use in SVM. I have draw keypoints, print hist for images they looks good. I tried changing from SIFT to SURF it works for some images for which SIFT does not, but it also does not work for all. If I train dictionary on all images I also receive the same problem.

When I change size of the BoW dictionary form K = 200 to K = 1000 number of images which raise error decreases.

What the problem can be?