PS filter-rotating blur

Source: Internet
Author: User

Here we provide a fuzzy algorithm for grayscale images. Color images only need to blur three channels.


% Spin blur

% Rotation blur
Clc;
Clear all;
Close all;

I =imread('4.jpg ');
I = double (I );

% I _new = I;
% For kk =
% I _new (:,:, kk) = Spin_blur_Fun (I (:,:, kk), 30, 30 );
% End

% Imshow (I _new/255)


Image = I;
Image = 0.2989 * I (:,:, 1) + 0.5870 * I (:,:, 2) + 0.1140 * I (:,:, 3 );

[Row, col] = size (Image );
Image_new = Image;
Center_X = (col + 1)/2;
Center_Y = (row + 1)/2;
ValidPoint = 1;
Angle = 5;
Radian = angle * pi/180;
Radian2 = radian * radian;
Num = 30;
Num2 = Num * Num;
For I = 1: row
For j = 1: col
ValidPoint = 1;
X0 = j-Center_X;
Y0 = Center_Y-i;
X1 = x0;
Y1 = y0;
Sum_Pixel = Image (I, j );
For k = 1: Num
X0 = x1;
Y0 = y1;
% Counter-clockwise
% X1 = x0-radian * y0/Num-radian2 * x0/Num2;
% Y1 = y0 + radian * x0/Num-radian2 * y0/Num2;
% Clockwise
X1 = x0 + radian * y0/Num-radian2 * x0/Num2;
Y1 = y0-radian * x0/Num-radian2 * y0/Num2;
            
X = floor (x1 + Center_X );
Y = floor (Center_Y-y1 );
            
If (x> 1 & x <col & y> 1 & y <row)
ValidPoint = validPoint + 1;
Sum_Pixel = Sum_Pixel + Image (y, x );
End
End
Image_new (I, j) = Sum_Pixel/validPoint;
End
End

Imshow (Image_new/255 );


SOURCE image




PS filter-rotating blur

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.