Ask Your Question

Rajind's profile - activity

2015-02-11 23:26:25 -0600 received badge  Enthusiast
2015-02-10 01:49:08 -0600 asked a question Getting masked area to be transparent ?

So far i have managed to use masks and get the second image from the first. But what i want is the black area in second image to be transparent (i.e the output i an trying to get is the third image) Here is the code so far. Please advice me on this.

    //imwrite parameters
compression_params.push_back(CV_IMWRITE_JPEG_QUALITY);
compression_params.push_back(100);

//reading image to be masked
image = imread(main_img, -1);

//CV_LOAD_IMAGE_COLOR

namedWindow("output", WINDOW_NORMAL);
//imshow("output", image);

//Creating mask image with same size as original image
Mat mask(image.rows, image.cols, CV_8UC1, Scalar(0));


// Create Polygon from vertices
ROI_Vertices.push_back(Point2f(float(3112),float(58)));
ROI_Vertices.push_back(Point2f(float(3515),float(58)));
ROI_Vertices.push_back(Point2f(float(3515),float(1332)));
ROI_Vertices.push_back(Point2f(float(3112),float(958)));

approxPolyDP(ROI_Vertices, ROI_Poly, 1, true);

// Fill polygon white
fillConvexPoly(mask, &ROI_Poly[0] , ROI_Poly.size(), 255, 8, 0);                 

//imshow("output", mask);

// Create new image for result storage
imageDest = cvCreateMat(image.rows, image.cols, CV_8UC4);

// Cut out ROI and store it in imageDest
image.copyTo(imageDest, mask);

imwrite("masked.jpeg", imageDest, compression_params);
imshow("output", imageDest);

cvWaitKey(0);

image description

image description

image description

2015-01-27 04:27:20 -0600 commented question error C2248: 'CvSVM::CvSVM' : cannot access private member declared in class 'CvSVM'

Thank you very much. I'll try that. :)

2015-01-27 03:13:13 -0600 commented question error C2248: 'CvSVM::CvSVM' : cannot access private member declared in class 'CvSVM'

Thank you for your comments. Lines 146 gives the error. classes_classifiers[class_].train(samples_32f,labels);

I didn't know about `void glob(string dirname, vector<string> files); I'll look into that.

2015-01-27 01:36:50 -0600 asked a question error C2248: 'CvSVM::CvSVM' : cannot access private member declared in class 'CvSVM'

I am trying to use bag of features model and train and SVM. I am using this tutorial and this sample code. I am using Windows 8 and OpenCV 2.4.10. I am running this on Visual Studio 2012. But i am continuously getting this error 'CvSVM::CvSVM' : cannot access private member declared in class 'CvSVM' I tried using OpenCV 2.4.9 but same error is still there.

I searched a lot for this and still could not find a proper solution for this. Please help me on this. Thanks in advance. Below is the code. I am using this Dirent API for Microsoft Visual Studio as well.

EDIT: Lines 146 gives the error. classes_classifiers[class_].train(samples_32f,labels);

This is complete output from visual studio when compiling the main.cpp.

------ Build started: Project: ConsoleApplication1, Configuration: Debug x64 ------
1>  main.cpp
1>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\utility(138): error C2248: 'CvSVM::CvSVM' : cannot access private member declared in class 'CvSVM'
1>          D:\Program Files\opencv\build\include\opencv2/ml/ml.hpp(553) : see declaration of 'CvSVM::CvSVM'
1>          D:\Program Files\opencv\build\include\opencv2/ml/ml.hpp(452) : see declaration of 'CvSVM'
1>          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\map(198) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2>::pair<const std::basic_string<_Elem,_Traits,_Alloc>&,CvSVM>(_Other1,_Other2 &&,void **)' being compiled
1>          with
1>          [
1>              _Ty1=std::basic_string<char,std::char_traits<char>,std::allocator<char>>,
1>              _Ty2=CvSVM,
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>,
1>              _Other1=const std::basic_string<char,std::char_traits<char>,std::allocator<char>> &,
1>              _Other2=CvSVM
1>          ]
1>          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\map(198) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2>::pair<const std::basic_string<_Elem,_Traits,_Alloc>&,CvSVM>(_Other1,_Other2 &&,void **)' being compiled
1>          with
1>          [
1>              _Ty1=std::basic_string<char,std::char_traits<char>,std::allocator<char>>,
1>              _Ty2=CvSVM,
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>,
1>              _Other1=const std::basic_string<char,std::char_traits<char>,std::allocator<char>> &,
1>              _Other2=CvSVM
1>          ]
1>          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\map(191) : while compiling class template member function 'CvSVM &std::map<_Kty,_Ty>::operator [](const std::basic_string<_Elem,_Traits,_Alloc> &)'
1>          with
1>          [
1>              _Kty=std::string,
1>              _Ty=CvSVM,
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>          main.cpp(146) : see reference to function template instantiation 'CvSVM &std::map<_Kty,_Ty>::operator [](const std::basic_string<_Elem,_Traits,_Alloc> &)' being compiled
1>          with
1>          [
1>              _Kty=std::string,
1>              _Ty=CvSVM,
1>              _Elem=char,
1>              _Traits=std::char_traits<char>,
1>              _Alloc=std::allocator<char>
1>          ]
1>          main.cpp(123) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled
1>          with
1>          [
1>              _Kty=std::string,
1>              _Ty=CvSVM
1>          ]
========== Build ...
(more)