0

I need an easy way of alternative of getPixel() for this code.

And some Explanation. I am new to image manipulation.

I dont want to use getpixel and setpixel.

color tempPix ;

srcImage is my Image element.

x,y,filterx,filtery,s are variables.

int x, y, filterx, filtery;
int s = fmat.Size / 2;
int r, g, b;
Color tempPix; 
tempPix = srcImage.GetPixel(x + filterx - s, y + filtery - s);

Here instead of getPixel I want to use some other thing, because getPixel and setPixel are little bit slower.

Anton Sizikov
  • 9,105
  • 1
  • 28
  • 39
uncle_scrooge
  • 409
  • 1
  • 5
  • 28
  • And why don't you want to use them? How are we supposed to suggest you an alternative way (given that there's one, I'm not even sure) if we don't know why you don't want to use the standard way? – Kevin Gosse Jul 02 '13 at 05:54
  • Because getpixel and setpixel is slower.So instead of getpixel I want to deirectly assign tempPix.So pls help.......And this code is used for convulation method for image filtering.here is the link which iam using [link]- (michal.is/blog/creating-an-image-processing-library-with-c-part-1/) – uncle_scrooge Jul 02 '13 at 11:21
  • Hey Kookiz,help me man.......... – uncle_scrooge Jul 04 '13 at 14:16
  • I don't know of any alternative, GetPixel and SetPixel have been designed for this very purpose. – Kevin Gosse Jul 04 '13 at 15:01
  • 1
    If you're only setting one or two pixels or a handful of pixels, then `GetPixel` and `SetPixel` are plenty fast. If you want to manipulate an entire image, you need to work with the image bits directly. For that, you'll want to look into [Bitmap.LockBits](http://msdn.microsoft.com/en-us/library/5ey6h79d.aspx) – Jim Mischel Jul 23 '13 at 15:18

0 Answers0