Ask Your Question

Dionysos's profile - activity

2017-05-24 10:01:25 -0600 received badge  Famous Question (source)
2016-10-12 19:42:28 -0600 received badge  Notable Question (source)
2016-08-22 02:49:28 -0600 received badge  Popular Question (source)
2016-02-05 06:37:57 -0600 received badge  Student (source)
2015-02-01 09:51:05 -0600 asked a question Is Mat thread-safe ?

Two of my threads need to read/write into the same Mat declared as global variable. Is Mat thread-safe or should I take care of it ? What can you recommend me ? Thanks

2015-02-01 09:02:46 -0600 commented question findcontours finds too many contours.

Steve, that's what I thought but I was using a binary image (the top one). The bottom one is the contours drawn (where you see that there's too many).

2015-01-31 14:13:10 -0600 commented question findcontours finds too many contours.

I found the problem. It wasn't using CV_RETR_TREE. findContours only works properly on "edge images". So you have to run canny first

2015-01-31 09:35:57 -0600 asked a question findcontours finds too many contours.

Is it normal that find contours finds so many contours where there are obviously only 3 contours ? image description

image description

The code is :

Mat image;
    vector<vector<Point> > contours;
    vector<Vec4i> hierarchy;
    image = imread(argv[1], 0);   // Read the file
    findContours(image, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));
    cout << contours.size();


    RNG rng(12345);
    Mat drawing = Mat::zeros(image.size(), CV_8UC3);
    for (int i = 0; i< contours.size(); i++)
    {
        Scalar color = Scalar(rng.uniform(0, 255), rng.uniform(0, 255), rng.uniform(0, 255));
        drawContours(drawing, contours, i, color, 2, 8, hierarchy, 0, Point());
    }
    /// Show in a window
    namedWindow("Contours", CV_WINDOW_AUTOSIZE);
    imshow("Contours", drawing);
namedWindow("Display window", WINDOW_AUTOSIZE);// Create a window for display.
    imshow("Display window", image);                   // Show our image inside it.
2015-01-30 09:37:40 -0600 received badge  Scholar (source)
2015-01-30 09:36:42 -0600 commented question How do I threshold this Image correctly?

Try adaptive thresholding

2015-01-30 09:30:38 -0600 received badge  Nice Answer (source)
2015-01-30 09:17:02 -0600 received badge  Teacher (source)
2015-01-30 07:29:39 -0600 commented question inRange with HSV values

Convert your image to HSV using the cvtcolor function before feeding it to inRange

2015-01-30 03:37:17 -0600 received badge  Enthusiast
2015-01-28 12:59:02 -0600 asked a question Is there a built-in function to calculate the variance of a cv::Mat ?

This is in order to normalize the cv::Mat before feeding it to an ANN

2015-01-26 00:32:35 -0600 asked a question Is there a direct way to print a Mat on one line ?

I want to print it on one line in a file, because this is the format of the training files of the ANN I am using. Instead of two loops, is there some prebuilt function for that ?

2015-01-25 13:32:27 -0600 received badge  Editor (source)
2015-01-25 13:21:54 -0600 asked a question What is the best interpolation method for my case ?

I want to resize some images (that range from 20 by 20 pixel to 110 by 110 pixel) to 20*20 pixel (for ANN training). There are many options for cv:resize. What is the most accurate for my case ? (performance is of no concern here).