MATLAB Practice Program (fragment)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.