+ 2
Find the average RGB value from any 5pixel of an image and give the output as a single colour.
write a code to select any five pixels of an image and give the output as a single colour which is the average of all the 5pixel's color value. eg.if pix 1hold value 567,pix2 hold value 568 and pix3hold value 456 then result should be (567+568+456)/3=530 and the output should indicate the colour. Code expected in java.
4 Réponses
+ 2
The code to find average colour of a given image is also fine..if the picture is half black and half white the result should be something like grey.
+ 2
4 pixels
rgb(0,0,0)
rgb(0,0,0)
rgb(255,255,255)
rgb(255,255,255)
the average would be
rgb(510/4, 510/4, 510/4)
rgb(127,127,127), which is grey
+ 1
It appears as though you are adding the R, G, and B values together before finding the average. How will you separate the average back into RGB when you find it? I would take the R, G, and B for each pixel and total them all individually.
R = (180, 159, 100) / 3;
G = (135, 200, 167) / 3;
B = (251, 209, 189) / 3;
0
What have you got so far?