Ask Your Question

Robionic's profile - activity

2016-11-28 09:21:50 -0600 received badge  Notable Question (source)
2016-02-10 07:16:31 -0600 received badge  Popular Question (source)
2015-11-26 12:32:56 -0600 received badge  Popular Question (source)
2013-10-17 09:05:07 -0600 commented answer convert string^ to char* windows form application c++

@StevenPuttemans Yes, sure I would do that next time.. :)

2013-10-17 04:18:03 -0600 commented question Adding environment variable to system path

Entering in the system variable is enough. And in the path editor give it as %OPENCV_DIR%\bin .Then it should work. If you did the same..it should work.. Check the old installation in Windows link of OpenCV and follow the instructions again..

2013-10-17 02:59:18 -0600 commented question Adding environment variable to system path

Instead of using the command prompt, why don't you set the environment variables in the system properties itself . I have been always doing that, and it has been always successful. Moreover there is no need to check it in the system32 folder too. The steps are as follows

right click My Computer
click Properties
go to Advanced system settings
click on Advanced tab
click on Environment Variables
click on New...

Now you can define an environment variable, just type OPENCV_DIR in Variable name and in Variable value the path D:\OpenCV\Build\x64\vc10 and check it in path editor..

2013-10-17 02:46:51 -0600 commented question convert string^ to char* windows form application c++

I have not worked on Windows Form applications, but what you ask for can be found in this link, hope this helps..

http://support.microsoft.com/kb/311259

2013-10-15 07:16:23 -0600 commented question Problems with cvSmooth

Hai Martin,Did you try with aperture height/width smaller than 11. Was it then giving the same problem too.. Might be a smaller aperture should work well without giving any bad pixels..

2013-10-14 08:10:03 -0600 received badge  Student (source)
2013-10-14 07:51:15 -0600 asked a question Masking the area outside a 2D set of grid points OpenCV

I am working on circles/ellipse detection for a set of points and reconstruction of the detected points. I am struck at a specific image processing problem. The following is the sample image upon which the processing is to be performed,

Click here (The red points in the image are manually drawn to emphasize the 16x16 grid)

The task to be performed is to mask the image with black outside the 16x16 grid point rectangle. I have obtained the center points and radius of all the circles/Ellipses based on the Moments and Fit Ellipse methods. Now I need to detect the corners of the rectangle, and mask the image outside the rectangle to black.

My code till detecting the centers of the circles can be seen below,

    int ImgProcessor::Do_BoundBoxes(Mat IpImg)
{
    //Parameter Initialization________________________________________________________
    double thresh=100, max_thresh = 255;
    int ksize_w = 3 ;
    int ksize_h = 3;

    //Read the image as a matrix
    Mat TempImg;
    //resize(IpImg, IpImg ,Size(), 0.5,0.5, INTER_AREA);

    //Preprocessing__________________________________________________________
    GaussianBlur( IpImg, TempImg, Size(ksize_w, ksize_h),2,2);
    threshold(TempImg,TempImg, thresh,max_thresh, 0);
    GaussianBlur( TempImg, TempImg, Size(ksize_w, ksize_h),2,2);


    vector<vector<Point> > contours;
    vector<vector<Point> > updated_contours;
    vector<Vec4i> hierarchy;
    vector<int> contour_arealist;
    double contour_area;
    RNG rng(12345);
    double threshold_area = 10;
    findContours( TempImg, contours, hierarchy, RETR_TREE, CHAIN_APPROX_SIMPLE, Point(0, 0) );

    //Update the contour vector elliminating those less than thresholds
    for( int i = 0; i < contours.size(); i++ )
    {
    contour_area = contourArea(contours[i]);
    if (contour_area >= threshold_area)
    {
    //contour_arealist.push_back(contour_area);
    updated_contours.push_back(contours[i]);
    }
    else
    {   continue ;
    }
    }

    /// Approximate contours to polygons + get bounding rects and circles
    vector<vector<Point> > contours_poly( updated_contours.size() );
    vector<Rect> boundRect( updated_contours.size() );
    vector<Point2f>center( updated_contours.size() );
    vector<float>radius( updated_contours.size() );



    //Get the bounding rectangles, minimum enclosing circles for the updated contours
    for( int i = 0; i < updated_contours.size(); i++ )
     { 

        approxPolyDP( Mat(updated_contours[i]), contours_poly[i], 3, true );
        boundRect[i] = boundingRect( Mat(contours_poly[i]) );
        minEnclosingCircle( (Mat)contours_poly[i], center[i], radius[i] );

     }




    /// Draw polygonal contour + bonding rects + circles
    Mat drawing = Mat::zeros( TempImg.size(), CV_8UC3 );
    for( int i = 0; i< updated_contours.size(); i++ )
     {
       Scalar color = Scalar( rng.uniform(0, 255), rng.uniform(0,255), rng.uniform(0,255) );
       drawContours( drawing, contours_poly, i, color, 1, 8, vector<Vec4i>(), 0, Point() );
       rectangle( drawing, boundRect[i].tl(), boundRect[i].br(), color, 2, 8, 0 );
       circle( drawing, center[i], (int)radius[i], color, 2, 8, 0 );
     }
    printf("\t Info: Area and Contour Length \n");
    for( size_t i = 0; i< center.size(); i++ )
     {
         printf(" %.2f  %.2f %.2f \n", center[i].x, center[i].y,radius[i]) ;

    }
}

How this can be really approached ? I was thinking to draw rectangles by finding the diagonal points of the rectangle, but the entire set of grid points are not always present. I also tried implementing the Pick's theorem, but then I need to remove the points outside the grid. Can I use k-nearest neighbours approach.

2013-07-29 05:01:02 -0600 commented question Detect/Fitting Circles using Hough Transform in OpenCV 2.4.6

Yes.. it is a binary image I am working upon...and I had observed the images at every step of the preprocessing.. The Canny edges can be seen here for your further examination, cannyedge Do I need to dilate them further ? Will it be of any help ?

2013-07-29 04:33:15 -0600 commented question Detect/Fitting Circles using Hough Transform in OpenCV 2.4.6

@StevenPuttemans Can you please explain it in a more detailed manner.. I would be greatful..

2013-07-29 03:09:27 -0600 commented question Detect/Fitting Circles using Hough Transform in OpenCV 2.4.6

I too think so.. I am actually also trying out various other methods like moments based, contours and fitellipse based techniques.. But I still do not understand, why does this method doesn't work for this specific image.. I will try for some more time, and skip to the next method..

2013-07-28 15:53:21 -0600 received badge  Editor (source)
2013-07-28 15:51:27 -0600 asked a question Detect/Fitting Circles using Hough Transform in OpenCV 2.4.6

Hi All,

The main objective is ti detect the main 5-point white circles in the image.The test image in which the circles have to be detected is the one shown here 640x480. It is a low resolution image, please download the original image here,1280x1024

I am using different methods to bring out a evaluation of various circle/ellipse detection methods. But somehow I am not able to fix my simple Hough transform code. It does not detect any circles. I am not clear whether the problem is with pre-processing step, or the parameters of the HoughCircle. This is my code. Please help me in this regards,

Header file

 #ifndef IMGPROCESSOR_H
 #define IMGPROCESSOR_H

// OpenCV Library
#include <opencv2\opencv.hpp>
#include <iostream>

using namespace cv;
using namespace std;

class ImgProcessor{
public:
    Mat OpImg ;
    ImgProcessor();
    ~ImgProcessor();

    //aquire filter methods to image
    int  Do_Hough(Mat IpImg);

 };
#endif /* ImgProcessor_H */

Source file

#include "ImgProcessor.h"
#include <opencv2\opencv.hpp>
#include "opencv2\imgproc\imgproc.hpp"
#include "opencv2\imgproc\imgproc_c.h"
#include <vector>

using namespace cv;


ImgProcessor::ImgProcessor(){
    return;
}
ImgProcessor::~ImgProcessor(){
    return;
}

//Apply filtering for the input image
int ImgProcessor::Do_Hough(Mat IpImg)

{
    //Parameter Initialization________________________________________________________
    double sigma_x, sigma_y, thresh=250, max_thresh = 255;
    int ksize_w = 5 ;
    int ksize_h = 5;
    sigma_x = 0.3*((ksize_w-1)*0.5 - 1) + 0.8 ;
    sigma_y = 0.3*((ksize_h-1)*0.5 - 1) + 0.8 ;

    vector<Vec3f> circles;

    //Read the image as a matrix
    Mat TempImg;
    //resize(IpImg, IpImg ,Size(), 0.5,0.5, INTER_AREA);

    //Preprocessing__________________________________________________________

    //Perform initial smoothing
    GaussianBlur( IpImg, TempImg, Size(ksize_w, ksize_h),2,2);

    //perform thresholding
    threshold(TempImg,TempImg, thresh,thresh, 0);

    //Remove noise by gaussian smoothing
    GaussianBlur( TempImg, TempImg, Size(ksize_w, ksize_h),2,2);
    /*imshow("Noisefree Image", TempImg);
    waitKey(10000);*/

    //Obtain edges
    Canny(TempImg, TempImg, 255,240 , 3);
    imshow("See Edges", TempImg);
    waitKey(10000);

    //Increase the line thickness
    //dilate(TempImg,TempImg,0,Point(-1,-1),3);

    //Hough Circle Method______________________________________________________________

    // Apply the Hough Transform to find the circles
    HoughCircles( TempImg, circles, 3, 1, TempImg.rows/32, 255, 240, 5, 0 );
    // Draw the circles detected
    for( size_t i = 0; i < circles.size(); i++ )
    {
         Point center(cvRound(circles[i][0]), cvRound(circles[i][1]));
         int radius = cvRound(circles[i][2]);
         // circle center
         circle( IpImg, center, 3, Scalar(0,255,0), -1, 8, 0 );
         // circle outline
         circle( IpImg, center, radius, Scalar(0,0,255), 3, 8, 0 );
    }

   // Show your results
    namedWindow( "Hough Circle Transform", WINDOW_AUTOSIZE );
    imshow( "Hough Circle Transform", IpImg );

   // waitKey(0);
   return 0;   





}

int main(int argc, char** argv)
{
    ImgProcessor Iclass;
    //char* imageName = argv[1];
    string imageName = "D:/Projects/test_2707/test_2707/1.bmp";
    Mat IpImg = imread( imageName );
    cvtColor(IpImg, IpImg,6,CV_8UC1);
    Iclass.Do_Hough(IpImg);
    /*Iclass.Do_Contours(IpImg);*/
    return 0;
}
2013-06-12 06:34:22 -0600 commented answer Visual Studio throws an exception when I run a simple program

Thank you very much for your reply...The issue is resolved.. Thanks for this insight.. Else I would have thought there are some installation problems..

2013-06-12 04:20:33 -0600 asked a question Visual Studio throws an exception when I run a simple program

I am a newbie to Open CV and I am facing an odd error while compiling a simple open CV program. The program is as follows

#include <opencv2\highgui.hpp>
#include <opencv2\imgproc.hpp>
using namespace cv;
int main( int argc, char** argv )
{
  Mat image = imread( "image.jpg", 0 );
 Mat gray_image;
 cvtColor( image, gray_image, COLOR_BGR2GRAY);
 imwrite( "Gray_Image.jpg", gray_image);
 namedWindow( "Actual Image", WINDOW_AUTOSIZE );
 namedWindow( "Gray image", WINDOW_AUTOSIZE );
 imshow( "Actual Image", image );
 imshow( "Gray image", gray_image );
 waitKey(0);
 return 0;
}

It throws me an exception error saying

Unhandled exception at 0x7c812afb in helloworld.exe: Microsoft C++ exception: cv::Exception at memory location 0x0011e25c

I am able to continue compiling the program, by clicking on the continue option, and finally obtain the output too.

I tried using debugger/breakpoints and found the error in

cvtColor( image, gray_image, COLOR_BGR2GRAY);

I double checked the arguments for the same, but I am not able to resolve the exact error.

2013-06-11 02:45:27 -0600 received badge  Supporter (source)
2013-06-11 02:45:14 -0600 received badge  Scholar (source)
2013-06-10 04:36:03 -0600 asked a question Compatibility with Windows XP and Visual Studio 2005

How far is Open CV 2.4.5 compatible with Visual Studio 2005 running in Windows XP. Will it have any installation problems ? As the controller designed for a specific robot based application is only compatible with Visual Studio 2005, hence I need to decide on the version.

Needs of Open CV : Ellipse fitting, probabilistic machine learning algorithms, homograpy estimation.

Please help me decide on whether it is really advisable to use the Visual Studio 2005. Which version of Open CV is compatible with VS 2005, and what can you recommend.

Thanks in advance.