i want to blur a portion of the image, so i receive x (int) and y (int) with is the starting point of the image, then I receive width (int) and length (int) to mark the portion to be blurred.
but then the program receives also a variable called 'size' (int), which divides the portion in squares with 'size' of side. in order to blur the image, i must make the average of all the pixels in that square, and make the square with that value of color.
i already made the functions that detect the red, green and blue of a pixel [red(x,y)blue(x,y)green(x,y)] and the functions that write a color to a pixel color(r,g,b,t,x,y).
but i'm having troubles to handle the squares and the matrix of pixels, looks messy. there's like, a fuckload of fors and whiles, no?
no, Logo is clearly the most appropriate language in this case
Name:
Anonymous2007-05-29 0:26 ID:dni2CAGZ
but i'm having troubles to handle the squares and the matrix of pixels, looks messy. there's like, a fuckload of fors and whiles, no?
Fuckload? You'd need at most 2 for loops to loop through your area. Also, putpixel-functions are pretty enterprise. Since you have an array of pixels do it inline.
Name:
Anonymous2007-05-29 1:16 ID:VX8ybqi4
function censor(image, x, y, width, height, size):
for j in (y .. y + height):
for i in (x .. x + width):
bx = int(i / float(size)) * size
by = int(j / float(size)) * size
image.putpixel(i, j, image.getpixel(bx, by))
Name:
Anonymous2007-05-29 1:20 ID:015RGIHl
it looks like you're applying a pixelate effect rather than blur.
there are many kinds of blur, but think of what you're trying to do mathematically speaking, then program.
I don't know how to blur but I'm guessing you have to take a pixel, then apply the pixel color to the pixels around it in a circle fashion, with more transparency as you go away from the pixel. This is applied to all pixels.
Name:
Anonymous2007-05-29 1:26 ID:aT8DyqVN
>>6
two loops to go through the area
and two more to calculate the average of the neighborhood pixels
Name:
Anonymous2007-05-29 3:03 ID:o7PVjAQO
ONE QUESTION, WHY DO YOU NEED A PROGRAM TO DO THIS?
Name:
Anonymous2007-05-29 5:48 ID:5BDmpIBO
>>10
maybe it's cheaper and/or more flexible to use a computar instead of some optical blurring apparatus
Name:
Anonymous2007-05-29 6:15 ID:ExbqfrRV
>>1
Why do you want to censor, motherfucker? GTFO my world4ch.
def average_pixels(pix, x1, y1, x2, y2):
pix = im.load()
sum = (0, 0, 0)
for y in range(y1, y2):
for x in range(x1, x2):
sum = map(op.add, sum, pix[x, y])
return tuple(c / ((x2 - x1) * (y2 - y1)) for c in sum)
def pixelize(im, x, y, width, height, size):
draw = ImageDraw.Draw(im)
for y1 in range(y, y + width, size):
for x1 in range(x, x + height, size):
c = average_pixels(im, x1, y1, x1 + size, y1 + size)
draw.rectangle((x1, y1, x1 + size, y1 + size), fill=c)
not a faggot. i'm testing the program with the head of the developers-developers person.
i just finished the image class http://files-upload.com/257911/Image.htm.html, where i have functions to aid the child class, which will have a lot of normal functions to handle pictures
>>8
yes, that is it - pixelate. basicly a section of the image is divided in squares and i do the color average with the red,green,blue function and i place it in the square
the teacher helped us with the image class, but now we are doing a child class that will use these functions, and is a bit dificult without help