2016-02-06 01:45:17 -0600
| asked a question | Capturing image from video in opencv Hi.. I'm working ona framework capturing image from video using webcam and compare with list of images using SURF. I'm clueless on capturing image from video using webcam. Any reference to refer? |
2016-01-24 03:11:20 -0600
| received badge | ● Enthusiast
|
2016-01-22 17:27:49 -0600
| asked a question | Hi. I'm using Euclidean distance to find the min distance between the keypoints. Yet I'm still getting the wrong output mostly. Could you guide me? BFMatcher matcher(NORM_L2);
vector<DMatch> matches;
matcher.match(descriptors_1, descriptors_2, matches);
double max_dist = 0; double min_dist = 100; double sum_dist = 0;
//-- Quick calculation of max and min distances between keypoints
for (int k = 0; k < descriptors_1.rows; k++)
{
double dist = matches[k].distance;
sum_dist = sum_dist + dist;
if (sum_dist < min_dist) min_dist = dist;
if (sum_dist > max_dist) max_dist = dist;
}
if (min_dist < mindist)
{
mindist = min_dist;
matchInd = j;
}
|
2016-01-02 15:49:31 -0600
| commented question | Hi. I'm can't resize the size of images I saved in text file to a particular size. Got it. Managed to fix it. Thanks man.. |
2016-01-02 14:14:47 -0600
| commented question | Hi. I'm can't resize the size of images I saved in text file to a particular size. Just tried. but the output is still the same. Same as the original size. |
2016-01-02 13:58:43 -0600
| received badge | ● Editor
(source)
|
2016-01-02 13:57:01 -0600
| asked a question | Hi. I'm can't resize the size of images I saved in text file to a particular size. for (unsigned int i = 0; i < testImages.size(); i++)
{
Mat img_2;
img_2 = testImages[i];
Size size(50,50);//the dst image size,e.g.100x100
Mat dst;//dst image
resize(img_2,dst,size);//resize image
}
|
2015-12-22 11:29:56 -0600
| commented question | reading number of images from txt file Hi.. I have sorted out the issue. But the read_imgList function reading both text files giving error. static void read_imgList(const string& filename, vector<Mat>& trainImages, vector<Mat>& testImages) {
std::ifstream file(filename.c_str(), ifstream::in);
if (!file) {
string error_message = "No valid input file was given, please check the given filename.";
CV_Error(CV_StsBadArg, error_message);
}
|
2015-12-21 23:20:36 -0600
| commented question | reading number of images from txt file Hi.. I have sorted out the issue. But the read_imgList function reading both text files giving error. static void read_imgList(const string& filename, vector<Mat>& trainImages, vector<Mat>& testImages) {
std::ifstream file(filename.c_str(), ifstream::in);
if (!file) {
string error_message = "No valid input file was given, please check the given filename.";
CV_Error(CV_StsBadArg, error_message);
}
|
2015-12-20 02:28:01 -0600
| commented question | reading number of images from txt file I tried to load the image in the txt file in this line. But I couldn't load the image. I'm not sure whether I'm doing the right one. This line of code is to load a single image from directory. Not sure how to make a loop to read all the images listed in the txt file. Mat img_2 = imread(imgList[1], CV_LOAD_IMAGE_GRAYSCALE);
if (!img_2.data)
{ std::cout << " --(!) Error reading images " << std::endl; return -1;
}
The loop to read from txt file for (unsigned int i = 0; i < images.size(); i++)
{
Mat img_1;
img_1 = images[i];
if (!img_1.data)
{
std::cout << " --(!) Error reading images " << std::endl; return -1;
}
|
2015-12-20 00:53:46 -0600
| asked a question | reading number of images from txt file Hi. I managed to read an image from directory and compare it with number of images from txt file.How to convert it as reading number of images from txt file instead reading an image from directory static void read_imgList(const string& filename, vector<Mat>& images) {
std::ifstream file(filename.c_str(), ifstream::in);
if (!file) {
string error_message = "No valid input file was given, please check the given filename.";
CV_Error(CV_StsBadArg, error_message);
}
string line;
while (getline(file, line)) {
images.push_back(imread(line, 0));
}
}
int main(int argc, char** argv)
{
if (argc != 3)
{
readme(); return -1;
}
string imgList = string(argv[1]);
vector<Mat> images;
try {
read_imgList(imgList, images);
}
catch (cv::Exception& e) {
cerr << "Error opening file \"" << imgList << "\". Reason: " << e.msg << endl;
exit(1);
}
Mat img_2 = imread(imgList[1], CV_LOAD_IMAGE_GRAYSCALE);
if (!img_2.data)
{ std::cout << " --(!) Error reading images " << std::endl; return -1;
}
//-- Step 1: detect the keypoints using SURF Detector
int minHessian = 400;
SurfFeatureDetector detector(minHessian);
SurfDescriptorExtractor extractor;
//-- Test img, detect the keypoints
std::vector<KeyPoint> keypoints_2;
detector.detect(img_2, keypoints_2);
//-- Step 2: calculate descriptors (feature vectors)
Mat descriptors_2;
extractor.compute(img_2, keypoints_2, descriptors_2);
double mindist = 100;
int matchInd = -1;
for (unsigned int i = 0; i < images.size(); i++)
{
Mat img_1;
img_1 = images[i];
if (!img_1.data)
{
std::cout << " --(!) Error reading images " << std::endl; return -1;
}
|