Page 2 of 2

Re: Extracting and identifying images from a larger image

Posted: 2014-01-03T23:50:14-07:00
by fmw42
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.

Re: Extracting and identifying images from a larger image

Posted: 2014-01-04T03:24:32-07:00
by snibgo
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.
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?

Re: Extracting and identifying images from a larger image

Posted: 2014-01-04T14:46:35-07:00
by balsaboom
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.
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?

Thanks so much!

Re: Extracting and identifying images from a larger image

Posted: 2014-01-04T14:49:32-07:00
by balsaboom
snibgo wrote:
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.
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?
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

Posted: 2014-01-04T15:18:30-07:00
by fmw42
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?
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?

Re: Extracting and identifying images from a larger image

Posted: 2014-01-04T16:44:44-07:00
by balsaboom
fmw42 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?
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?
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.

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

Posted: 2014-01-04T17:35:59-07:00
by balsaboom
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?

Re: Extracting and identifying images from a larger image

Posted: 2014-01-04T18:38:16-07:00
by fmw42
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?
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.

Re: Extracting and identifying images from a larger image

Posted: 2014-01-04T18:44:17-07:00
by fmw42
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?
I have no idea whether AJAX is appropriate for calling IM. Sorry. Many APIs such as PHP, Applescript, Coldfusion support calling IM.

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

Posted: 2014-01-04T23:28:52-07:00
by balsaboom
fmw42 wrote:
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?
I have no idea whether AJAX is appropriate for calling IM. Sorry. Many APIs such as PHP, Applescript, Coldfusion support calling IM.

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.
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!

Re: Extracting and identifying images from a larger image

Posted: 2014-01-05T09:32:06-07:00
by snibgo
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?
You would need to have different parameters within the script.

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.