Ask Your Question

Zimon's profile - activity

2019-05-31 08:42:15 -0600 received badge  Popular Question (source)
2015-11-01 01:02:25 -0600 received badge  Taxonomist
2013-04-19 10:08:02 -0600 commented answer Detecting small colored spheres

Unfortunately no results when I replaced CV_FILLED with 1.

2013-04-19 09:51:51 -0600 commented answer Detecting small colored spheres

this worked somehow but I dont get any detected circles from HoughCircles. I also can't copy my destinationsource to the outputframe. When I do this a BAD_ACCESS exception is been thrown.

2013-04-19 09:24:44 -0600 commented answer Detecting small colored spheres

When I just replace input.type() with CV_8UC1 I get an OpenCV error "OpenCV Error: Sizes of input arguments do not match (The operation is neither 'array op array' (where arrays have the same size and type), nor 'array op scalar', nor 'scalar op array') "

2013-04-19 08:05:12 -0600 commented answer Detecting small colored spheres

I can't figure out how to define a one collumn matrix to use it with HoughCircles. I tried adding CV_8UC1 as type instead of the input.type() but this did not work.

2013-04-18 11:18:04 -0600 answered a question Detecting small colored spheres

I did not completely solve this problem but since I made some progress I figured I post it here as an answer.

For the first testcase I try to detect a yellow marble using an iPhone 4S. I am using HSV and findContours which already gave me some great results.Later on I am also deleting some noise by iterating over the contour vector<vector> and erasing contours with big or very small size().

cv::Mat thresholdHSV;
cv::Mat imgHSV;
cv::Mat fu;

cv::cvtColor(inputFrame, imgHSV, CV_BGR2HSV);

cv::inRange(imgHSV,cv::Scalar(20,100,100),cv::Scalar(30,255,255),thresholdHSV);

std::vector<std::vector<cv::Point> > contours;

findContours(thresholdHSV.clone(), contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
 //Draw them
cv::Mat dst = cv::Mat::zeros(inputFrame.size(), inputFrame.type());
drawContours(dst, contours, -1, cv::Scalar(255,0,0), CV_FILLED);

However sometimes there is still noise which gets displayed so I figured since the image is so much reduced and the marble is a perfect circle, HoughCircle can give me the best result. Unfortunately I can't just use dst(from the above code) for an input for HoughCircle (not 8bit single channel).I also tried this with no matches:

HoughCircles(thresholdHSV, detectedCircles, CV_HOUGH_GRADIENT, 1, thresholdHSV.rows / 8, 200, 100, 0, 0);

I also tried to smooth the image with no result. Since the image is so much reduced, I thought there must be away to use HoughCircles on it in a performant way.

Another thought was using

void minEnclosingCircle(InputArray points, Point2f& center, float& radius)

and somehow comparing the enclosing circle to the contours,(but thats actually what this is doing so...)

I really hope you guys can help me and thanks for your time.

2013-04-18 06:04:44 -0600 commented answer Detecting small colored spheres

thank you for that hint.However I want to try to solve this problem using the given OpenCV algorithms first. I used this approach to implement the hough circle transform: http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.html?highlight=hough%20circle%20transform However I get no results at all. I even draw a black circle on a white paper which also does not get detected. I was wondering if I also could use cv::Cranny and cv::findContours since this correctly draws the countour around the colored spheres.(ofcourse everything else is been drawn swell)

2013-04-16 09:03:38 -0600 commented answer Detecting small colored spheres

thank you for the quick reply. I am wondering if the Hough circle Transform would work given the perspective of the camera. When the camera is nearly on the same plane as the sphere, the sphere might look more like an ellipse than a circle. I hope my explanation make sense.

2013-04-16 08:48:02 -0600 asked a question Detecting game board and relative positions on it

Hello,

I am trying to detect game board using a mobile device, and because I am new to openCV I was wondering what the best practice would be. The board will have a simple shape (pentagon, hexagon) but will be rather big.At first I want to detect the board when about 90% of the board is visible. But the problem is that I not just want to detect the shape of the board, I also need relative positions on that board. So when I place and object onto it (assuming I can detect it) I want to have the relative position of this object to this board. Since the board is a 2D plane I need the x and y coordinates.

I don't know how to achieve this using opencv and I was wondering if someone can give me some hints in the correct direction.

Later on I also want to detect positions on the board without having to have the complete board visible. I guess there will be a need of some predefined markers on that board or tracking the camera from the first detection of the board to the closer position.

I hope someone can give me some advice. Any help is highly appreciated.

2013-04-16 04:34:27 -0600 asked a question Detecting small colored spheres

Hi guys,

I recently started with openCV and since this is a very powerful library I was wondering if someone can give me some advice in which direction I should be heading. I want to detect small colored spheres like marbles and I was wondering which combination of algorithms are best suited for this purpose. Since this should run on a mobile device I have also to take the performance into account and that the camera won't be static.

Any help is highly appreciated


Update

I did not completely solve this problem but since I made some progress I figured I post it here as an answer.

For the first testcase I try to detect a yellow marble using an iPhone 4S. I am using HSV and findContours which already gave me some great results.Later on I am also deleting some noise by iterating over the contour vector<vector> and erasing contours with big or very small size().

cv::Mat thresholdHSV;
cv::Mat imgHSV;
cv::Mat fu;

cv::cvtColor(inputFrame, imgHSV, CV_BGR2HSV);

cv::inRange(imgHSV,cv::Scalar(20,100,100),cv::Scalar(30,255,255),thresholdHSV);

std::vector<std::vector<cv::Point> > contours;

findContours(thresholdHSV.clone(), contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE);
 //Draw them
cv::Mat dst = cv::Mat::zeros(inputFrame.size(), inputFrame.type());
drawContours(dst, contours, -1, cv::Scalar(255,0,0), CV_FILLED);

However sometimes there is still noise which gets displayed so I figured since the image is so much reduced and the marble is a perfect circle, HoughCircle can give me the best result. Unfortunately I can't just use dst(from the above code) for an input for HoughCircle (not 8bit single channel).I also tried this with no matches:

HoughCircles(thresholdHSV, detectedCircles, CV_HOUGH_GRADIENT, 1, thresholdHSV.rows / 8, 200, 100, 0, 0);

I also tried to smooth the image with no result. Since the image is so much reduced, I thought there must be away to use HoughCircles on it in a performant way.

Another thought was using

void minEnclosingCircle(InputArray points, Point2f& center, float& radius)

and somehow comparing the enclosing circle to the contours,(but thats actually what this is doing so...)

I really hope you guys can help me and thanks for your time.