2018-07-24 14:07:19 -0600 | received badge | ● Notable Question (source) |
2017-05-05 10:31:30 -0600 | received badge | ● Popular Question (source) |
2014-04-11 07:26:39 -0600 | asked a question | in Python trying to use cv2.matchShapes() from OpenCV I have done a random drawing on a whiteboard and NAO robot has taken a picture and tried to re-create the same drawing. My drawing: NAO's drawing: At this point I would like to write some conclusions about it, specifically I want to extract the contours from both pictures and match the contours using the However, I wrote a small Python code script for this and it gives me some errors. Here is the code: When I run this simple code, it returns me this error: Since the error tells me that the contours should be arrays.. I make a slight change in the code like this: and in this case it returns me this error: What am I doing wrong? Any help is apreciated! |
2014-04-05 04:03:21 -0600 | asked a question | in Python OpenCV use of hierarchy for findContours I implemented a Python script for recognizing shapes in hand drawings. However, the script recognizes more shapes than needed. Here is an example picture: and this is the output of the script: Part of the code I wrote is the following: I did not post all the code because is useless. I think that I am mistaking the use of hierarchy for finding the contours. I am not such a Python expert and I did not understand that well the use of hierarchy in the contours. Does anybody have suggestions? |
2014-02-05 09:41:35 -0600 | asked a question | Right data structure for containing shapes and spatial relations between them Hello people, I am a BEGINNER of Python and I would really need some help. I have a (working) script that retrieves simple shapes in images drawn by hand. The next step is to determine the spatial relations between the shapes and a data structure that contains all those information. I know how to determine the spatial relations between the shapes, like inside, next to, above and below. However, I need a data structure to contain all those information: shapes (x,y) coordinate of the edges and relation with other shapes. Each shape should contain the info. where
For example: But how to implement it in python? I read about dictionaries here but I am not sure if it's the right tool to use here. Why? Because I need to write in the data structure the position of a shape against others. So how could I write this relation? I am quite confused about the argument and I would really need an help. |
2014-01-27 09:20:59 -0600 | asked a question | Data structure in python containing shapes corners and centroids I am having a lot of troubles in python programming, mostly because I am a beginner. I first applied findContours to a picture and I have to save the retrieved shape corners and the shapes centroids in data structure for latter modifications. I created a data structure for the shapes that looks like this (the number of shapes is not known): and another one containing the centers (again the number of shapes is not known): Now I have to access the data in those two structures and perform the pointPolygonTest to check if a shape is inside another one, but OF COURSE it's really hard (because I understand that this solution with two data structure is not really the best) That's the code I wrote for accessing the data structure: For easier understanding, this is the picture with the centroids in red. You can see that thare are 3 shapes: triangle, square and pentagon. So the data structures contain 3 records for the 3 shapes and 6 elements for the 3 centroids. https://www.dropbox.com/s/vibl0h0y4ses1za/graph.png The output gives me 9 comparisons, when they should be actually 3:
That's the output: What am I doing wrong? Please help me. Thanks in advance!! |
2014-01-24 08:56:21 -0600 | received badge | ● Supporter (source) |
2014-01-24 08:25:49 -0600 | commented question | spatial relations between objects in python I was not gifted like you |
2014-01-24 08:13:38 -0600 | commented question | spatial relations between objects in python how can I state if a centerpoint is above (or below, next to, inside) another? what should be the condition? |
2014-01-24 07:14:08 -0600 | asked a question | spatial relations between objects in python Hello people, I am here to ask for an advice because, after surfing the web, I could not find myself a strategy. I have to implement a script in python that states which are the spatial relations between objects (the objects are shapes). So far I have a script that recognizes shapes in images using findContours() function and now I have to state which are the spatial relations between the object. An example: I got that a is a triangle and b is a square, what is the realtion between a and b? Inside, Above, Below, NextTo, etc. I do this in order to obtain a graph containing the shapes and the spatial relations between them. How could I do that? Which strategy would you advice me? Or, which package of python fits better the requirements? Thanks in advance for your help! |
2014-01-16 06:02:07 -0600 | received badge | ● Editor (source) |
2014-01-15 04:53:31 -0600 | asked a question | problem in python findContours() with connected and disconnected shapes Hello everybody, I am running a project in python involving recognition of shapes in images and creation of a graph out of the recognition. The script should be as more general as possible in order to create a graph out of any image given in input. The approach I used is to find the contours of the shapes and re-draw them into a new image. However I am having some troubles when for example the image contains a circle connected to a line: in this case the line is lost and not drawn in the graph. I show you what I mean: this is the input picture (please don't laught about it): After the processing, the graph created is this: It is noticeable that the line of the left "arm" is missing and after a all afternoon of trial, I didn't get to anything. Moreover, Also the "smile" is recognized as pentagon even if the shape is disconnected. The code written in python is a little ugly because I am not such an expert in python programming, so please excuse me for that: (more) |
2013-12-17 07:05:31 -0600 | received badge | ● Student (source) |
2013-12-17 03:42:53 -0600 | received badge | ● Scholar (source) |
2013-12-17 03:42:07 -0600 | commented answer | Corners and lines detection in hand drawn pictures in Python Thank you so much! What you just give me is a great starting point! I will check the subPixel and the Canny. Thanks again! I will update the post as soon as I get something more. Could be helpful for others. |
2013-12-16 12:50:53 -0600 | asked a question | Corners and lines detection in hand drawn pictures in Python I'm working on a project and at some point I have to detect corners and lines in a hand drawn picture. I am doing the work in Python but the result I get is not that good. The code I wrote is the following: The input picture can be seen here: While the resultant picture can be seen here: The result is not what I am expecting. What I want as output is to see the corner points detected in red and the lines connecting them in green. While what I get is something that does not make sense by looking at the pictures. What am I doing wrong? |