Use a lowpass filter to blur images (Views: 31)
Problem/Question/Abstract: Does anyone know of a (preferably online) source of information for blurring algorithms? I'm looking for a simple way of blurring an image. Answer: A lowpass filter does the job. Copy the image to memory. Then take a zeroed piece of memory the same size. Pull a 3x3 window over your memory image (for x, for y) within this window, multiply the underlying pixels with the constant window multiplyer : 1 1 1 // 1 1 1 1 1 1 and add them up. This value/9 assign to the new memory image at (x,y). { ... } for x := 0 to image1.width - 1 do begin for y := 0 to image1.height - 1 do begin s := 0; for h := -1 to 1 do begin for v := -1 to 1 do begin s := s + memimage[x + h, y + v]; end; end; new_memimage[x, y] := s / 9; end; end; { ... } then copy the new memory image to the image. Note that the border of the image has to be treated specially. (array range) |