So I generate a gabor patch that is essentially an entire image 1280x800 pixels using a custom script. The entire matrix has a Background shade of '50' whereas those pixels in the center which contain the gabor vary between 49 and 51 depending on what contrast value I specify. I then present the entire image via Psychtoolbox. So far so good.
In certain trials, I have to randomly occlude 50% of this gabor. The occlusion must be randomly selected pixels.
If there is a variable "G" that is 1280x800 in dimension, and say the relevant Gabor information is present between Xn to Xm and Yp to Yq, could someone please help me out with the occlusion part? Only 50% of the gabor needs to be occluded, i.e. those fields value needs to be set to '50' to match the background.