Shape Recognition with kNN
Show older comments
I want to do a shape recognition program in Matlab with the KNN algorithm. But I couldn't. I searched everything about that, but i couldn't find anything. I have to make a program that classifies and recognizes square, circle and triangle with kNN algorithm. I need it urgently. I'm glad you helped me.
3 Comments
OZCAN
on 13 May 2018
Walter Roberson
on 13 May 2018
Do you share accommodation with anyone?
Would you accept the other(s) regularly saying, "I can't cook or do any housework or go shopping for the things we ran out of, because a student needs me to do their research for them, they left it late and now it's urgent" ?
Because I live with university teaching staff, and they have an even larger supply of last-minute "it's urgent" students than I do.
Answers (1)
Image Analyst
on 7 May 2018
0 votes
I have a demo that counts vertices but it doesn't use KNN because it doesn't need to. I don't even know how you'd use KNN in this context. Why do you need code that specifically uses KNN? I've attached demos.
10 Comments
OZCAN
on 7 May 2018
Image Analyst
on 7 May 2018
Who is "they"? If "they" want you to use knn, did they give any sort of hint as to which feature you should cluster? Like you can use gray level only if you have something like computer graphics where all squares are one gray level and all triangles are some other gray level. You can't use the number of vertices as your feature, because if you already knew that, you'd be done and wouldn't need to even use KNN at all. So what feature do you want to do cluster analysis on?
OZCAN
on 8 May 2018
Image Analyst
on 8 May 2018
Did they give you an image to use? Can you attach it? Maybe that will give us some clue as to what to cluster on.
OZCAN
on 8 May 2018
Image Analyst
on 9 May 2018
I suggest you get more clarity on what image(s) you're supposed to use and what feature they think you can cluster on. Otherwise you're just guessing.
OZCAN
on 9 May 2018
Image Analyst
on 9 May 2018
Look at the FAQ for snippets that work http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
And you should not need to store all those images in a cell array, which you aren't even doing because you're using parentheses instead of braces. Plus not sure why you're converting the img to a column vector by doing (:) -- why???
OZCAN
on 9 May 2018
Image Analyst
on 9 May 2018
Yes, but you don't need to store all the images in memory at the same time in a cell array. You can read one, analyze it, then re-use the same variable on the next loop iteration. That is much more memory efficient. No need to keep storing images that you're already done processing, right?
And if you can't tell me what features to cluster on, then I can't help you with KNN, because I can't think of what they would be. Please post a picture if you can of some of the images you plan on reading in.
Categories
Find more on Nearest Neighbors in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!