This algorithm is used to learn about the pixel-and-fragment feature in Photoshop.
PS This function seems to be without parameters, but I have a filter radius R can be controlled.
Because I look at the effect of the algorithm, the effect must be different.
My idea is to take the image with R as the length, move it up and down in four directions, then mix.
The code is still very simple and is not covered in detail.
The processing effect is as follows:
Original:
Post-processing effects:
PS Fragment effect:
The MATLAB code is as follows:
Clear All;close all;clcimg=double (Imread ('lena.jpg')); [H W]=size (IMG); imshow (img,[]) R=Ten; % displacement distance% shifted up or down in four directions, then mixed
%ps may be the left upper, upper right, bottom left, lower right four corner of the direction of the displacement=zeros (H +2*r,w+2*r); Right=zeros (H +2*r,w+2*r); Top=zeros (H +2*r,w+2*r); bottom=zeros (H +2*r,w+2*R);
% here do an image amplification processing to prevent the final image edge from producing a mutation left (R+1: H+r,1: w+r) =imresize (img,[h,w+R]); Right (R+1: h+r,r+1: w+2*r) =imresize (img,[h,w+R]); Top (1: h+r,r+1: w+r) =imresize (img,[h+r,w]); Bottom (R+1: H +2*r,r+1: w+r) =imresize (img,[h+r,w]); IMGN=0.25* (left+right+top+bottom); IMGN=IMGN (r+1: h+r,r+1: w+R); Figure;imshow (imgn,[])
MATLAB Practice Program (fragment)