|
Prev: Net::SMTP fails
From: elie on 6 May 2008 13:02 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,
From: Ben Bullock on 6 May 2008 23:28 elie <mazzawi(a)gmail.com> wrote: > 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.
From: zentara on 7 May 2008 08:37 On Tue, 6 May 2008 11:02:22 -0700 (PDT), elie <mazzawi(a)gmail.com> wrote: >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
From: Ben Bullock on 7 May 2008 09:41 "zentara" <zentara(a)highstream.net> wrote in message news:blb324t9ilinko2ct7qf3f6qpc87mruet6(a)4ax.com... > 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".
From: elie on 7 May 2008 13:46
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. On May 7, 10:41 am, "Ben Bullock" <benkasminbull...(a)gmail.com> wrote: > "zentara" <zent...(a)highstream.net> wrote in message > > news:blb324t9ilinko2ct7qf3f6qpc87mruet6(a)4ax.com... > > > 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". |