Ask Your Question

iamprivate's profile - activity

2018-03-29 13:38:47 -0600 received badge  Popular Question (source)
2016-08-20 14:53:51 -0600 received badge  Student (source)
2015-10-18 09:02:32 -0600 commented question Using AKAZE for feature extraction using opencv on android is extreamly slow, how can it be made faster ?

I personally prefer 512 x (previous height/previous width)*512 downsizing to extract descriptors. Reason being that modern phones have really good camera and algorithm ll slow down operating on such high quality image

2015-10-11 01:04:46 -0600 answered a question GrabCut Implementation in JAVA

I am not sure whether the code I am adding is the best way to do it but this is what I use. You can change one or two things (some lines are unnecessary) Hope it helps

    Mat local_image = color_chair.clone();
    Imgproc.grabCut(local_image, mask , rect, new Mat(), new Mat(), 5,choice);
    Mat fg_mask = mask.clone();
    Mat pfg_mask =mask.clone();
    Mat source = new Mat(1, 1, CvType.CV_8U, new Scalar(3.0));
    Core.compare(mask,source,pfg_mask,Core.CMP_EQ);
    source = new Mat(1, 1, CvType.CV_8U, new Scalar(1.0));
    Core.compare(mask,source,fg_mask,Core.CMP_EQ);
    Mat fg_foreground = new Mat(color_chair.size(),color_chair.type(),new Scalar(0,0,0));
    Mat pfg_foreground = new Mat(color_chair.size(),color_chair.type(),new Scalar(0,0,0));
    //display.show(pfg_mask);
    //display.show(fg_mask);
    Core.bitwise_or(pfg_mask, fg_mask, finalMask);
    //display.show(finalMask);
    color_chair.copyTo(fg_foreground,fg_mask);
    color_chair.copyTo(pfg_foreground,pfg_mask);
    Mat foreground = new Mat(fg_foreground.size(),CvType.CV_8UC3);
    Core.bitwise_or(fg_foreground, pfg_foreground, foreground);
2015-10-11 00:53:25 -0600 commented question Using AKAZE for feature extraction using opencv on android is extreamly slow, how can it be made faster ?

Have you tried downscaling or compressing image before finding feature points. It is usually better to do image processing on a server, then access the services from android.

2015-10-11 00:49:06 -0600 asked a question Limitations in using Feature detector OpenCV 3

In older version of OpenCV I was able to use different combination of feature detectors and feature discriptors. For example FAST with BRIEF , FAST with ORB, ORB with BRIEF and so on. But in OpenCV 3 I see its no more possible. For example I can use BRISK only with BRISK, AKAZE with AKAZE. I get error like this if I try otherwise

Assertion failed (0 <= kpts[i].class_id && kpts[i].class_id < static_cast<int>(evolution_.size()))

I wanted to use other feature detectors(Ex. FAST) with AKAZE descriptor since I see AKAZE doesnt give many points sometimes. Any leads on how can it be done ?
I am using JAVA OpenCV

2015-06-20 09:22:41 -0600 commented question svm java opencv 3

I didnt use any inbuilt function for BoW , but implemented manually , using features and kmeans, and then saving the histograms in text file

2015-06-20 09:18:09 -0600 received badge  Enthusiast
2015-06-10 03:07:10 -0600 commented question svm java opencv 3

Thanks I got the mistake. I original kept the data type of label as 32FC1 . Now I changed it to 32SC1. Now it works :)

     Mat labels = new Mat(new Size(1,totalSamples),CvType.CV_32SC1);        
    for (int i = 0; i < labels.rows(); i++) {
        int label =(i/40)+1;
                    // value 40 is number of samples per class
        labels.put(i, 0, label);
    }
    return labels;
2015-06-10 02:26:05 -0600 commented answer How to improve homography

When you match key points , you get result as MatOfDMatch. Convert that to List<dmatch> , then sort the list based on the distance , in ascending order . So now you can take 10 DMatch objects from list from i 0 to 10

DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING); MatOfDMatch matches = new MatOfDMatch(); matcher.match( descriptorsUser, descriptorsTemplate, matches ); List<dmatch> listMatches = matches.toList();

    Collections.sort(listMatches, new Comparator<DMatch>(){

        @Override
        public int compare(DMatch arg0, DMatch arg1) {
            if(arg0.distance<arg1.distance)
            return -1;
            else if(arg0.distance>arg1.distance)
            return 1;
            else
                return 0;
        }});

List<dmatch> goodMatches = listMatches.subList(0, 10);

2015-06-10 02:19:04 -0600 commented answer Iterating over contours of an Image in Java

You can for example ignore some based on their area

if(Imgproc.contourArea(contours.get(i))>max) { // add bigger contours to new list }

2015-06-09 15:55:16 -0600 answered a question Iterating over contours of an Image in Java

Do you mean something like this

 Imgproc.findContours(temp, contours, new Mat(),Imgproc.RETR_LIST,Imgproc.CHAIN_APPROX_NONE);

     for(int i =0;i<contours.size();i++)
     {
         // do something 
     }
2015-06-09 15:50:05 -0600 answered a question How to improve homography

Try using top matched points (like top 10) instead of applying threshold. Usually top matched points are good enough matches. I dont prefer using threshold coz you cant come up with best which fits for all

2015-06-09 13:15:54 -0600 asked a question svm java opencv 3

Hi, I am trying to implement BoW model using opencv java, but I am facing an issue while using SVM.Kindly help me to debug it. My code goes as follows

     SVM classifier = SVM.create();
     TermCriteria criteria = new TermCriteria(TermCriteria.EPS + TermCriteria.MAX_ITER,100,0.1);
 classifier.setKernel(SVM.LINEAR);
 classifier.setType(SVM.C_SVC);
 classifier.setGamma(0.5);
 classifier.setNu(0.5);
 classifier.setC(1);
 classifier.setTermCriteria(criteria);

 //data is N x 64 trained data Mat , labels is N x 1 label Mat with integer values;
 classifier.train(data, Ml.ROW_SAMPLE, labels);

 Mat results = new Mat();
 int label = (int) classifier.predict(testSamples, results, 0);
return label;

But while excecuting classifier.train() its throwing this error OpenCV Error: Bad argument (in the case of classification problem the responses must be categorical; either specify varType when creating TrainData, or pass integer responses) in cv::ml::SVMImpl::train, file C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\ml\src\svm.cpp, line 1610owing this error

2015-05-19 14:56:40 -0600 asked a question semantic segmentation

Hi, I want to implement an algorithm for semantic segmentation using OpenCV. As per my knowledge there is no current implementation of semantic segmentation in OpenCV . Is it possible to implement by myself with the help of functions in OpenCV. Are there any general steps to be followed to implement it (For ex: textonBoost + CRF)