Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 535183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:41:24+00:00 2026-05-13T09:41:24+00:00

I am trying to create an application that when the color of a pixel

  • 0

I am trying to create an application that when the color of a pixel on screen changes to another one (that I know what it is) it does something, doesn’t really matter to the question what it does.

Anyway, I am using this:

 CGImageRef window283x420 = CGWindowListCreateImage(NSMakeRect(284, 420, 1, 1), kCGWindowListOptionOnScreenOnly, kCGNullWindowID, kCGWindowImageDefault);
 NSBitmapImageRep *cannonOne = [[NSBitmapImageRep alloc] initWithCGImage:window283x420];

Then, the color I am expecting it to change to here:

NSColor *color = [NSColor colorWithCalibratedRed:0.521569 green:0.380392 blue:0.231373 alpha:1];

And am comparing the colors here:

while (![color isEqualToColor:[cannonOne colorAtX:0 y:0]]) {
 CGImageRef window283x420 = CGWindowListCreateImage(NSMakeRect(284, 420, 1, 1), kCGWindowListOptionOnScreenOnly, kCGNullWindowID, kCGWindowImageDefault);
 NSBitmapImageRep *cannonOne = [[NSBitmapImageRep alloc] initWithCGImage:window283x420];
 if ([color isEqualToColor:[cannonOne colorAtX:0 y:0]]) {

I know the while/if part could be done better, but it should work just fine and not worrying about optimizing the app until it actually works lol.

Now, if for example the color of the pixel doesn’t actually change fast (like the color stays like that for a bit) it works perfectly. If it is like a pixel with a color that moves around and reaches 283*420 but doesn’t stay there for long (like 0.1s) (as described in the example above) it doesn’t work.

The time it stays there shouldn’t be a problem, as my app is checking the pixel really fast, as seen in the debug here:

2010-01-04 22:12:58.230 appname[2372:a0f] Checked
2010-01-04 22:12:58.231 appname[2372:a0f] Checked

Any ideas? 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:41:24+00:00Added an answer on May 13, 2026 at 9:41 am

    As gs points out, this is not trivial. You might like to take a look at the Apple CIColorTracking example which uses a custom Core Image filter to detect pixels in a moving image:

    http://developer.apple.com/mac/library/samplecode/CIColorTracking/

    There’s a little more information about how it’s done here:

    http://parmanoir.com/How_Core_Image_Color_Tracking_works

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create BB application that features the in-app purchase. I followed
I am trying to create an application that makes a window (external to the
I'm trying to create an application that uses the iPhone MapView (under Google Code).
I'm trying to create an application that uses c2dm service. So. First I used
I'm trying to create an application that uses Google OAuth for login, and then
I'm trying to create a facebook application that i'll connect with my MVC site.
I am currently trying to create an Android application that loops Audio from the
Im trying to create a server/client application that will work on two or more
I'm trying to create a simple Silverlight application that involves parsing a CSV file
I am trying to create a simple Android application that has a ActivityList of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.