how to apply a gaussain mask to an rgb image using opencl.
i want know how to apply a mask for 3 channels of an input rgb image.
Please help me.
From the "Gaussian" name, it resembles a distribution graph which looks "more" in the middle but lesser on the "neighbours" and keep decreasing until 3nd - 5th far neighbours with an exponential rate. The shape of gaussian function can change filterin quality maybe.
If it were to be used as a "mask" then something like: (sum of all multiplied with their multipliers and summed. The sum is divided by total sum of multipliers)
0 0 0 0 2 3 2 0 0 0 0
0 0 0 2 3 5 3 2 0 0 0
0 0 2 3 5 7 5 3 2 0 0
0 2 3 5 7 8 7 5 3 2 0 --->just used arbitrary numbers, these should fit a function of Gaussian Distribution Gaussian filter - Wikipedia, the free encyclopedia
0 0 0 0 0 2 0 0 0 0 0
of course the multipliers should be between 0 and 1 with an exponential sense. If r,g,b are separately arrays, then it should be ok but if it is r,g,b,a,x,y,z,r,g,b,a,x,y,z, ,... in a single array, it could be a slower operation due to non-coalesced accesses.
And of course using a different array/image to write the results would be race-free.
For the example of upper scheme, I take sumNeighbours( r(i,j)*multiplier(i,j) ) then divide the result by sumMultipliers(multiplier(i,j)) then repeat that for g,b elements.
Maybe hardware is capable of this thing easily? Derivatives of r,g,b values through a patch can be more appropriate because the multipliers would not be constants anymore and fits more to the picture's singularities/jaggies.
Maybe Im totally wrong and this is handled by some FFT algorithm that takes all image into consideration in professional applications.
Retrieving data ...