Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.mac.system > #55223

Re: Any quick, easy way to compare two images?

From Don Bruder <dakidd@sonic.net>
Newsgroups comp.sys.mac.system
Subject Re: Any quick, easy way to compare two images?
Date 2014-01-23 13:00 -0800
Organization Chaotic Creations Unlimited
Message-ID <lbrvrh$7ua$1@dont-email.me> (permalink)
References <lbrnpr$q5o$1@dont-email.me> <230120141424174937%nospam@nospam.invalid>

Show all headers | View raw


In article <230120141424174937%nospam@nospam.invalid>,
 nospam <nospam@nospam.invalid> wrote:

> In article <lbrnpr$q5o$1@dont-email.me>, Don Bruder <dakidd@sonic.net>
> wrote:
> 
> > Long story short, I'm messing with an app to assemble a stream of webcam 
> > images into a crude stop-motion movie. 
> > 
> > Since the images may arrive at irregular intervals, I'd like to be able 
> > to do something similar to this:
> > 
> > NSImage *PreviousImage; // Global to the class
> > 
> > -(NSImage *)getNewImage:(NSString *)ImageSourceURL
> > {
> >    NSImage *NewImage = [self grabImageFrom:ImageSourceURL];
> >    if (MAGIC)
> >      {
> >         // Yes, it's a new image
> >         if (PreviousImage)
> >           [PreviousImage release]; // Dump the old one, if any
> >         PreviousImage = [NewImage copy]; // replace with new one
> >         return NewImage; // and send the new one back to caller
> >      }
> >    else
> >      // Nope, image hasn't changed.
> >      return nil;
> > } 
> > 
> > Where "MAGIC" needs to be a routine that returns a YES/NO to the 
> > question "Is NewImage the same as PreviousImage"?
> > 
> > Is there a reasonably painless cocoa/core foundation way to do this, or 
> > am I stuck going right down onto the metal and doing a pixel-by-pixel 
> > comparison "by hand"?
> > 
> > From what I've managed to find in the various cocoa docs, it *LOOKS* as 
> > though the "compare" type methods I can spot decide on equality by 
> > saying "Is this *POINTER* to an NSImage the same as this *OTHER POINTER* 
> > to an NSImage?", without actually looking at the images themselves - 
> > only the pointers to them. Which makes it look as though, should I 
> > assign two identical images to two different NSImages, they'll compare 
> > "not the same", despite the fact that they're identical. Or am I 
> > mis-reading things?
> 
> the default comparison is by pointer, so you'd need to write your own
> equality (and hash) methods. how would it know what you consider
> 'equal' ? it can't. 

That's what I was afraid the docs were saying... <sigh> 

> also keep in mind that the camera won't produce pixel identical results
> on every frame, even when nothing has changed, 

That alone could be used to tell me "This is a new image". I don't care 
if the content of the image has changed, or how, or by how much - I only 
care that the two images either are, or are not, two copies of the same 
image.

Lemme clarify...
The source I'm using obviously runs a loop something along the lines of 
"wake up, get an image from the camera, turn it into a JPG file, and 
stick it someplace on the server so the world can get to it, then go to 
sleep for a while". The problem is that "for a while" isn't a stable 
value - Sometimes it's once per minute, sometimes once per 62 seconds, 
sometimes once per second, sometimes once per hour, with no indication 
of what condition(s) make it vary. I want to grab every available image, 
but NOT grab umpty-nine copies of an image that's been sitting there for 
who-knows-how-long 

> so you can't just loop
> through all pixels and compare. the values will vary slightly.

I don't see why not - Like I said above, I don't care if the *image 
content* changes - only that "the image" I get is or is not the same one 
I got the last time I grabbed it.

> this is also something that's been solved before, so you probably can
> find existing image matching or motion detection code.

For what I'm trying to do, image matching and/or motion detection is 
likely to be overkill on the order of using a sledgehammer to peel a 
hard boiled egg. 

If I have to look at the pixels, I expect something as simple as ANDing 
them together and calling it "new" if I get back a not-the-same value 
from the operation should do the trick.

-- 
Security provided by Mssrs Smith and/or Wesson. Brought to you by the letter Q

Back to comp.sys.mac.system | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-23 10:42 -0800
  Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-23 14:24 -0500
    Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-23 13:00 -0800
      Re: Any quick, easy way to compare two images? Tom Stiller <clusterfux.upmon@gmail.com> - 2014-01-23 21:11 +0000
        Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-23 16:38 -0800
          Re: Any quick, easy way to compare two images? john hevelin <bwotte@panix.com> - 2014-01-24 01:57 +0000
            Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-23 18:03 -0800
        Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-23 21:25 -0800
      Re: Any quick, easy way to compare two images? JF Mezei <jfmezei.spamnot@vaxination.ca> - 2014-01-23 16:31 -0500
        Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-23 16:57 -0500
          Re: Any quick, easy way to compare two images? JF Mezei <jfmezei.spamnot@vaxination.ca> - 2014-01-23 17:02 -0500
        Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-23 21:28 -0800
      Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-23 16:32 -0500
        Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-23 16:22 -0800
          Re: Any quick, easy way to compare two images? Alan Browne <alan.browne@FreelunchVideotron.ca> - 2014-01-23 19:48 -0500
            Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-23 23:54 -0800
              Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-24 08:09 -0800
                Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-24 08:44 -0800
          Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-23 22:06 -0500
            Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-23 23:37 -0800
  Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-23 20:46 +0000
  Re: Any quick, easy way to compare two images? Lewis <g.kreme@gmail.com.dontsendmecopies> - 2014-01-23 23:19 +0000
    Re: Any quick, easy way to compare two images? Alan Browne <alan.browne@FreelunchVideotron.ca> - 2014-01-23 18:38 -0500
      Re: Any quick, easy way to compare two images? Lewis <g.kreme@gmail.com.dontsendmecopies> - 2014-01-24 00:49 +0000
        Re: Any quick, easy way to compare two images? Alan Browne <alan.browne@FreelunchVideotron.ca> - 2014-01-23 19:59 -0500
  Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-23 15:25 -0800
    Re: Any quick, easy way to compare two images? Alan Browne <alan.browne@FreelunchVideotron.ca> - 2014-01-23 18:37 -0500
      Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-23 16:05 -0800
        Re: Any quick, easy way to compare two images? Alan Browne <alan.browne@FreelunchVideotron.ca> - 2014-01-23 19:47 -0500
          Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-23 17:10 -0800
            Re: Any quick, easy way to compare two images? Alan Browne <alan.browne@FreelunchVideotron.ca> - 2014-01-24 17:42 -0500
              Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-24 16:42 -0800
                Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-24 20:08 -0800
                Re: Any quick, easy way to compare two images? Alan Browne <alan.browne@FreelunchVideotron.ca> - 2014-01-25 10:54 -0500
                Re: Any quick, easy way to compare two images? JF Mezei <jfmezei.spamnot@vaxination.ca> - 2014-01-25 15:31 -0500
                Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-25 17:31 -0800
                Re: Any quick, easy way to compare two images? Michael Vilain <vilain@NOspamcop.net> - 2014-01-25 17:57 -0800
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 03:09 +0000
                Re: Any quick, easy way to compare two images? JF Mezei <jfmezei.spamnot@vaxination.ca> - 2014-01-25 23:02 -0500
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 05:04 +0000
                Re: Any quick, easy way to compare two images? Alan Browne <alan.browne@FreelunchVideotron.ca> - 2014-01-25 10:58 -0500
                Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-25 10:29 -0800
                Re: Any quick, easy way to compare two images? Alan Browne <alan.browne@FreelunchVideotron.ca> - 2014-01-25 13:39 -0500
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-25 13:45 -0500
                Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-25 13:27 -0800
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-25 16:30 -0500
                Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-25 13:33 -0800
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-25 16:52 -0500
                Re: Any quick, easy way to compare two images? JF Mezei <jfmezei.spamnot@vaxination.ca> - 2014-01-25 17:31 -0500
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-25 22:35 +0000
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-25 17:49 -0500
                Re: Any quick, easy way to compare two images? Tom Stiller <clusterfux.upmon@gmail.com> - 2014-01-25 22:55 +0000
                Re: Any quick, easy way to compare two images? JF Mezei <jfmezei.spamnot@vaxination.ca> - 2014-01-25 18:33 -0500
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-25 19:42 -0500
                Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-25 17:38 -0800
                Re: Any quick, easy way to compare two images? JF Mezei <jfmezei.spamnot@vaxination.ca> - 2014-01-25 22:50 -0500
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 02:49 +0000
                Re: Any quick, easy way to compare two images? Lewis <g.kreme@gmail.com.dontsendmecopies> - 2014-01-26 14:21 +0000
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 15:17 +0000
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-26 14:04 -0500
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 00:17 +0000
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-25 19:42 -0500
                Re: Any quick, easy way to compare two images? dorayme <do_ray_me@bigpond.com> - 2014-01-26 12:23 +1100
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 02:54 +0000
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 02:52 +0000
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-25 22:10 -0500
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 03:32 +0000
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-25 22:55 -0500
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 05:02 +0000
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-26 14:04 -0500
                Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-25 18:03 -0800
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-25 22:10 -0500
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-25 17:49 -0500
                Re: Any quick, easy way to compare two images? Savageduck <savageduck1@{REMOVESPAM}me.com> - 2014-01-25 15:59 -0800
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 00:24 +0000
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-25 19:42 -0500
                Re: Any quick, easy way to compare two images? Savageduck <savageduck1@{REMOVESPAM}me.com> - 2014-01-25 17:30 -0800
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 02:57 +0000
                Re: Any quick, easy way to compare two images? JF Mezei <jfmezei.spamnot@vaxination.ca> - 2014-01-25 22:46 -0500
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 03:49 +0000
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-25 22:55 -0500
                Re: Any quick, easy way to compare two images? dorayme <do_ray_me@bigpond.com> - 2014-01-26 12:08 +1100
                Re: Any quick, easy way to compare two images? Savageduck <savageduck1@{REMOVESPAM}me.com> - 2014-01-25 17:31 -0800
                Re: Any quick, easy way to compare two images? dorayme <do_ray_me@bigpond.com> - 2014-01-26 13:00 +1100
                Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-25 20:13 -0800
                Re: Any quick, easy way to compare two images? dorayme <do_ray_me@bigpond.com> - 2014-01-26 16:15 +1100
                Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-25 18:07 -0800
                Re: Any quick, easy way to compare two images? Savageduck <savageduck1@{REMOVESPAM}me.com> - 2014-01-25 18:24 -0800
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 02:58 +0000
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-25 22:10 -0500
                Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-25 17:36 -0800
                Re: Any quick, easy way to compare two images? Savageduck <savageduck1@{REMOVESPAM}me.com> - 2014-01-25 17:51 -0800
                Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-26 00:39 -0800
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 15:43 +0000
                Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-26 08:19 -0800
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 16:31 +0000
                Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-26 09:54 -0800
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 18:14 +0000
                Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-26 10:44 -0800
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 19:10 +0000
                Re: Any quick, easy way to compare two images? dorayme <do_ray_me@bigpond.com> - 2014-01-27 11:14 +1100
                Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-26 16:22 -0800
                Re: Any quick, easy way to compare two images? dorayme <do_ray_me@bigpond.com> - 2014-01-27 11:44 +1100
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-27 13:06 -0500
                Re: Any quick, easy way to compare two images? Lewis <g.kreme@gmail.com.dontsendmecopies> - 2014-01-27 12:48 +0000
                Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-27 05:49 -0800
                Re: Any quick, easy way to compare two images? Alan Browne <alan.browne@FreelunchVideotron.ca> - 2014-01-26 12:05 -0500
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 17:08 +0000
                Re: Any quick, easy way to compare two images? Alan Browne <alan.browne@FreelunchVideotron.ca> - 2014-01-26 12:27 -0500
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 17:37 +0000
                Re: Any quick, easy way to compare two images? JF Mezei <jfmezei.spamnot@vaxination.ca> - 2014-01-26 15:36 -0500
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 21:46 +0000
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-26 14:04 -0500
                Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-26 12:16 -0800
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 21:47 +0000
                Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-26 16:21 -0800
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-27 01:57 +0000
                Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-26 10:32 -0800
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 18:54 +0000
                Re: Any quick, easy way to compare two images? JF Mezei <jfmezei.spamnot@vaxination.ca> - 2014-01-26 15:40 -0500
                Re: Any quick, easy way to compare two images? Savageduck <savageduck1@{REMOVESPAM}me.com> - 2014-01-26 13:30 -0800
                Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-26 15:06 -0800
                Re: Any quick, easy way to compare two images? JF Mezei <jfmezei.spamnot@vaxination.ca> - 2014-01-26 18:20 -0500
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 23:35 +0000
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-27 13:06 -0500
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-27 19:14 +0000
                Re: Any quick, easy way to compare two images? JF Mezei <jfmezei.spamnot@vaxination.ca> - 2014-01-27 23:18 -0500
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-28 04:27 +0000
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-29 14:01 -0500
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-29 14:01 -0500
                Re: Any quick, easy way to compare two images? john hevelin <bwotte@panix.com> - 2014-01-27 01:19 +0000
                Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-26 18:28 -0800
                Re: Any quick, easy way to compare two images? john hevelin <bwotte@panix.com> - 2014-01-28 02:26 +0000
                Re: Any quick, easy way to compare two images? Don Bruder <dakidd@sonic.net> - 2014-01-28 06:35 -0800
                Re: Any quick, easy way to compare two images? dorayme <do_ray_me@bigpond.com> - 2014-01-27 10:55 +1100
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-25 22:10 -0500
                Re: Any quick, easy way to compare two images? Doug Anderson <ethelthelogremovethis@gmail.com> - 2014-01-25 21:41 -0800
                Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-26 14:04 -0500
                Re: Any quick, easy way to compare two images? Jolly Roger <jollyroger@pobox.com> - 2014-01-26 03:13 +0000
                Re: Any quick, easy way to compare two images? JF Mezei <jfmezei.spamnot@vaxination.ca> - 2014-01-25 17:30 -0500
                Re: Any quick, easy way to compare two images? john hevelin <bwotte@panix.com> - 2014-01-25 18:51 +0000
                Re: Any quick, easy way to compare two images? Lewis <g.kreme@gmail.com.dontsendmecopies> - 2014-01-25 19:06 +0000
                Re: Any quick, easy way to compare two images? JF Mezei <jfmezei.spamnot@vaxination.ca> - 2014-01-25 15:37 -0500
                Re: Any quick, easy way to compare two images? JF Mezei <jfmezei.spamnot@vaxination.ca> - 2014-01-25 15:35 -0500
        Re: Any quick, easy way to compare two images? nospam <nospam@nospam.invalid> - 2014-01-23 22:06 -0500

csiph-web