messengerkvm.blogg.se

Delphi sharpen bitmap
Delphi sharpen bitmap









delphi sharpen bitmap

Color must be read per filter entry, not per image pixel. Public static Bitmap sharpen(Bitmap image) Int b = Math.Min(Math.Max((int)(factor * blue + bias), 0), 255) Int g = Math.Min(Math.Max((int)(factor * green + bias), 0), 255) Int r = Math.Min(Math.Max((int)(factor * red + bias), 0), 255) Green += imageColor.G * filter īlue += imageColor.B * filter Int imageY = (y - filterHeight / 2 + filterY + h) % h Int imageX = (x - filterWidth / 2 + filterX + w) % w Thanks public static Bitmap sharpen(Bitmap image)īitmap sharpenImage = new Bitmap(image.Width, image.Height) ĭouble filter = new double įilter = filter = filter = filter = filter = filter = filter = filter = -1 Ĭolor result = new Color ĭouble red = 0.0, green = 0.0, blue = 0.0 įor (int filterX = 0 filterX < filterWidth filterX++)įor (int filterY = 0 filterY < filterHeight filterY++) I do not know if I am doing something wrong, if yes, please advise me what to do to make it work as it should be. Anyway, I tried to find out why it is not working.

delphi sharpen bitmap

I tried to do it in C# so here is my code. I want to put a sharpen filter on an image.











Delphi sharpen bitmap