Reputation: 300
I'am searching for something to compare two images/paths. In my app the user is able to draw some lines for example a rectangle. After drawing, the image will be saved.
Now if the user draws the same rectangle but not exactly like the first one i want to compare the two images how exact these two images match. The images will be very simple (rectangle, circle).
Is there anything or any way to do this?
Upvotes: 1
Views: 643
Reputation: 104708
The easiest way I figure would be to remember the state/parameters required for the drawing operation.
Examples:
Suppose you draw a rectangle - What is the position and size of the minimal bounding rectangle?
Suppose you draw a circle - What is the position and size of the minimal bounding rectangle?
Suppose you draw a line - What is the position and size of the minimal bounding rectangle?
Then you have an array of "shapes" which specify these rectangles. That would be all you need to compare (alright, you would need a more elaborate model in real life for a typical drawing app, but you probably understand what those parameters are for any of your shapes). The bonus of this design is that it can serve as the basis of or extend your object and document models.
Evaluating rendered results is not very resourceful, and fairly inaccurate. Rendered results could vary as your implementation, OS, device, or compiler settings change.
Upvotes: 1