Ask Your Question

encinaar's profile - activity

2019-03-16 19:41:14 -0600 received badge  Popular Question (source)
2014-05-10 05:37:39 -0600 commented answer Finding the center of eye pupil

Does not work for me

2014-05-01 17:19:37 -0600 asked a question Finding the center of eye pupil

I want to find the center of eye pupil. Here are the steps that I followed:

1- Obtained eye image from the extracted face image: image description

2- Thresholding the grayscale eye image with the following settings: Max value: 255 Threshold: 60 Threshold Type: CV_THRESH_BINARY image description

3- I can't find the contour of the eye pupil from the image above. So I applied dilatation first opencv_imgproc.cvDilate(left_eye, left_eye, null, 3); image description

4- Need to rescale it: opencv_imgproc.cvErode(left_eye, left_eye, null, 6); image description

Now the problem is to find eye center as fast as possible. How can I achieve such a goal?

2014-04-20 18:25:29 -0600 asked a question Equivalent of cv::PCA in JavaCV

I am converting codes written in C++ to Java for an Android application. I could not find the equivalent of cv::PCA at line 152. What is the equivalent of PCA class in JavaCV?

.cpp source: https://github.com/Itseez/opencv/blob/master/samples/cpp/pca.cpp#L129

2013-05-25 06:22:05 -0600 received badge  Editor (source)
2013-05-23 16:44:48 -0600 asked a question Can not distinguish two insects by using SIFT

I wan to create a classifier in order to identify an insect by its captured image. At the first time, I used HuMomemnts but images captured in different resolutions gave incorrect results since HuMoments are scale variant. After doing some search on the internet, I found that usage SIFT and SURF can solve my problem and thus, I tried to see what happens when I use SIFT. The first two images below belongs to to different insect kind. The results was bizarre since all features out of 400 were matching (see 3rd image).

image description image description image description

int main()
{
Mat src = imread(firstInsect);
Mat src2 = imread("secondInsect");

if(src.empty() || src2.empty())
{
    printf("Can not read one of the image\n");
    return -1;
}

//Detect key point in the image
SiftFeatureDetector detector(400);
vector<KeyPoint> keypoints;
detector.detect(src, keypoints);

//cout << keypoints.size() << " of keypoints are found" << endl;

cv::FileStorage fs(firstInsectXML, FileStorage::WRITE);
detector.write(fs);
fs.release();


SiftFeatureDetector detector2(400);
vector<KeyPoint> keypoints2;
detector.detect(src2, keypoints2);

cv::FileStorage fs2(secondInsectXML,  FileStorage::WRITE);
detector.write(fs2);
fs2.release();


//Compute the SIFT feature descriptors for the keypoints
//Multiple features can be extracted from a single keypoint, so the result is a
//matrix where row "i" is the list of features for keypoint "i"

SiftDescriptorExtractor extractor;
Mat descriptors;
extractor.compute(src, keypoints, descriptors);

SiftDescriptorExtractor extractor2;
Mat descriptors2;
extractor.compute(src2, keypoints2, descriptors2);


//Print some statistics on the matrices returned
//Size size = descriptors.size();
//cout<<"Query descriptors height: "<<size.height<< " width: "<<size.width<< " area: "<<size.area() << " non-zero: "<<countNonZero(descriptors)<<endl;



//saveKeypoints(keypoints, detector);


Mat output;
drawKeypoints(src, keypoints, output, Scalar(0, 0, 255), DrawMatchesFlags::DEFAULT);
imwrite(firstInsectPicture, output);

Mat output2;
drawKeypoints(src2, keypoints2, output2, Scalar(0, 0, 255), DrawMatchesFlags::DEFAULT);
imwrite(secondInsectPicture, output2); 


//Corresponded points
BFMatcher matcher(NORM_L2);
vector<DMatch> matches;
matcher.match(descriptors, descriptors2, matches);

cout<< "Number of matches: "<<matches.size()<<endl;

Mat img_matches;
drawMatches(src, keypoints, src2, keypoints2, matches, img_matches);
imwrite(resultPicture, img_matches); 

system("PAUSE");
waitKey(10000);

return 0;

}

Question 1: Why all of the features are matching in these two images? Question 2: How can I store(i.e. XML file) features of an image in a way that the features can be stored in order to train them in a classification tree (i.e. random tree)?

EDIT:

image description image description

Working on grayscale images does not give different results. Matching 2 same kind of insects and matching 2 different kind of insects produces same number of matches.