|
Posted by elie on May 6, 2008, 2:02 pm
Please log in for more thread options
Hello,
so I have some images (all PNG)
I have a small image, ( a checkered box) and other larger images that
may or may not contain the checkered box small image.
I want to somehow find out if the small image (the checkered box)
apprears anywhere in the larger PNG's or not.
any hits would be appreciated.
Regards,
|
|
Posted by Ben Bullock on May 7, 2008, 12:28 am
Please log in for more thread options
> so I have some images (all PNG)
>
> I have a small image, ( a checkered box) and other larger images that
> may or may not contain the checkered box small image.
> I want to somehow find out if the small image (the checkered box)
> apprears anywhere in the larger PNG's or not.
I don't have any idea how to do this, but whatever solution you arrive
upon it will depend upon some kind of graphics library, which you can
access by Perl, rather than being something you can do with pure Perl
commands. There are a lot of graphics libraries, such as ImageMagick,
which have interfaces to Perl.
You might also want to try asking your question on a graphics
newsgroup or web forum.
|
|
Posted by zentara on May 7, 2008, 9:37 am
Please log in for more thread options
>Hello,
>
>so I have some images (all PNG)
>
>I have a small image, ( a checkered box) and other larger images that
>may or may not contain the checkered box small image.
>I want to somehow find out if the small image (the checkered box)
>apprears anywhere in the larger PNG's or not.
>
>any hits would be appreciated.
>
>Regards,
This is just a brainstorm, :-)
but you might be able to do some sort
of binary regex search of the larger images. You would have to strip
off the png header of the smaller image.
The problem, is that the smaller image will not be contained as a linear
string in the larger image.
What you might do, is break the larger image into "binary lines"
depending on it's resolution. Then do the same thing for the
smaller image.
Then a fast go/no-go test would be to seach each binary line of the
large image for the first non-header binary line of the smaller one.
If a first line match is found, then continue for matching the rest
of the lines.
The only problem left, is to determine if the matches all line up at
the same pixel shift point. Regexes do have the ability to report
the position of the match, so it should be doable.
I'm sorry my regex skills (especially with binary data) is not that
expert, but someone else here may know.
Goodluck,
zentara
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
|
|
Posted by Ben Bullock on May 7, 2008, 10:41 am
Please log in for more thread options
> This is just a brainstorm, :-)
> but you might be able to do some sort
> of binary regex search of the larger images. You would have to strip
> off the png header of the smaller image.
As far as I know, PNG is a compressed format, so it's not possible to access
the actual pixel data just by "stripping off the png header".
|
|
Posted by elie on May 7, 2008, 2:46 pm
Please log in for more thread options
I've been playing around with perlMagick (which is a perl interface to
Image-Magic), I think it can decompress the PNG into some binary, but
its way too complex, I get some binary, but I can't tell what it is,
the number of bytes doesn't match the number of pixels, and is not a
multiple. I've been using the perlmagik function getPixels() but I
don't know what the binary its returning is yet.
I'm going to try to match part of the binary from the sub image in the
big image, but its still not making sence.
>
>
> > This is just a brainstorm, :-)
> > but you might be able to do some sort
> > of binary regex search of the larger images. You would have to strip
> > off the png header of the smaller image.
>
> As far as I know, PNG is a compressed format, so it's not possible to access
> the actual pixel data just by "stripping off the png header".
|
| Similar Threads | Posted | | how to simply parse raw image data and output to an image file ? | January 3, 2008, 11:19 am |
| best way to store binary image data in a variable using image magick | January 25, 2008, 1:17 am |
| Image processing in perl? | September 13, 2007, 11:03 pm |
| binary searching in perl | October 10, 2006, 2:16 pm |
| Is it possible to resize or crop JPG image with Perl? | August 31, 2005, 8:44 am |
| Perl grabbing an external image | December 15, 2005, 2:36 pm |
| perl GD Image resolution problem | May 5, 2008, 11:28 pm |
| Searching database with perl script | June 19, 2006, 2:17 pm |
| searching a "text" in word document using perl | January 28, 2005, 3:38 pm |
| How good is PERL at searching ASCII files? | December 7, 2006, 10:45 am |
|