Re: [Tutor] Questions about PIL

2006-11-09 Thread Luke Paireepinart
Chris Hengge wrote: > Yes, I understand what a loop is, and there was a loop but I didn't > write that code into my email because I didn't need commenting on it. > Here is the code so its clear incase you really care =P Just because you don't need commenting on it doesn't mean it's not relevant. E

Re: [Tutor] Questions about PIL

2006-11-09 Thread Luke Paireepinart
Chris Hengge wrote: > What I want to do with the data shouldn't really matter. I'm not > completely sure what I want to do with the image data anyways, but for > sake of arguement everything is happening in memory at this point, so > 'objects' is correct. Images start in memory, and are being ev

Re: [Tutor] Questions about PIL

2006-11-09 Thread Kent Johnson
Chris Hengge wrote: > alist = difference(image1,image2) > a = [b for b in alist.getdata() if b != (0,0,0)] > if len(a) != 0: >print "Not the same" > > is much slower then (9x) > > if im1.tostring() != im2.tostring() >print "something changed!" One reason the second version will be fa

Re: [Tutor] Questions about PIL

2006-11-09 Thread Chris Hengge
What I want to do with the data shouldn't really matter. I'm not completely sure what I want to do with the image data anyways, but for sake of arguement everything is happening in memory at this point, so 'objects' is correct. Images start in memory, and are being evaluated in memory, never writte

Re: [Tutor] Questions about PIL

2006-11-09 Thread Chris Hengge
Yes, I understand what a loop is, and there was a loop but I didn't write that code into my email because I didn't need commenting on it. Here is the code so its clear incase you really care =Pfrom PIL import Image from PIL import ImageGrabimport timecapturedFrames = 100count = 0print "\nInitializi

Re: [Tutor] Questions about PIL

2006-11-08 Thread Luke Paireepinart
Chris Hengge wrote: > Thanks for the detailed examples again Luke. Sorry I wasn't more clear > with my implimentation. The loop I was refering to was the one in the > start of my post but using im.tostring() instead. I saw an example to > make a webcam motion detector that used tostring(), but c

Re: [Tutor] Questions about PIL

2006-11-08 Thread Luke Paireepinart
Chris Hengge wrote: > alist = difference(image1,image2) > a = [b for b in alist.getdata() if b != (0,0,0)] > if len(a) != 0: >print "Not the same" > > is much slower then (9x) > > if im1.tostring() != im2.tostring() >print "something changed!" > > This loop itself is fairly slow by itse

Re: [Tutor] Questions about PIL

2006-11-08 Thread Chris Hengge
alist = difference(image1,image2)a = [b for b in alist.getdata() if b != (0,0,0)]if len(a) != 0:    print "Not the same"is much slower then (9x)if im1.tostring() != im2.tostring()   print "something changed!" This loop itself is fairly slow by itself though.. I'm going to try and see if there i

Re: [Tutor] Questions about PIL

2006-11-08 Thread Chris Hengge
I tried the .tostring again, seems to be working using != instead of is not... Thanks for that thread link, very helpful. I'll look more into im.transform and see what I can come up with. I'm not sure I fully understand what it does, but I'm reading it as I'll remove the wanted section of im and tr

Re: [Tutor] Questions about PIL

2006-11-08 Thread Chris Hengge
Thanks for the detailed examples again Luke. Sorry I wasn't more clear with my implimentation. The loop I was refering to was the one in the start of my post but using im.tostring() instead. I saw an example to make a webcam motion detector that used tostring(), but couldn't get the program to see

Re: [Tutor] Questions about PIL

2006-11-08 Thread Danny Yoo
On Wed, 8 Nov 2006, Chris Hengge wrote: > I'm trying to figure out how to compare im1 to im2 and recognize the > difference. I dont care what the difference is... > > something like > > if im1 is not im2: >print "Not same" Do not use 'is' here. It is not doing any kind of equality testing

Re: [Tutor] Questions about PIL

2006-11-08 Thread Luke Paireepinart
Chris Hengge wrote: > I'm trying to figure out how to compare im1 to im2 and recognize the > difference. I dont care what the difference is... > > something like > > if im1 is not im2: > print "Not same" Hey, Chris. I'm supposing here that you are checking if the images are _visually_ differ

[Tutor] Questions about PIL

2006-11-08 Thread Chris Hengge
I'm trying to figure out how to compare im1 to im2 and recognize the difference. I dont care what the difference is... something likeif im1 is not im2: print "Not same"I've tried im.tostring () but that doesn't ever enter the loop either.