Ask Your Question

unxnut's profile - activity

2020-11-02 10:44:57 -0600 received badge  Popular Question (source)
2020-10-20 13:13:58 -0600 received badge  Notable Question (source)
2019-07-23 11:29:45 -0600 received badge  Popular Question (source)
2018-07-17 08:52:12 -0600 received badge  Great Answer (source)
2018-07-17 08:52:12 -0600 received badge  Guru (source)
2018-02-13 06:15:32 -0600 received badge  Notable Question (source)
2017-12-31 03:06:14 -0600 received badge  Popular Question (source)
2017-12-03 09:11:36 -0600 received badge  Famous Question (source)
2017-06-01 16:57:08 -0600 asked a question Houghcircles not acting properly

I have an application where I need to look at multiple [almost] concentric circles. I have been having issues using HoughCircles and so, I decided to create a test image with a single circle. My image was created with the following command:

cv::Mat img = cv::Mat::zeros ( 480, 640, CV_8UC1 );
cv::circle ( img, cv::Point(200,200), 175, cv::Scalar(0XFF), 1);

I tried to run HoughCircles on this image as follows:

std::vector<cv::Vec3f> circles;
cv::HoughCircles(img, circles, cv::HOUGH_GRADIENT, 1, 10, 239, 20 );

I get a plethora of circles when there is clearly only one circle in the input image. I have been struggling with this for a while now and will appreciate any help. I should mention that these circles are off-center from where I created the center (200,200), and their radius is all over the place as well.

2017-03-22 05:25:04 -0600 marked best answer Problem with meanStdDev

I seem to be having a problem trying to compute the mean and standard deviation of pixels in an image. Can someone look at my code and point out what I am doing wrong? I am unable to get correct results.

cv::Mat             img;
cv::Mat     mean;
cv::Mat     stddev;

cv::meanStdDev ( img, mean, stddev );
uchar       mean_pxl = mean.data[0];
uchar       stddev_pxl = stddev.data[0];

I have also tried to get the data using mean.at<uchar>(0) without success.

Thanks for your help.

2016-12-23 02:06:31 -0600 received badge  Popular Question (source)
2016-12-08 17:53:42 -0600 asked a question Detecting concentric circles

I am trying to find circles in the attached image.

I have used the function cv::HoughCircles(img, circles, cv::HOUGH_GRADIENT, 1, 1);. However, it is unable to detect the circle in this image or other similar images. Can someone point what I may be doing wrong?

image description

2016-11-01 21:18:13 -0600 answered a question How to detect rotation angle 0 , -90 ,+90 or 180

You may want to check getAffineTransform.

2016-10-11 07:13:31 -0600 received badge  Nice Answer (source)
2016-10-09 13:51:11 -0600 answered a question imshow displays image too wide

Your input image is of lesser width than the window title. Change the window title to a smaller string and the problem will go away. The utility is trying to show the complete window name string.

2016-08-18 16:25:05 -0600 commented question Background subtractor - automatically ignore always-changing area

If it is periodic and you know the period, you may be able to look for the specified intensity and pattern and use a mask to clear it.

2016-08-10 14:23:37 -0600 commented question what is opencv ?
2016-07-27 22:31:34 -0600 commented question OpenCV 3.1 VideoWriter::write(const Mat&) does not return its status.

You are trying to catch cv::Exception. Right?

2016-07-23 18:56:29 -0600 commented question OpenCV 3.1 VideoWriter::write(const Mat&) does not return its status.

I believe that if the write fails, it will issue an exception that can be caught.

2016-07-06 16:29:25 -0600 commented answer The app was unable to start correctly (0xc000007b)

Did you change project properties?

2016-06-28 17:13:42 -0600 commented question opencv 3.1 Undefined Reference

Can you replace ${OpenCV_LIBS} with opencv_core, opencv_highgui, and opencv_imgcodecs, and see if it fixes the linking? If yes, then, your variable is not set.

2016-06-23 08:12:22 -0600 received badge  Nice Answer (source)
2016-06-22 08:43:20 -0600 edited question Getting warning massages while running make for Opencv 2.4.9 in ubuntu 14.04

i already had Opencv 2.4.9 installed in my Ubuntu 14.04 machine. But had to uninstall the same. i used "sudo make uninstall". Then I did a fresh make. while running the fresh make I got the following warning messages . Will these warning be harmful to my installation.

In file included from /home/valuser/opencv-2.4.9/build/modules/highgui/qrc_window_QT.cpp:9:0:
/home/valuser/opencv-2.4.9/build/modules/highgui/qrc_window_QT.cpp: In function ‘int qInitResources_window_QT()’:
/home/valuser/opencv-2.4.9/build/modules/highgui/qrc_window_QT.cpp:1749:25: warning: no previous declaration for ‘int qInitResources_window_QT()’ [-Wmissing-declarations]


[ 75%] Building CXX object modules/python/CMakeFiles/opencv_python.dir/src2/cv2.cpp.o
In file included from /home/valuser/opencv-2.4.9/modules/python/src2/cv2.cpp:1151:0:
/home/valuser/opencv-2.4.9/modules/python/src2/cv2.cv.hpp: In function ‘PyObject* pycvCloneMatND(PyObject*, PyObject*)’:
/home/valuser/opencv-2.4.9/modules/python/src2/cv2.cv.hpp:149:14: warning: ‘mat’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             F; \
              ^
In file included from /home/valuser/opencv-2.4.9/modules/python/src2/cv2.cv.hpp:3863:0,
                 from /home/valuser/opencv-2.4.9/modules/python/src2/cv2.cpp:1151:
/home/valuser/opencv-2.4.9/build/modules/python/generated0.i:1427:12: note: ‘mat’ was declared here
   CvMatND* mat;
            ^
In file included from /home/valuser/opencv-2.4.9/modules/python/src2/cv2.cpp:1151:0:
/home/valuser/opencv-2.4.9/modules/python/src2/cv2.cv.hpp: In function ‘PyObject* pycvResetImageROI(PyObject*, PyObject*)’:
/home/valuser/opencv-2.4.9/modules/python/src2/cv2.cv.hpp:149:14: warning: ‘image’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             F; \
              ^
In file included from /home/valuser/opencv-2.4.9/modules/python/src2/cv2.cv.hpp:3863:0,
                 from /home/valuser/opencv-2.4.9/modules/python/src2/cv2.cpp:1151:
/home/valuser/opencv-2.4.9/build/modules/python/generated0.i:5703:13: note: ‘image’ was declared here
   IplImage* image;
             ^
In file included from /home/valuser/opencv-2.4.9/modules/python/src2/cv2.cpp:1151:0:
/home/valuser/opencv-2.4.9/modules/python/src2/cv2.cv.hpp: In function ‘PyObject* pycvSetImageCOI(PyObject*, PyObject*)’:
/home/valuser/opencv-2.4.9/modules/python/src2/cv2.cv.hpp:149:14: warning: ‘image’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             F; \
              ^
In file included from /home/valuser/opencv-2.4.9/modules/python/src2/cv2.cv.hpp:3863:0,
                 from /home/valuser/opencv-2.4.9/modules/python/src2/cv2.cpp:1151:
/home/valuser/opencv-2.4.9/build/modules/python/generated0.i:6197:13: note: ‘image’ was declared here
   IplImage* image;
             ^
In file included from /home/valuser/opencv-2.4.9/modules/python/src2/cv2.cpp:1151:0:
/home/valuser/opencv-2.4.9/modules/python/src2/cv2.cv.hpp: In function ‘PyObject* pycvSetImageROI(PyObject*, PyObject*)’:
/home/valuser/opencv-2.4.9/modules/python/src2/cv2.cv.hpp:149:14: warning: ‘image’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             F; \
              ^
In file included from /home/valuser/opencv-2.4.9/modules/python/src2/cv2.cv.hpp ...
(more)
2016-06-20 15:40:34 -0600 answered a question can't build on ubuntu

I had an issue with "incorrect hash" that seemed to persist. I fixed it by adding -DWITH_IPP=OFF. I thought I'll add it here for completeness.

2016-06-20 06:26:36 -0600 answered a question template matching

Yes, it should detect the object when it moves elsewhere within the frame. However, it won't help you with scaling.

2016-06-08 10:50:55 -0600 commented question I just can't install OpenCV on Ubuntu 10.04 x86_64

No, I gave up on it. I have been working on Windows for my OpenCV work.

2016-01-28 10:38:54 -0600 received badge  Nice Answer (source)
2015-12-22 08:01:14 -0600 received badge  Notable Question (source)
2015-11-03 19:49:34 -0600 commented question Program doesn't update the image for the first time

Seems to me that cap >> mySrc captures two frames and buffers the second one. So, when you try to display the second image, it picks it up from the camera buffer. There is a lag of one frame as long as you keep hitting n.

2015-10-15 08:46:39 -0600 commented question When I use OpenCV 2.4,the image does not load!

Your code looks fine. So, the thing to check will be if you are linking with the right libraries. Also, are the two versions of OpenCV compiled with the same version of Visual Studio as that makes a difference in some cases (as I discovered painfully).

2015-10-13 09:16:45 -0600 commented question OpenCV 3.0 support Visual Studio 2010?

You should build with cmake. It should have automatically selected Visual Studio 2010 for you. On my system, it shows the current generator as Visual Studio 10 2010.

2015-10-05 07:01:43 -0600 answered a question removing small blob from image?

Looks like you should apply dilate, erode, erode, dilate to clean up the image. Then, you can use findcontours and eliminate contours with "small" area as well as any contours that touch the image borders. You may have to experiment a bit with the first part.

2015-09-28 12:01:02 -0600 commented question cv::VideoCapture::set failed on image sequence

You are opening a .jpg file that I assume is a still image. VideoCapture opens this file but then, there is no way for it to go to a specified frame position because there is none.

2015-09-17 17:37:01 -0600 received badge  Nice Answer (source)
2015-09-17 15:28:58 -0600 received badge  Self-Learner (source)
2015-09-17 15:18:17 -0600 answered a question Problem with getting information on contours

I feel obligated to answer my question as I figured out the problem after a lot of wasted time. I had originally compiled OpenCV using Visual Studio 2010 and had been working fine. About a month ago, I needed to develop something using C++-11 features due to a collaboration and so, I installed Visual 2013 but did not recompile OpenCV to work with 2013. Things had been working fine till I encountered this issue with findContours even though I did not use any C++-11 features in this code. I compiled my code using 2010 and things worked as expected. Lesson learned: do not mix code from different versions of Visual Studio, even on the same machine. Sorry to waste your time.

2015-09-10 16:28:19 -0600 commented question Problem with getting information on contours

approxPoly didn't help either :-(

2015-09-10 15:20:01 -0600 commented question Problem with getting information on contours

I have the image here. I am using OpenCV 3.0 on Visual Studio 2013.

2015-09-10 13:25:02 -0600 commented question Problem with getting information on contours

/= is not an error. However, in my 640x480 image, I get 71 contours. As I go through the contours, the first one has 4 points and an area of 56 (reasonable), the second one has 516 points and an area of 5.69e+19 (not right) and the third one has 120195045 points and issues an exception when computing area. I am perplexed.

2015-09-10 11:32:51 -0600 asked a question Problem with getting information on contours

I am writing a function that takes a binary 8-bit image and trying to find the average area of blobs in there. My function is:

void rm_noise(cv::Mat& img, cv::Mat& clean_img)
{
    std::vector<std::vector<cv::Point>> contours;
    std::vector<cv::Vec4i> hierarchy;
    cv::findContours ( img, contours, hierarchy, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_SIMPLE);
    if ( contours.empty() )
        return;

    clean_img = cv::Mat::zeros(img.size(), CV_8UC1);
    for (size_t i = 0; i < hierarchy.size(); i++)
    {
        cv::drawContours(clean_img, contours, i, cv::Scalar(0XFF), cv::FILLED, cv::LINE_AA, hierarchy);
    }
    cv::imshow("edges", clean_img);
    cv::waitKey();

    double area = 0;
    //for (std::vector<std::vector<cv::Point>>::const_iterator c = contours.begin(); c != contours.end(); c++)
    for (size_t i = 0; i >= 0; i = hierarchy[i][0])
    {
        const std::vector<cv::Point>& c = contours[i];
        double a = std::fabs(cv::contourArea(cv::Mat(c)));
        area += a;
    }
    double avg_area = area /= contours.size();
}

findContours seems to work correctly as I can see the contours drawn properly using a loop with drawContours. However, when I try to get the information on contours such as contourArea or even bounding box, I get strange results. The results seem to give me contour area as very large (something of the order of 10^19 pixels) which is obviously wrong. And the code seg faults. Can someone help me with this as I have already wasted about five days trying different combinations to no avail.

2015-08-26 21:47:43 -0600 commented question How to find brightness of given area

And you can easily do that by specifying that area. For example, for your frame, you can do the operation on frame.operator()(rect) where rect is a rectangle defining your region of interest.

2015-08-19 19:41:49 -0600 commented question How to find brightness of given area

Will meanStdDev solve your problem?

2015-08-19 10:22:26 -0600 commented answer Can OpenCV2 and OpenCV3 be installed togheter?

You can do that in Makefile if you are using one.

2015-08-19 10:18:40 -0600 answered a question imread, command line arguments in VS13

I think you are using forward slash on the command line argument when you should be using backward slash to separate directories. That is how you have showed your command line parameters above the code.

2015-08-18 23:25:25 -0600 commented question How to get the max i from for loop to be printed at console?

And then, how did you populate it? Did you use findcontours? If so, and the size is 0, that means no contours were found as pointed by @berak.