Skip to main content

Posts

Showing posts from September, 2011

Blobs with opencv (internal function)

There are many open source opencv BLOB libraries that you can use. i have tried several of these, however because of the 64 bit machine that im using recompiling these are very troublesome. If you have heard of these libraries: "cvBlobsLib": http://opencv.willowgarage.com/wiki/cvBlobsLib   "cvBlob": http://code.google.com/p/cvblob/   "Bloblib" by Dave Grossman (also referred to as "Blob Analysis Package"): Go to http://tech.groups.yahoo.com/group/OpenCV/files/  You will know that opencv also has a built in function that can help you find blobs using cv::findContour and see some statistics using the cv::moments. eventually make these functions similar to regionprops Matlab function The BLOB FINDER CLASS: class atsBlobFinder { public:     atsBlobFinder(cv::Mat src)     {         numBlobs = 0;         cv::Mat img; //must create a temporary Matrix to hold the gray scale or wont work         cv::cvtColor(src,img,CV_BGR

finding the center of gravity in opencv

Alot of feature detectors such as the Haar classifier will return rectangular shapes presented as a detected feature. one of the things to do in order to track these, is to find the center of the rectangle.   int main( int argc, char** argv ) { atscameraCapture movie; char code = (char)-1; for(;;)         {             //get camera             cv::Mat imgs = movie.ats_getImage(); #define drawCross( center, color, d, img )                                 \             line( img, Point( center.x - d, center.y - d ),                \             Point( center.x + d, center.y + d ), color, 2, CV_AA, 0); \             line( img, Point( center.x + d, center.y - d ),                \             Point( center.x - d, center.y + d ), color, 2, CV_AA, 0 )             cv::Point center;             //given 2 points representing the rectangle             cv::Point topLeft(100,100);             cv::Point bottomRight(200,200);             cv::rectangle(imgs,topLeft,bottom

2D/3D estimation using solvePnP in opencv (NOT SOLVED)

In opencv "solvePnP" is used to find known points on a known 3D object. doing so the objects orientation relative to the camera coordinate system can be found. the function is equivalent to finding the extrinsic camera parameters. which makes me believe its more for planar objects. need to do a few more experiments to find out why. im using code from: http://www.morethantechnical.com/2010/03/19/quick-and-easy-head-pose-estimation-with-opencv-w-code/    #include <opencv2/core/core.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/calib3d/calib3d.hpp> #include <opencv2/highgui/highgui.hpp> #include <iostream> #include <string> using namespace cv; #include <vector> using namespace std; #include <GL/gl.h> #include <GL/glu.h> #include <glut.h> void loadNext(); void loadWithPoints(Mat& ip, Mat& img); const GLfloat light_ambient[]  = { 0.0f, 0.0f, 0.0f, 1.0f }; const GLfloat light_diffuse[]  =

Opencv with OpenGL (installation and trials)

so i needed to install opengl for a 2D/3D test using opencv since Opengl libraries come preinstalled just needed to download GLUT from: http://www.xmission.com/~nate/glut.html since im running on a 64bit machine i need to place the GLUT32.dll in the C:\Windows\SysWOW64 instead of C:\Windows\System32 i then place the GLUT.h in the: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include and the GLUT32.lib in the C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib in the visual studio dependencies i just add the following: opengl32.lib glut32.lib glu32.lib and im all set and good to go with the test program /**********************************   Simple.cpp   A simple GLUT program. ****************************************************************************/ #include <string.h> #include <glut.h> void mydisplay( void ) {     glClearColor (0.0, 0.0, 0.0, 0.0);     glClear(GL_COLOR_BUFFER_BIT);     /* set drawing/fill  color