I'm doing color corrections of aerial photo and I need to do some specific task. I have a mask of few pixels which hue I need to change. The pixels on route are wrong color (light green). But if I change the hue of pixel on route It also changes the hue of the grass. So I came with idea. Is it possible calculate the average color which is around the pixel - its position specified by mask - but from original image and change the color of the pixel to the average color? Calculate the color around the pixel defined by mask and replace the color to copy of original file.
Another need I have. Sometimes when removing shadows which are very dark and low saturated, I get bright area after I had brighter the pixels. There area lost colors details. I can turn them green to grass color, but that will not look as pixels on normal photo which are blured. What I need to do is to generate "grain effect", which is something like a "noise" or random colored pixels.
To show you what I did in Photoshop by grain effect:

The white area is the part which was not defined by mask. The part which was in the mask contains randomly colored pixels. This is what I need to do before I can apply my special effect. This is the same image as we worked with it recently. In this image pixels which are red corespond to grass but that's not important.
The image generated above is based on this - genarated by effect texture/grain in Photoshop:
I think I have generated the image above when I have selected the blured green area of grass with mask, and then genarated the blur effect. This gives me nice tool. Because I can blur it and then I use soft light effect to create new grass texture.
And this is the original image, how it looked before I applied the special effect using "grain" texture, blur and blend overlay blending.
Before/After:
Once more, less size:
