-1

I am trying to erase which has same colour pixel from particular coordinates and want to erase that pixel.I used floodfill algorithm but it not working properly.I looking for a tool like magicwand tool.

So I am trying to implement on my own so can anyone please help me how to compare two pixel in an image?

please help me with the code or sample example.

Uttam
  • 236
  • 2
  • 15
  • Possible duplicate of [iOS retrieve different pixels in pixel by pixel comparison of UIImages](http://stackoverflow.com/questions/18622955/ios-retrieve-different-pixels-in-pixel-by-pixel-comparison-of-uiimages) –  Jan 25 '17 at 22:28
  • The link which you gave me is for comparing two images but I want to compare a pixel in a single image. – Uttam Jan 27 '17 at 05:17
  • check here http://stackoverflow.com/questions/6488732/how-does-one-compare-one-image-to-another-to-see-if-they-are-similar-by-a-certai –  Jan 27 '17 at 18:23

1 Answers1

1

You can use CGBitmapContext to get to the image memory. You need to know how is your image data organized (8 bit, 16 bit per component), how many components you have per pixel and in what order (RGB, RGBA, ARGB, CMYK, ...)

The data is organized as horizontal rows of pixels (e.g. RGBRGBRGBRGB) with top image pixel row first, so you can access them as 2 dimensional array with rows and columns indices giving the pixel x-y position with top left pixel being [0][0].

MirekE
  • 11,515
  • 5
  • 35
  • 28