Can someone guide me in cropping the contours area I found in RGB format?
I am going to separate the contours group and save it into area for Recognition.
I am using C++ with OpenCV library.
Is using ApproxPoly() the right direction?
Sorry for my bad English as I am not native English Speaker.
Edit: #api5, sorry for the unclear question. I want to extract to contour content for coin recognition. What I am trying to implement is crop out as many background as I can before I use Hough Circle Transform to detect the coin.
While separating the coins is also my goal, I am still trying to configure the erode mask. Maybe I will try to use homomorphic filter so that I dont need to use unmask sharping to improve the coin contrast.
I think I found my lead in Grabcut algorithm. Will be back once it works as I intended.
Original Image
Found Contours image
Related
For face detection I have used the haarcascade_frontalface_alt.xml.
The problem is that the this this algorithm gives me a roi a little bit larger so the rectangle catches some hair and some of the background. Is there a solution to change the dimension of this rectangle?
This what the haarcascade_frontalface_alt.xml detects:
And this what I want to detect:
You cannot reply on OpenCV to do this because its model is trained based on face images just like the first one. That is to say, it is supposed to give face detections like the first one.
Instead, consider to crop the detected rectangles a little bit, whatever size you want it be.
To be more accurate, you can crop the faces based on the facial features, as discussed in this thread.
I am developing an eye tracker application in emgu CV, To track eyes i need to detect iris accurately ,So i used hough circles , but in some cases it fails because the shape of iris is not a perfect circle, So i decided to convert eye image in to binary and detect iris ,
To convert it to binary i used
grayframeright_1 = grayframeright_1.ThresholdBinary(new
Gray(threshold_value), new Gray(220));
and the result is
Now how can i detect iris in the above binary image ?Can i run blob detector to detect iris ?
Please help me to figure this out, your help will be highly appreciated , I am running out of time for my deadline.
Providing code sample would be useful
Thanks in advance
You can try erosion. I've used it in a image processing class at university to find the visual center of airplanes in the sky and it worked surprisingly well.
Erosion is a fairly simple operator used in broader practice like blob detection, which you already mentioned.
Erode should remove border pixels of irregular shapes, leaving at last, just a moment before the shape completely vanishes, only few pixels. The geometrical center of those pixels is c, the visual center of the irregular shape. Starting from c draw a circle of radius r which is completely inscribed in the irregular shape. The circle at c with radius r is an approximation of the iris. Or at least so the story goes.
When I say erosion I mean this: example of erosion
This was just my personal idea based on university work, I've never done this in the industry.
Maybe you should look at a more serious approach to the problem which does not use erosion but wavelets: Iris recognition
I'm very curious. If you try this could you please share your results/findings? A quick comment would suffice!
Anyone know how to set ROI based on image bellow?
I used Hough Transform to detect the white line and draw the red line into the image.
What I need to do is to set the ROI in the rectangle.
Since Hough Transform unable to get location of each rectangle and the main problem is I cannot defined the location (x,y) manually.
Any solution that able to auto detect the rectangle and set the ROI?
Anyone can give some idea for me or the code can be use?
Please forgive my poor english and thank you.
this blog post is very good in explaining how to find a rectangle with the hough transform and it has also some c++ code with opencv 2 API.
The approach is to find lines, intersect them, and find the rectangle. In your case you will have more rectangles and so it's a little bit more complicated..
But if you manage to obtain such image.. why don't use just some threshold and find connected regions (aka blob)?
I am working on a openCV project, trying to detect parking spaces and extract the ROI(Region of Interest) from an image for further vehicle detection. The image provided will consist of all empty parking spaces. I have read several posts and tutorials about this. So far, the approach I have tried are:
1.Convert image to grayscale using `cvtColor()`
2.Blur the image using `blur()`
3.Threshold the image to get edges `threshold()`
4.Find image contours using findContours()
5.Finding all convex contours using `convexHull()`
6.Approx polygonal regions using `approxPolyDP()`
7.Get the points for the result from 5, if total number of points =4.
Check for area and angle.
I guess the problem with this approach is when I do findContours(), it finds irregular and longer contours which causes approxPolyDP to assume quadrilaterals larger than the parking space itself. Some parking lines have holes/irregularity.
I have also tried goodFeaturesToTrack() and it gives corners quite efficiently, but the points stored in the output are in arbitrary order and I think it is going to be quite rigorous to extract quadrilaterals/rectangles from it.
I have spent quite good hours on this. Is there any better approach to this?
This is the image I am playing with.
Try using dilate on the thresholded image to make the holes disappear.
Here is a good tutorial on it: opencv erode and dilate.
I'm a beginner in computer vision. I have a question about detection and tracking. I want to detect the white rectangle in the image below, to determine the interesting area and to detect the contour of the red markers.
But I don't want to make use of color information to detect the markers.
Can anyone give me suggestions on how to do this?
If you want to just detect the circles, an adapted Hough Tranfrom should work.
You can find the contours with CvFindContours and use CvApproxPoly() to find the rectangle. You can find a good example of how to use this function to find rectangles here and adapt it to your situation. To find the circles I would advise to do something with the ratio between the arcLength and the area of the contours you find as for circles this ratio is very specific. To find the arcLength use cvArcLength(CvSeq* c) to find the area use cvContourArea(CvSeq* c) while going through the contours in a for loop.