Shape recognition in image [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I need help with one application, I am a beginner in programming.
So I need to create a simple application that recognizes shapes in the image (rectangle, triangle, line ...) rendering them. (for an experienced programmer to be easy :D )
Here are similar projects, but I was the only one to not know much about: http://leakingmemory.wordpress.com/2012/03/17/shape-recognition-using-c-and-aforge/ and http://www.emgu.com/wiki/index.php/Shape_(Triangle,_Rectangle,_Circle,_Line)_Detection_in_CSharp
Thank you very much
EDIT:
Can you tell me how to portray all the polygons? Not only a triangle, circle ... but all shapes?

If you really want to attempt this, I'd suggest looking into Edge Detection to start. Both of those articles you linked to start by processing the image and finding the edges. The first article uses a Sobel filter, whereas the second uses Canny edge detection. Once you have a better understanding of this concept, you can make use of a library like AForge to handle doing it for you.
The next step would be to write the logic that will be used to detect the vertices of joined edges that were found from the previous step. With that in place you can detect triangles (3 vertices), squares (4 vertices), or any other arbitrary polygon.
Detecting a circle seems like it would be a bit more difficult (the second article looks to "detect" a circle by removing anything that's not a circle). If you've made it to this point though, I'm sure you could do a bit of googling and find some techniques that other people use to detect circles, and you can use the code you now have as a starting point to implement it.
Good luck!

Related

How do I decide the percentage of image similarity in openCV [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I'm working on a project that is related to duplicate document detection. I've have spent hours and hours googling and learning a lot about OpenCV (it's been a really tough, but an interesting experience altogether, I'm definitely going to start a blog this after everything!). I plan on using BRISK\AKAZE detectors together with FREAK descriptors and LSH matching to compare each document (because the documents are mainly black and white), but I need to calculate exactly how similar the two images are based on percentage, to enable my software make simple decisions afterwards.
I'm open to any ideas or suggestions on my project, and I would love if anyone would be so nice to share some code together with their answers to save me the time of googling my way there :-). Thanks.
EDIT:
Here are samples to explain my problem.
Image 1 is the document I need to get the match for. It is very similar to the all the other documents, but it is different from Image 3, after matching it should have similarity percentage of maybe 90% to Image 3. Image 2 is a duplicate of Image 1, it has been re-scanned and was slightly rotated in the process, it can have a 95% - 98% similarity since it's features are very similar to image 1. Thanks Everyone :).
You should look into SSIM. (Structural Similarity Index). It returns a 0-1 score based on similarities in image structure and pixel values. I don't believe that OpenCV has a pre-made solution for it but there are loads of tutorials for writing your own in OpenCV.

Game Programming Newbie -- In Game Objects as Required [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I've done some volunteer game programming in LPC for a MUD in my past and everything there was easy. If I wanted a new item I would just use a function to load (for example an NPC) as many times over as I wanted. Now I want to program my own little game I cannot for the life of me identify what I even need to do. If I get nothing more than the name of what I want to do in order to carry out my own further research, that would be enough. Having rambled on about all of that, on to my question:
I want to make on the fly instances of in-game objects (for example people), some handled by the computer, other handled by the player. A lot of the help on game programming I've found has been about making sprites move and handling collision detection. This is all great, but I want to code a strategy game and so am more interested in creating some sandbox flexibility within my game and coding the AI to provide the interest, rather than swish graphics and awesome sounds, etc. I want to setup the game with a variable number of randomly generated people for the player to interact with. So far I've created a class to handle the people, but I'm now stuck as each instance of the class needs a unique name and I programming in that would mean there was no randomness in the number.
What would I need to look up to achieve what I'm after? What would it be called? Have I even explained myself with any degree of eloquence?
Thank you in advance for any potential help that might come my way.
Matt.
What you're looking for is something like RPG name generators (google it).
Basically those sites you'll find generate their names out of a random combination and concatenation of prefixes, syllables and suffixes. I don't know where there is research on this topic, but you could start with something like that.
Edit: you could use Markov chains, they are used for text generation.

2d-bin-packing Algorithm to place a rectangle in x,y location? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am implementing 2d-bin-packing algorithm in canvas. My task is to place rectangles as optimal as it can be on a canvas.
the following shows how to do it:
http://incise.org/2d-bin-packing-with-javascript-and-canvas.html
BUT, it starts with the origin. I would like to tell the algorithm where to put a rectangle and that the next one not to be on top of him.
What should be changed in the code?
Is there another algorithm to use for it?
I know a better algorithm(in terms of compactness, not speed) than the one you linked to is called MaxRects.
This was my implementation of it in C++. While not fast, it was very effective at packing compactly.
This is a pdf discussing and comparing all sorts of algorithms in terms of both time and compactness.
EDIT:
I threw together an example of an image packed using MaxRects .

C# XNA Lag and framerate issues XBOX 360 [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I am a pretty good programmer and I am working on a minecraft like block building game for Xbox. I have about 10 thousands blocks in my game but when ever I run it on my xbox I have some really bad lag problems. One thing I did that kind of helped was setting all objects to null after using them but I am still having issues. How do most game developers solve this problem??? I thought of only drawing blocks that are close to the player but I think that using a loop to cycle through all the blocks in the world would slow it down even more.
You're on the right track, you definitely only want to be drawing things in the immediate vicinity if at all possible.
Quadtrees and octrees are data structures designed to slice up 2D/3D space respectively to make finding objects in a given area very easy. Sounds like this is what you are looking for.
You could use either, depending on what you wanted your definition of "nearby" to be. If you wanted to achieve the same as Minecraft, then what Minecraft does is display entire columns of blocks, so you could get away with a quadtree used to manage things on the X/Z coordinates and always show everything on the Y. If you wanted to do a 3D based definition of nearby, then you'd need a octree.
The way these work is by partitioning space using a tree structure. Each branch in the tree represents a quadrant (or octant in the case of an octree) of the available space, and each subsequent branch is a quadrant of that quadrant. Hence, it is very easy to drill down to a specific area. The leafs of the tree hold the actual data, ie. the blocks that make up your world.

C# image analysis library [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have to develop a small application that gets some images and then counts the items in the image. It is something like a satellite image with a road and I need to count the cars.
Can you give me some hints where to start? I am completely lost.
Thanks a lot,
Radu
Have you checked out OpenCV? Emgu CV provides the .NET bindings
Image processing library:
OpenCV or if you have Matlab with the image processing toolbox it would be very nice.
Algorithm wise
Counting cars on a road is not as simple as it appears. Lets suppose they have a invariant scale (say 1.0).
Create yourself a Hough transform algo to vote for rectangles with about the same width and height as your cars.
In your vote buffer find the 'n' greatest vote scores and this is your number of cars.
This is not so complicated and OpenCV can be pretty useful. You can estimate the maximum value of your hough score for each car so you can set thresholds to skip outliers.

Categories