I think, this is one kind of abuse of people's rights.
The following routine subtract the mean value from the image making it sharper.
function pad = erase_mean(im, sz) im = double(im); pad = floor(sz/2); [m,n,o] = size(im); mask = ones(sz,sz); for q=1:o im(:,:,q)=double(im(:,:,q))-conv2(double(im(:,:,q)),mask,'same')./sz^2; mx=max(max(im(1+pad*2:m-pad*2,1+pad*2:n-pad*2,q))); im(:,:,q)=(im(:,:,q)./mx).*255; end; mx = max(max(im(1+pad*2:m-pad*2,1+pad*2:n-pad*2,q))); im = uint8((im./mx(1)).*255); pad = im(1+pad*2:m-pad*2,1+pad*2:n-pad*2,:);
- What is the purpose of variable sz in this routine?
- pad is used as an integer and a matrix at the same time?
- Is it illegal to ask for code explanation?
- What more explanation could I provide? If I could provide more explanation, why would I post the question in the 1st place?
Accepted answer
Even the answer is being down-voted.
If
sz
is an scalar value, it defines the dimensions of the square matrixmask
. It's more interesting to see whatmask
does, substract the mean value to catch the extreme values of the image, as explained in the kmdreko's answer.
If this question was not answerable, how could he answer and how could I accept the answer?