Extracting and identifying images from a larger image
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Extracting and identifying images from a larger image
The compare function returns a metric value. You can set a threshold on the metric as to what you think is acceptable or not.
But you should use some hash or simple image statistic such a the average color to test first against your data base, to reduce the number that have to be matched via compare.
But you should use some hash or simple image statistic such a the average color to test first against your data base, to reduce the number that have to be matched via compare.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Extracting and identifying images from a larger image
Are the icons the same size on all the devices? If so then doesn't the width and height of the image tell you the number of rows and columns, and the location of each icon?balsaboom wrote:They aren't different patterns persay, but the number of icons per picture can change (because different mobile devices have different screen resolutions). so it might be 5 rows x 5 cols or 6 rows x 5 cols.
snibgo's IM pages: im.snibgo.com
Re: Extracting and identifying images from a larger image
Just to clarify, are you suggesting that I take a "preliminary test" and compare the average color of the icon in question to the database, then compare only to the ones that have the same average color? I would have to reupdate the average colors of the database entries if i were to add things, correct?fmw42 wrote: But you should use some hash or simple image statistic such a the average color to test first against your data base, to reduce the number that have to be matched via compare.
Thanks so much!
Re: Extracting and identifying images from a larger image
I'm actually unsure if they're the same size on all devices, I'll go check right now. Even if they were the same size, I'd still need to have different scripts for the different possible image input sizes, right?snibgo wrote:Are the icons the same size on all the devices? If so then doesn't the width and height of the image tell you the number of rows and columns, and the location of each icon?balsaboom wrote:They aren't different patterns persay, but the number of icons per picture can change (because different mobile devices have different screen resolutions). so it might be 5 rows x 5 cols or 6 rows x 5 cols.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Extracting and identifying images from a larger image
I am not sure I follow this. What does the input image size have to do with matching the icon from these images to an icon stored in a database?I'm actually unsure if they're the same size on all devices, I'll go check right now. Even if they were the same size, I'd still need to have different scripts for the different possible image input sizes, right?
Re: Extracting and identifying images from a larger image
Depending on the image input size, the icons can be either arranged 5x5 or 5x6. Its just another way to determine which script to use. I think i'll still have the user specify which device they use at the time of upload, however.fmw42 wrote:I am not sure I follow this. What does the input image size have to do with matching the icon from these images to an icon stored in a database?I'm actually unsure if they're the same size on all devices, I'll go check right now. Even if they were the same size, I'd still need to have different scripts for the different possible image input sizes, right?
Also: was my explanation of your previous post correct? I just want to make sure i'm getting the right idea.
Re: Extracting and identifying images from a larger image
Also, would you have any idea how to invoke imagemagick through the command line through ajax? Or would I have to use php? Is it possible to write a "script" for imagemagick that the command line can execute automatically?
*edit: from what i understand, its possible to execute it from a file via bash?
*edit: from what i understand, its possible to execute it from a file via bash?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Extracting and identifying images from a larger image
Yes, you would have to add fields in the database for that. Note that this is only one means of a first and fast test. Other ideas were some kind of hash, such as to reduce the image to 3x3 and save those 9 values and compare those 9 values to similar ones in the data base for the stored icons.Just to clarify, are you suggesting that I take a "preliminary test" and compare the average color of the icon in question to the database, then compare only to the ones that have the same average color? I would have to reupdate the average colors of the database entries if i were to add things, correct?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Extracting and identifying images from a larger image
I have no idea whether AJAX is appropriate for calling IM. Sorry. Many APIs such as PHP, Applescript, Coldfusion support calling IM.balsaboom wrote:Also, would you have any idea how to invoke imagemagick through the command line through ajax? Or would I have to use php? Is it possible to write a "script" for imagemagick that the command line can execute automatically?
*edit: from what i understand, its possible to execute it from a file via bash?
IM is very often run from command lines in a text file via bash unix shell script. All my scripts listed at the link below are just that. These scripts can be launched in a terminal window or on a server by using the PHP exec() command. Any API that supports something like an exec() command, such as those I listed above, can launch the script text file.
Re: Extracting and identifying images from a larger image
Alright, i was just wondering if i could directly run the bash script through ajax, or whether I had to create a php file that ran the bash, then use ajax to call the php. Since there doesn't seem to be a definitive answer, I'll just go with the latter option. Thanks for all your help!fmw42 wrote:I have no idea whether AJAX is appropriate for calling IM. Sorry. Many APIs such as PHP, Applescript, Coldfusion support calling IM.balsaboom wrote:Also, would you have any idea how to invoke imagemagick through the command line through ajax? Or would I have to use php? Is it possible to write a "script" for imagemagick that the command line can execute automatically?
*edit: from what i understand, its possible to execute it from a file via bash?
IM is very often run from command lines in a text file via bash unix shell script. All my scripts listed at the link below are just that. These scripts can be launched in a terminal window or on a server by using the PHP exec() command. Any API that supports something like an exec() command, such as those I listed above, can launch the script text file.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Extracting and identifying images from a larger image
You would need to have different parameters within the script.basaboom wrote:I'm actually unsure if they're the same size on all devices, I'll go check right now. Even if they were the same size, I'd still need to have different scripts for the different possible image input sizes, right?
My theory (which you need to check) is that you don't need to know the device used. If all devices use the same size of icons and the spacing of the icons follows a simple algorithm, then you only need to know the image size to determine where all the icons are.
snibgo's IM pages: im.snibgo.com