How to get a similarity ratio of 2 figures?

There are 2 triangles, one is much smaller than the another, not only the size but also the roatation are difference each other. Both of 2 are binary images. In MATLAB, is there any useful functions to get the similarity of the case like this?

Respuestas (2)

Image Analyst
Image Analyst el 27 de Sept. de 2015

0 votos

You can find them with the Computer Vision System Toolbox: http://www.mathworks.com/discovery/object-recognition.html
Do you have any special definition of "similarity" for quantifying the "similarity" that you want to use?

6 comentarios

Image Analyst
Image Analyst el 27 de Sept. de 2015
Let's say image 1 has 1 reference triangle.
Let's say image 2 has a triangle that's rotated by 10 degrees and 0.8 times as large.
Let's say image 3 has a triangle that's rotated by 15 degrees, is 0.7 times as large, and is brighter by a factor of 1.4.
How would you define the "similarity ratio" for image 2 and for image 3?
phi
phi el 28 de Sept. de 2015
Thank you very much for your very quick advice. "Simmetry" means, calculated without size and rotating effects. Is there any appropriate functions or tools in MATLAB?
phi
phi el 28 de Sept. de 2015
Ohhps,,, sorry, similarity, not simmetry!
Image Analyst
Image Analyst el 28 de Sept. de 2015
You didn't answer my question. For the 3 triangles I listed, should those be 100% different, or all the same? You have to decide what you define as similar or not similar. What would help you in your task?
Image Analyst
Image Analyst el 3 de Oct. de 2015
phi's "Answer" moved here:
Thank you very much for your long comments. 20 degree gives strong impressions, is a common sense? I didn't know that... Is there any appropriate functions in MATLAB to scale two degrees of a triangle? I can get X & Y coordinates of the degree of triangles, but I'm not sure which function I should use to get it's degree.
Image Analyst
Image Analyst el 3 de Oct. de 2015
Try atan2() or atan2d().

Iniciar sesión para comentar.

Walter Roberson
Walter Roberson el 27 de Sept. de 2015

0 votos

5 comentarios

phi
phi el 28 de Sept. de 2015
Thank you for your kindness information. There was already user who asked same kind of question.... But she/he seems not to get a final conclusion. The communication stopped before defining what similarity is.
Walter Roberson
Walter Roberson el 28 de Sept. de 2015
Suppose I showed you two automobiles, and I asked you to give a number for which of the two was "better". How do you answer? Did I mean better fuel efficiency, less expensive to buy, more reliable, less expensive to maintain, lower carbon emissions in manufacturing, lower harmful emissions while operating the car, less reliance on fossil fuels, faster acceleration, higher maximum velocity, smaller turning radius, faster braking, more recyclable, air conditioning that works more quickly, more ability to tow loads, higher seating capacity, lower injury rate when involved in accidents, depreciates less quickly? Or did I mean that you have to rate the two according to the degree to which I will like the color? Or do I need you to take 8 of those characteristics and come up with a single number about which is "better" that can be objectively justified?
When you ask about "similarity" you are asking a question like "Which car is better?" without saying how you want "better" to be measured. I might come up with a 23 point scale with 35 years of research justifying the values I assigned, but I run the risk that you would reject it all and say, "No, you didn't take into account Fuzzy Dice hanging from the mirror!"
You need to tell us exactly how you want "similarity" to be measured; we cannot do it for you because there are multiple meanings for "similarity".
phi
phi el 29 de Sept. de 2015
Thank you very much for your detail, kindness comments. Sorry for my rude question. I would like to compare 2 very simple binary figures, without color effects. If there are 2 triangles and just their sizes are different, I think "they are the same, simirality ratio is 100%". But if any of the rotation is different, the ratio gets to be down. If any one of corner degree is different from another, the length of any one of side is shorter than another corresponding side, the similarity also get to be down. My "Similarity" is effected by rotation and degree. I hope today's explanation would be better...
Image Analyst
Image Analyst el 29 de Sept. de 2015
The trouble is, you have a very specialized, custom definition of similarity. And you don't have a formula for it. You might have all these things you can measure
  1. location of each of the 3 vertices (3 x values and 3 y values)
  2. slope of the 3 sides
  3. lengths of the 3 sides
  4. area of the entire triangle
so you might have 13 different measurements or computations from them. Of course you can just report all 13 different metrics, or you can boil them down into a custom "similarity score" according to some algorithm/formula that ranges from 0 to 100. But we don't have any such formula from you.
What is your "use case"? Why do you need this?
Walter Roberson
Walter Roberson el 29 de Sept. de 2015
You can compare side length ratios without comparing side length by comparing two angles of each triangle. The third angle is going to be 180 minus the sum of the other two so you only need to compare two of them.
Find some consistent way of deciding which two angles to compare. Take into account that if you were to sort the angle values that you could be losing orientation information (a triangle that is 30, 60, 90 counter-clockwise is a different triangle than one that is 30, 60, 90 clockwise). Watch out too for equal angles -- they make the decision process a bit harder.
Find also some consistent way of measuring the orientation of the starting point for the measurements you took above. The result can be an angle in itself.
I think you can get down to measuring two interior angles and one exterior angle.
Now you have to decide: how do you weight the different values to come up with an overall number in your comparison? If there is (for example) a 20 degree difference in internal angles, then how would you compare that in importance to a 30 degree rotation but no angle change?
People tend to think of angles of a triangle as being more important: a 20 degree difference in angles would usually be perceived as making a much bigger difference than the rotation. But people are not consistent about that: if you were to put two triangles in the same orientation, with one having (say) only a 2 degree difference in the angles and so looking "nearly" the same, then people would probably perceive that as being much more similar than two identical triangles rotated by a high angle.
It is your task to come up with the formula that will balance the "shape" of the triangle (the angles) with the rotation. You might possibly be able to find some psychology studies on the topic of how people perceive geometric similarity, but there is no "natural" method to it.

Iniciar sesión para comentar.

Categorías

Preguntada:

phi
el 27 de Sept. de 2015

Comentada:

el 3 de Oct. de 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by