2

I have to identify several polygon like shapes.Sometime, shapes have small carves.Anyway, I can extract shape very clearly using shareholding and find contours.

The problem is how to detect a shape exactly that I want? and How to get it's orientation(angle referenced to pre-defined axis)?

Give me your ideas,related links and sample codes. I'm using OpenCV 3.1.0 on Python 2.7.5

Shape may be like this(this has 2 carves,sometime no carves):

Polygon like shape...it has 2 carves

user_fs10
  • 210
  • 4
  • 14
  • Why don't you provide us with some code, we would be more happy to help any issues that you incurred in your code? – ZdaR Sep 27 '16 at 17:43
  • I didn't try to write a code yet.I'm searching for methods that can used for my work.I read some of resources...But,I want to get more.. – user_fs10 Sep 27 '16 at 17:46
  • 1
    Check [convexityDefects](http://docs.opencv.org/3.0-beta/doc/py_tutorials/py_imgproc/py_contours/py_contours_more_functions/py_contours_more_functions.html) – Miki Sep 27 '16 at 17:56
  • What do you mean with predefined axis? How did you define them? – PSchn Sep 27 '16 at 18:09
  • @PSchn I'm trying to get axis as camera edge (0,0) to (640,480).It's the horizontal axis of video frame. – user_fs10 Sep 27 '16 at 18:16
  • And you want to detect if your Polygon is a triangle, pentagon or so? And then calculate the orientation? Can you explain in a bit more? – PSchn Sep 27 '16 at 18:41
  • 1
    @NSiri, this is a classification problem. In order to solve it, you need to train your algorithm with all of the possible classes i.e. triangle,rectangle, circle, polygon, hexagon etc. – Davood Falahati Sep 28 '16 at 07:43
  • @PSchn I have to place a logo on a detected shape.Logo must be placed to specific position. I'm trying to make a machine for that. User load the shape(paper).It can be get any orientation and can be any shape. For this,I want to detect exact shape and it's orientation. Then I can calculate position for logo printing. – user_fs10 Sep 28 '16 at 11:05
  • 1
    you could approximate the convexHull and detect your shape by checking the size of the aproximated contour (see [here](http://stackoverflow.com/questions/11424002/how-to-detect-simple-geometric-shapes-using-opencv)). Then you need to define your oriantation for each shape. – PSchn Sep 28 '16 at 12:49
  • any code which you have till now ?? – M. D. P Jun 28 '19 at 11:43

0 Answers0