I want to write a program for a raspberry pi witch can recognize road signs. I found that tutorial http://docs.opencv.org/doc/tutorials/features2d/feature_flann_matcher/feature_flann_matcher.html but when I try to run that I got following error "undefined reference to cv::Algorithm::~Algorithm". I'm including same library including features2d.hpp witch is now moved to the nonfree:
#include
↧
Undefined reference to algorithm
↧
OpenCV: VideoCapture::get(CV_CAP_PROP_POS_MSEC ) returns 0
I'm trying to timestamp the frames when recording video using OpenCV 3.1.0. However, when using VideoCapture::get(CV_CAP_PROP_POS_MSEC) to get the millisecond timestamp of the last frame grabbed the value returned is always 0.
The code I'm using:
int fps = 10;
VideoCapture cap(0); // open the default camera
cap.set(CV_CAP_PROP_FPS, fps);
cap.set(CV_CAP_PROP_FRAME_WIDTH, 1280);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, 1024);
if(!cap.isOpened()) // check if we succeeded
return -1;
Mat testFrame;
cap >> testFrame;
cap >> testFrame;
cap >> testFrame;
Size outSize = Size(testFrame.cols, testFrame.rows);
VideoWriter writer("video.avi", CV_FOURCC('M','J','P','G'), fps, outSize, true);
for(; ;)
{
Mat frame;
cap >> frame; // get a new frame from camera
long stamp = cap.get( CV_CAP_PROP_POS_MSEC ); // THIS DOESN'T SEEM TO WORK
std::cout << "Timestamp: " << stamp << std::endl;
writer.write(frame);
}
As output I always get many lines like the following:
Timestamp: 0
Could you help me understand what I'm doing wrong?
Thanks :)
↧
↧
How to fit an ellipse to fingertips ?

I want to fit ellipse to all the fingertips on this hand using the detected points.
How should I draw ellipse only at those specific places.
Should I store these points in array and draw an ellipse for closest ones?
Or is there any optimal solution to this.
↧
Exactly once after my computer wakes up, OpenCV 3.1.0 remap causes Intel HD Graphics 5500 to stop responding
I've tested this a couple of times; at one point in my code I call the OpenCV remap function, passing in a large roughly 2000x2000 pixel image into the function, and the destination image is roughly the same size as well. I am using the CV_INTER_LINEAR interpolation mode.
remap(image, projectedImage, mapX, mapY, CV_INTER_LINEAR);
Every time the code tries to execute this function, it crashes. The strange thing is that **this only occurs one time only** after I **wake up my computer from sleep**. Every time after that, **it executes perfectly.** Then if I sleep my computer and wake it up again, the program crashes one time only just like before, and executes successfully every time after that until I sleep my computer again.
This makes me think that there is some preprocessing parameter not being set right, or perhaps I need to configure my display driver differently. I have searched on Google very extensively and have not been able to pinpoint the solution to this issue. Can anybody offer any pointers here, or has anyone experienced this before?
↧
Microsoft C++ exception: cv::Exception at memory location
Iwant to implement a simple thresholding algorithm by comparing the pixel values of an image with some threshold and then assign either 0 or 1 to the pixels of output value correspondingly.
a part of the code is:
cv::Mat gray , binary; // gray is input and binary is output image.
binary = Mat::zeros(gray.size(), gray.type());
for (int i=0;i<=row;i++)
{
for (int j = 0; j <= col;j++)
{
if ((gray.at(i, j) > NiblackThreshold)
{
binary.at(i, j) = 1;
}
else
{
binary.at(i, j) = 0;
}
}
Exceptions is at:
template inline _Tp& Mat::at(int i0, int i1)
{
CV_DbgAssert( dims <= 2 && data && (unsigned)i0 < (unsigned)size.p[0] &&
(unsigned)(i1*DataType<_Tp>::channels) < (unsigned)(size.p[1]*channels()) &&
CV_ELEM_SIZE1(DataType<_Tp>::depth) == elemSize1());
return ((_Tp*)(data + step.p[0]*i0))[i1];
}
where is the problem?????
↧
↧
getting error: (-215) npoints >= 0 && npoints == std::max(ipoints.checkVector(2, CV_32F), ipoints.checkVector(2, CV_64F)) in function solvePnP , while running the loop.
This is the part of my code.When I run it runs perfectly for sometime and throws the above error. I tried to manage this by using flag to remove this but it gives error after sometime rather than giving instantaneously. Please help me to find the solution for this problem.
Thank you.
Pose.h
#ifndef POSE_H
#define POSE_H
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/core/core.hpp"
#include
#include
#include
#include
using namespace std;
using namespace cv;
class Pose
{
public:
Pose();
double* contour_detection(Mat threshold,Mat src);
double* pose_estimation(const std::vector&objectPoints,const std::vector&imagePoints);
private:
vector objectPoints ;
Mat cameraIntrinsicParams ;
Mat distCoeffs;
};
#endif // POSE_H
Pose.cpp
#include "Pose.h"
Pose::Pose()
{
objectPoints.push_back(cv::Point3f(240.f,680.f,715.f));
objectPoints.push_back(cv::Point3f(240.f,680.f,215.f));
objectPoints.push_back(cv::Point3f(615.f,680.f,215.f));
objectPoints.push_back(cv::Point3f(615.f,680.f,715.f));
cameraIntrinsicParams=Mat(Size(3,3),CV_32FC1);
cameraIntrinsicParams.at(0,0)= 727.957294f;
cameraIntrinsicParams.at(0,1)= 0 ;
cameraIntrinsicParams.at(0,2)= 320.f;//304.729528f;
cameraIntrinsicParams.at(1,0)= 0 ;
cameraIntrinsicParams.at(1,1)= 726.232798f;
cameraIntrinsicParams.at(1,2)= 240.f;//235.217420f;
cameraIntrinsicParams.at(2,0)= 0 ;
cameraIntrinsicParams.at(2,1)= 0 ;
cameraIntrinsicParams.at(2,2)= 1 ;
distCoeffs=Mat::zeros(Size(4,1),CV_64FC1);
}
double* Pose::contour_detection(Mat threshold, Mat src)
{
int flag =0;
int largest_area=0;
int largest_contour_index;
int lowThreshold;
int ratio=3;
int kernel_size=3;
int const max_lowThreshold = 100;
vectorPoints ;
vector< vector> contours; // Vector for storing contour
vector hierarchy;
Mat detected_edges;
blur(threshold, detected_edges, Size(3,3) );
/// Canny detector
Canny( detected_edges, detected_edges, lowThreshold,lowThreshold*ratio, kernel_size );
vector< vector> contours0;
findContours( detected_edges, contours0, hierarchy,CV_RETR_CCOMP,CV_CHAIN_APPROX_SIMPLE );
// Find the contours in the image
contours.resize(contours0.size());
std::vector imagePoints;
std::vector preciseCorners(4);
for( size_t k = 0; k < contours0.size(); k++ )
{
double a=contourArea( contours0[k],false); // Find the area of contour
if(a>largest_area)
{
largest_area=a;
largest_contour_index=k ;
approxPolyDP(Mat(contours0[largest_contour_index]), contours[largest_contour_index],9, true);
if(contours[k].size()==4)
{
for (int c=0;c<4;c++)
{
preciseCorners[c] = contours[largest_contour_index][c];
}
cv::cornerSubPix(threshold, preciseCorners, cvSize(5,5),cvSize(-1,-1), TermCriteria( CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 40, 0.001 ));
// cv::cornerSubPix(threshold, preciseCorners, cvSize(5,5),cvSize(-1,-1), cvTermCriteria(CV_TERMCRIT_ITER,30,0.1));
for (int c=0;c<4;c++)
{
contours[largest_contour_index][c] = preciseCorners[c];
}
imagePoints.push_back(Point2f(contours[largest_contour_index][0].x,contours[largest_contour_index][0].y));
imagePoints.push_back(Point2f(contours[largest_contour_index][1].x,contours[largest_contour_index][1].y));
imagePoints.push_back(Point2f(contours[largest_contour_index][2].x,contours[largest_contour_index][2].y));
imagePoints.push_back(Point2f(contours[largest_contour_index][3].x,contours[largest_contour_index][3].y));
Point P1=contours[largest_contour_index][0];
Point P2=contours[largest_contour_index][1];
Point P3=contours[largest_contour_index][2];
Point P4=contours[largest_contour_index][3];
line(src,P1,P2, Scalar(0,255,0),1,CV_AA,0);
line(src,P2,P3, Scalar(0,255,0),1,CV_AA,0);
line(src,P3,P4, Scalar(0,255,0),1,CV_AA,0);
line(src,P4,P1, Scalar(0,255,0),1,CV_AA,0);
flag =1;
}
}
}
// Pose estimation.
if(flag==1)
{
double *location=pose_estimation(objectPoints,imagePoints);
flag =0;
return location;
}
}
double* Pose::pose_estimation(const std::vector&objectPoints,const std::vector&imagePoints)
{
static double position[4];
Mat rvec,tvec;
bool useExtrinsicGuess = false;
int method =CV_ITERATIVE;
cv::solvePnP(objectPoints,imagePoints, cameraIntrinsicParams, distCoeffs,rvec, tvec,useExtrinsicGuess,method);
Mat distant=Mat(Size(3,3),CV_64FC1);
Mat jacobian=Mat(Size(3,1),CV_32FC1);
Rodrigues(rvec,distant,jacobian);
Mat J;
vector p(4);
projectPoints(objectPoints,rvec,tvec, cameraIntrinsicParams, distCoeffs, p, J);
float sum = 0.;
for (size_t i = 0; i (0,0);
position[1]=T.at(1,0);
position[2]=T.at(2,0);
return position;
}
↧
OpenCV print descriptor value
I'm writing a C++ program that should store in a MySQL DB the image descriptors value. I'm using ORB and as far as I know, I should have an 128 bit long value. When I run the following code
for (int p = 0; p < 500; p++){
if (p == 499){
cerr << "linia i coloana 0" << descriptors_2.row(p).col(0) << endl;
cerr << "linia i coloana 0" << descriptors_2.col(0).row(p) << endl;
cerr << (float)descriptors_2.at(p, 0);
float test = descriptors_2.at(p, 0);
cerr << "p,0" << test << endl;
}
}
I get the result shown in the picture.

I'm wondering if the hexa value is the one that I should store or is there something that I am doing wrong. Please help me find the problem.
↧
Get descriptor values in Android
I'm working on an app that uses ORB in order to detect some buildings. The values of the descriptor returned by the following code written in C++ are stored in a MySql database(my DB communicates with an Android app in order to detect the building):
Mat img2 = imread("C:\\Users\\timis\\Desktop\\test4.bmp");
Mat img1 = img2;
cvtColor(img2, img1, CV_BGR2GRAY);
if (!img1.data)
{
printf(" --(!) Eroare la citirea imaginii \n");
return -1;
}
std::vector keypoints_1, keypoints_2;
Mat descriptors_1, descriptors_2;
Ptr orb = ORB::create(500, 1.2, 8, 31, 0, 2, ORB::HARRIS_SCORE, 31, 20);
orb->detectAndCompute(img1, Mat(), keypoints_1, descriptors_1);
if (test == 1){
std::cout << "Found " << keypoints_1.size() << " Keypoints " << std::endl;
std::cout << descriptors_1 << std::endl;
std::cout << "Numar keypoints: "< Mat [ 335*32*CV_8UC1, isCont=true, isSubmat=false, nativeObj=0x63c8fd70, dataAddr=0x63c984e0 ]
Shouldn't I have all the values like in C++? Or is there some way that allows me to do this?
Please help me solve this problem.
↧
videoio error v4l2 setting property #0 is not supported
How to solve this?
↧
↧
Run-time Error Importing Caffe Models
When importing a caffe model I am getting the error convolution_layer.cpp:89:error:(-215) input.dims() ==4 && (input.type() == CV_32F || input.type() == CV_64F) in function cv::dnn::ConvolutionLayerImpl::allocate.
We never used to have this problem until recently we have rebuilt the libaries multiple times. We have had the program sucessfully run for quite some time importing and classifying with caffe models. However we lost the origional copies and as we reconstructed the new libaries this error has occured.
Issue has now been posted at this link: https://github.com/opencv/opencv_contrib/issues/749
↧
SVM returning a single value during prediction
I have trained an SVM for image classification as shown below. The training seem to be going on well but when I predict a row (any row of the training vector), SVM return just one value (60). What could I have done wrong? Is my training and testing approach right as shown in the function below?
void trainSVM(Mat hists, vector labels){
Ptr trainData = TrainData::create(hists, ml::ROW_SAMPLE, labels);
Ptr svm = SVM::create();
svm->setKernel(SVM::LINEAR);
cout << "Training SVM..." << endl;
svm->train(trainData);
bool trained = svm->isTrained();
if (trained)
{
cout << "SVM Trained. Saving..." << endl;
svm->save(".\\Trained Models\\LBPSVM.yml");
cout << "SVM Model Saved." << endl;
}
Mat_ output;
svm->predict(hists, output);
float pred = svm->predict(hists.row(34));
cout << "SVM Output = " << output.at(0) << endl;
writeMatToFile(output, "SVNPredict.csv");
}
The value stored in variable **pred** is the same regardless of the row I try to predict. It is the same value I get in my single column matrix **output**. All rows are populated with same value. Kindly help.
↧
How to draw an actual Car object in opencv viz module ?
I am working on a project where i need to make a 3D viewer that has a grid, on the grid there is a drawn trajectory and on that trajectory i have a Cube that follows the trajectory.
My question is, can i somehow use something from viz module and draw an actual car? An object that looks more ore less like a car and not a Cube (the object that i use now). I tried to combine some cubes with cones and spheres, and together form something, but looks very bad. Any idea would help me very much.
Thank you.
↧
Using ifstream in VS2015
Hello,
I am calling a function from OpenCV that uses ifstream in C++. ifstream doesn't seem to work when tried in isolation.
Ptr er_filter1 = createERFilterNM1(loadClassifierNM1("trained_classifierNM1.xml"), 8, 0.00015f, 0.13f, 0.2f, true, 0.1f);
But getting.....
OpenCV Error: Bad argument (Default classifier file not found!) in cv::text::ERClassifierNM1::ERClassifierNM1, file ~\opencv_contrib-3.1.0\modules\text\src\erfilter.cpp, line 1039
The offending line is.....
if (ifstream(filename.c_str()))
{
.. Stuff works ....
}
else
{
error!!
}
Everything worked in VS2013 but i have to switch to VS2015.
I cannot get ifstream to work at all, even though the file is located in the .exe folder itsself or project directory. Everywhere really.
It's like ifstream has stopped working during the switch to VS2015
https://github.com/opencv/opencv_contrib/blob/master/modules/text/src/erfilter.cpp#L1025
I have also tried the full path and adding files to VS2015 project resources folder.
↧
↧
cannot complied a opencv3.1 vdo sumarized program on visual studio 2015 c++
Dear Guru
I'm quite new about opencv. But I was able to run some opencv3.1 programs such as the car counting, the background subtraction.
However I tried to study about vdo summation with opencv c++.
reference source code link is https://github.com/lerker/OpenSourceVS
I found two errors as shown in

I could not complied that program properly.
Our environment are:


Please kindly assist to fix the issues.
Thank you very much
Banatuss@gmail.com
[1]: http://i.stack.imgur.com/wHkVE.jpg
↧
Why does changing the order of build arguments matter?
I've been struggling with a simple hello-world style opencv application in c++, and while it compiles fine, it wouldn't link due to unresolved references to any cv function (OutputArray, waitKey, etc)
From what I've read,
http://answers.opencv.org/question/25708/undefined-symbols-cv_outputarray_outputarraystd__1vectorcvmat-std__1allocatorcvmat/
the problem seemed to be a difference between how OpenCV was originally built on the VM, and how my application is being built
(
The VM I'm using is
https://github.com/razius/ppy-opencv-vagrant (Ubuntu 14.04.5 / OpenCV 2.4.13))
https://github.com/dvreed77/vagrant-opencv
)
I *WAS* trying to build the application this way,
g++ -O2 `pkg-config --cflags --libs opencv` test.cpp -o test.out
but changing it to this, the linker suddenly builds fine:
g++ -O2 -o test.out test.cpp `pkg-config opencv --cflags --libs`
What is happening differently that makes it work?
↧
Problem with OcrTesseract class.
Hello everyone,
I hope you are all well. I have installed opencv with extra modules with help of this [https://putuyuwono.wordpress.com/2015/04/23/building-and-installing-opencv-3-0-on-windows-7-64-bit/] tutorial. During configuration stage I have a message which says "Tesseract: NO"
After installation I have created a simple scene text detection project. And I have succesfully detected text in images.
After this part, I have tried to run ocr with below code.
// img1 is a CV_8UC3 typed mat image. and output is a string variable.
Ptr ocr = OCRTesseract::create();
ocr->run(img1, output);
This piece of code runs without any error but does not give me any ocr result. I have tried different images but result is the same.
I have also tried to set parameters for create function.
Ptr ocr = OCRTesseract::create("C:\\Program Files (x86)\\Tesseract-OCR\\tessdata", "eng", "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
Unfortunatelly this did not went well too. I did not get any errors but did not get a result too.
How can I make my code work?
Thanks in advance.
Here is full log generated after I hit configure button in CMAKE.
FP16: Compiler support is available
found IPP (ICV version): 9.0.1 [9.0.1]
at: C:/opencv-3.0/source/opencv/3rdparty/ippicv/unpack/ippicv_win
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR= option to cmake
Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "2.7")
Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "2.6")
Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "3.4")
Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE) (Required is at least version "3.2")
Found apache ant 1.8.2: C:/NVPACK/apache-ant-1.8.2/bin/ant.bat
Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN)
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
Caffe: NO
Protobuf: NO
Glog: NO
Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR)
Build libprotobuf from sources:
libprotobuf not found into system
The protocol buffer compiler not found
Tesseract: NO
General configuration for OpenCV 3.1.0-dev =====================================
Version control: unknown
Extra modules:
Location (extra): C:/opencv-3.0/source/opencv_contrib/modules
Version control (extra): unknown
Platform:
Timestamp: 2016-08-19T14:52:58Z
Host: Windows 10.0.10586 AMD64
CMake: 3.6.1
CMake generator: Visual Studio 14 2015 Win64
CMake build tool: C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
MSVC: 1900
C/C++:
Built as dynamic libs?: YES
C++ Compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe (ver 19.0.23506.0)
C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /wd4251 /wd4324 /wd4275 /wd4589 /MP4 /MD /O2 /Ob2 /DNDEBUG /Zi
C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /EHa /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /wd4251 /wd4324 /wd4275 /wd4589 /MP4 /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
C Compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
C flags (Release): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /MP4 /MD /O2 /Ob2 /DNDEBUG /Zi
C flags (Debug): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /MP4 /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
Linker flags (Release): /machine:x64 /INCREMENTAL:NO /debug
Linker flags (Debug): /machine:x64 /debug /INCREMENTAL
Precompiled headers: YES
Extra dependencies: comctl32 gdi32 ole32 setupapi ws2_32 vfw32
3rdparty dependencies: zlib libjpeg libwebp libpng libtiff libjasper IlmImf libprotobuf
OpenCV modules:
To be built: core flann imgproc ml photo reg surface_matching video dnn fuzzy imgcodecs shape videoio highgui objdetect plot superres ts xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib datasets rgbd stereo structured_light tracking videostab xfeatures2d ximgproc aruco optflow stitching
Disabled: world contrib_world
Disabled by dependency: -
Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 python3 viz cvv hdf matlab sfm
Windows RT support: NO
GUI:
QT: NO
Win32 UI: YES
OpenGL support: NO
VTK support: NO
Media I/O:
ZLib: build (ver 1.2.8)
JPEG: build (ver 90)
WEBP: build (ver 0.3.1)
PNG: build (ver 1.6.19)
TIFF: build (ver 42 - 4.0.2)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 1.7.1)
GDAL: NO
GDCM: NO
Video I/O:
Video for Windows: YES
DC1394 1.x: NO
DC1394 2.x: NO
FFMPEG: YES (prebuilt binaries)
codec: YES (ver 57.48.101)
format: YES (ver 57.41.100)
util: YES (ver 55.28.100)
swscale: YES (ver 4.1.100)
resample: NO
gentoo-style: YES
GStreamer: NO
OpenNI: NO
OpenNI PrimeSensor Modules: NO
OpenNI2: NO
PvAPI: NO
GigEVisionSDK: NO
DirectShow: YES
Media Foundation: NO
XIMEA: NO
Intel PerC: NO
Parallel framework: Concurrency
Other third-party libraries:
Use IPP: 9.0.1 [9.0.1]
at: C:/opencv-3.0/source/opencv/3rdparty/ippicv/unpack/ippicv_win
Use IPP Async: NO
Use Eigen: NO
Use Cuda: NO
Use OpenCL: YES
Use custom HAL: NO
OpenCL:
Include path: C:/opencv-3.0/source/opencv/3rdparty/include/opencl/1.2
Use AMDFFT: NO
Use AMDBLAS: NO
Python 2:
Interpreter: NO
Python 3:
Interpreter: NO
Python (for build): NO
Java:
ant: C:/NVPACK/apache-ant-1.8.2/bin/ant.bat (ver 1.8.2)
JNI: C:/NVPACK/jdk1.7.0_71/include C:/NVPACK/jdk1.7.0_71/include/win32 C:/NVPACK/jdk1.7.0_71/include
Java wrappers: NO
Java tests: NO
Matlab: Matlab not found or implicitly disabled
Documentation:
Doxygen: NO
PlantUML: NO
Tests and samples:
Tests: YES
Performance tests: YES
C/C++ Examples: NO
Install path: C:/opencv-3.0/build/install
cvconfig.h is in: C:/opencv-3.0/build
-----------------------------------------------------------------
Configuring done
↧
choose features of different feature desciptors
Hi ,
I have more than 4 type of things (knife, spoon, fork etc...) train images. I have to obtain different feature extraction algorithm performance and different learning algorithm (ie. SIFT, SURF, BRISK features to use SVM, MLP, etc.). When I use SIFT, SURF they return descriptors as matrix(features of keypoints ) for one type of train image. How can I down grade or select among features of this matrix to row vector (featurtes) that enough to train MLP or SVM ? For example SIFT algorithm return 100 keypoints and each keypoint have 128 feature for one type of things of train image. It means 100 rows x 128 column matrix. What is the next step ?
↧
↧
Unhandled exception at Microsoft C++ exception: cv::Exception at memory location
I have created the custom build the OpenCV with a current repo of OpenCV and opencv_contri_module When there is an assign of MATRIX OR VECTOR, this unhandled exception with memory allocation is thrown.
Why is this error thrown?
Please help, thanks.
↧
calibration between mouse move & pupil move (eye writer)
hello
i write program for detect face & then detect **Right eye** & then detect pupil (circle hough) Finally move mouse.
The problem I have is that Move the mouse range is low.
the range of motion mouse is 20 x 20 pixels.
Mouse cursor moves only in a very small area of the desktop.
**I need Mouse cursor moves in all area of the desktop.**
This code get the coordinates of the center of the circular Hough and then cursor is moved .
......
......
.....
void mousemove(int x_pos, int y_pos)
{
///Strings that will contain the conversions
string xcord; string ycord;
///These are buffers or something? I don't really know... lol.
stringstream sstr; stringstream sstr2;
///Conversion to regular string happens here
sstr<<5*x_pos;
xcord = sstr.str();
sstr2<<5*y_pos;
ycord = sstr2.str();
///Getting the command string
string command = "xdotool mousemove " + xcord + " " + ycord;
///Converting command string to a form that system() accepts.
const char *com = command.c_str();
system(com);
}
int main()
{
CascadeClassifier face_cascade("/home/elinux/opencv-3.1.0/data/haarcascades_cuda/haarcascade_frontalface_alt2.xml");
CascadeClassifier eye_cascade("/home/elinux/opencv-3.1.0/data/haarcascades_cuda
/haarcascade_righteye_2splits.xml");
....
....
...
morphologyEx(framepupil, morph_grad, MORPH_GRADIENT,se,Point(-1,-1),1);
HoughCircles(morph_grad, circles, HOUGH_GRADIENT, 1, 1000, 100,15, 10,20);
if(circles.size()!=0){
(circles[t][0])=(circles[t][0])*((circles[t][0])/10);
(circles[t][1])=(circles[t][1])*((circles[t][1])/10);
mousemove((circles[t][0]),(circles[t][1]));
}
....
.....
....
Here are the all codes:
[https://github.com/Ehsan-Shahnazi/EyeWriter/blob/master/22-22.cpp](https://github.com/Ehsan-Shahnazi/EyeWriter/blob/master/22-22.cpp)
**How should calibration between eye positions and cursor positions??**
Do you have code samples?
(Perhaps the problem of how to track pupil or codes to move the mouse or...???)
thanks
↧
opencv 2.4.11 BackgroundSubtractorMOG2 problems with background and foreground
I'm having problems getting BackgroundSubtractorMOG2 to work.
I'm using:
1) OpenCV 2.4.11 (x64)
2) Visual Studio 2010
Here are 2 problems I'm experiencing:
1) The foreground (e.g. fgMask) and background (e.g. bgImg) don't seem correct. The background image is identical to the current image (e.g. frame), and the foreground image looks like it might only have been computed from a single frame.
2) When I include the line mog2.set("detectShadows",false); the fgMask output is all white (i.e. 255).
Sample Code:
double learningRate = 0.01; //I've tried a few other values too
cv::BackgroundSubtractorMOG2 mog2;
//mog2.set("detectShadows",false); //including this line causes fgMask to be all white
mog2.set("nShadowDetection", 20);
for each image fileName //replaced C++ for conditions line w/ psuedocode for simplicity
{
cv::Mat frame;
frame = cv::imread(fileName, CV_LOAD_IMAGE_GRAYSCALE);
if( frame.empty())
{
std::cout << "frame is empty" << std::endl;
break;
}
cv::Mat fgMask;
mog2(frame, fgMask, learningRate);
//display images
cv::imshow("original", frame);
cv::imshow("fgMask", fgMask);
cv::imshow("bgImg", bgImg);
keyboard = cv::waitKey(10000);
cv::destroyAllWindows();
}
↧