Find markers
Posted: 2012-08-08T07:45:02-07:00
Hello!
I want to create a gallery which asks the user to take a screenshot of a 3rd-party 3d model viewer and then to send it to complete the submission of his/her work. My idea is to take these "raw" screenshots and then check for the markers (25px*25px 90°magenta angles) and then compare the image with the two markers (png/transparent files) trying to find them, so that I've got the X and Y coordinates of the inner rectangle to maintain, removing all the outside content. So far I've thought about getting pixel-per-pixel color via the command convert filename.png txt:- 2>/dev/null | grep magenta to get all the magenta pixels, and then check this data against the same convert operation, but with the two markers: if the coords but an offset match, I've found the two points. But I don't know what's the best approach to do this (BASH or PHP, if possible). Second part (should be relatively easy) is to get the inside rectangle and make a separate image out of it.
Is there a cleverer way to achieve this? Maybe an already implemented algorithm?
Example of a screenshot with the two magenta markers:
https://dl.dropbox.com/u/1512702/tmp/ma ... xample.png
The two markers:
https://dl.dropbox.com/u/1512702/tmp/vi ... p_left.png
https://dl.dropbox.com/u/1512702/tmp/vi ... _right.png
Thanks!
I want to create a gallery which asks the user to take a screenshot of a 3rd-party 3d model viewer and then to send it to complete the submission of his/her work. My idea is to take these "raw" screenshots and then check for the markers (25px*25px 90°magenta angles) and then compare the image with the two markers (png/transparent files) trying to find them, so that I've got the X and Y coordinates of the inner rectangle to maintain, removing all the outside content. So far I've thought about getting pixel-per-pixel color via the command convert filename.png txt:- 2>/dev/null | grep magenta to get all the magenta pixels, and then check this data against the same convert operation, but with the two markers: if the coords but an offset match, I've found the two points. But I don't know what's the best approach to do this (BASH or PHP, if possible). Second part (should be relatively easy) is to get the inside rectangle and make a separate image out of it.
Is there a cleverer way to achieve this? Maybe an already implemented algorithm?
Example of a screenshot with the two magenta markers:
https://dl.dropbox.com/u/1512702/tmp/ma ... xample.png
The two markers:
https://dl.dropbox.com/u/1512702/tmp/vi ... p_left.png
https://dl.dropbox.com/u/1512702/tmp/vi ... _right.png
Thanks!