Ask Your Question
0

Create Circular Plate/dishes HaarCascade XML

asked 2014-06-06 09:17:12 -0600

updated 2020-12-06 05:33:47 -0600

Hello, I'm trying to create a small application for a HaarCascade I'm doing. But I have no result.

Anyone here can help me, I need a haar cascade of food dishes that recognizes the edge circular plate.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-06-06 10:35:57 -0600

updated 2014-06-06 10:47:27 -0600

My question is, why do you need a haar cascade for that task? Aren't there easier ways to detect circular shapes?

If your environment is rather stable, without extreme lighting variations and other external factors, there are simpler approaches to detect circular shapes on images. There are other environmental factors. Will all the circular shapes be dishes in your work setup? Or anything is possible?

Simpler approaches:

You can try to use opencv's implementation of Hough Circles that detects circular shapes in images. That method has a threshold that lets you be more or less demanding on the circularity of the shape.

Other approach can be checking the form factor of a blob, this method would go something like:

  • Detect edges with Canny operator
  • Close morphological operation to assure edge connectivity
  • Fill holes on binary image to have full white blobs
  • Analyse blob to check which ones are circular (one way to do this is to check the blob's form factor (4piArea / Perimeter^2), which for circular shapes is very close to 1)
  • Once you detect a circular shape, you can process it further to verify if it is actually a dish or something else.

Haar cascade

For hard environments a machine learning approach may be a good choice. The first thing to do is to acquire a large data of plates on a wide variety of environments. You also need a large set of negative images, meaning, images without plates. Opencv has the traincascade application that generates a xml file that you can load into your program later.

  • The first thing to do is to use the createsamples utility that organizes your positive and negative data into a .vec file
  • Use traincascade to generate the xml with the haar cascade.
  • Load into program and check results

Good luck

EDIT: I may be wrong, but judging by your C# tag you are creating an app for a mobile device? So the point is to have people downloading an app and point the camera to a dish and have something happen? If that is the case, an haar cascade is the way to go.

edit flag offensive delete link more

Comments

Hi, thanks for your answer, Im developing a windows phone app, i want to detect something like circle or ellipse shape in real time, i already implemented the face recognition in the same app with haar cascades and works, how can i do for detect circle shape in c#? im using Aforge

jeffersonlicet gravatar imagejeffersonlicet ( 2014-06-06 16:45:56 -0600 )edit

Question Tools

Stats

Asked: 2014-06-06 09:17:12 -0600

Seen: 1,605 times

Last updated: Jun 06 '14