滤镜函数

 

 

函数名

功能简述

1

Rotate

Rotates image in any size

2

reverse

reverse the image

3

Resize

Resizes image in any size

4

paint

redistribute each color channel of an image

5

Mosaic

mosaic the image

6

mirror

get a mirror image

7

Lap_sharp

sharp the image

8

imThreshold

Creates a "binary" image with values distributed according to the threshold parameter

9

imconvert

overturn an image in a certain diretion

10

Gauss_sharp

harp the image

11

exposal

get an exposal image

12

emboss

create emboss of an image

13

contrast

adjust contrast of an image

14

color_balance

increases or decreases the brightness of RGB color channels in the image independently

15

col2gray

convert an image to a grayscale image

16

bright

adjust brightness of an image

17

Blur

blur the image

 

1. Rotate - Rotates image in any size

 

Calling Sequence

 

img = Rotate(im,angle);

 

Parameters

 

im: Input matrice. 

angle: the angle that you  want to rotate by

-360 degree <=  angle <= 360 degree

 

Description

 

Rotate an image in angle

 

Examples

 

im = imread("lena.png");

img=Rotate(im,30);

 

 

2. reverse - reverse the image

 

Calling Sequence:

 

       img = reverse(im)

      

Parmeters:

 

       im: matrix of an input image

       img: output image matrix

 

Description:

      

       we can get this effect using formula as follow:

       img=im*(-1)+255

 

Example:

       im = imread("lena.png");

       img = reverse(im);

 

3. Resize - Resizes image in any size

 

Calling Sequence

 

img = Resize(im,Height,Width);

 

Parameters

 

im: Input matrice. 

Height:rows of the ouput matrice

Width:coloums of the ouput matrice

 

Description

 

resize an image in any size

 

Examples

 

im = imread("lena.png");

img=Resize(im,4);

 

4. paint - redistribute each color channel of an image

 

Calling Sequence:

 

       img = paint(im,red,green,blue)

      

Parmeters:

      

       im: matrix of an input image

       red: set contribution to R channel

       green: set contribution to G channel

       blue: set contribution to B channel

       img: output image matrix

      

Description:

      

       This function redistributes the rate of the three color channel in an image.First,we get a variable "gray" as we do in function "col2gray".Then recompute each color channel like this: new_red=(red.*gray)/255;

 

 

Example:

 

       im = imread("lena.png");

       img = paint(im,255,0,0);

 

5. Mosaic- mosaic the image

 

Calling Sequence:

 

       img = Mosaic(im,n)

      

Parmeters:

 

       im: matrix of an input image

       n: mosaic paremeter ,the larger ,the blurrier      (5<=n<=20)

       img: output image matrix

 

Description:

      

       mosaic the image

 

Example:

       im = imread("lena.png");

       img = Mosaic(im,8);

 

 

6. mirror - get a mirror image

 

Calling Sequence:

 

       img = mirror(im,my_select)

      

Parmeters:

 

       im: matrix of an input image

       my_select: select a manner for mirror

       img: output image matrix

 

Description:

 

       This function get a horizontal or vertical mirror image.

 

Example:

 

       im = imread("lena.png");

       img = mirror(im,1);

 

 

7. Lap_sharp- sharp the image

 

Calling Sequence:

 

       img = Lap_sharp(im)

      

Parmeters:

 

       im: matrix of an input image

        

       img: output image matrix

 

Description:

      

       Lap_sharp The function Lap_sharp calculates the convolution of the input image "im"

       with the Laplacian kernel of a specified size apertureSize and stores the result in "img". 

 

Example:

       im = imread("lena.png");

       img = Lap_sharp(im);

 

 

8. imThreshold - Creates a "binary" image with values distributed according to the threshold parameter

 

Calling Sequence:

 

       img = imThreshold(im,rate)

      

Parmeters:

 

       im: matrix of an input image

       rate: a value between 0 and 100,it shows the degree of threshold

       img: output image matrix

 

Description:

 

       pixels with values below the threshold ("dark") are assigned one value (e.g., black) while those

       above the threshold ("light") are set to antoher value (e.g., white)

 

Example:

 

       im = imread("lena.png");

       img = imThreshold(im,25);

      

 

 

9. imconvert - overturn an image in a certain diretion

 

Calling Sequence:

 

       img = imconvert(im,my_select)

      

Parmeters:

 

       im: matrix of an input image

       my_select: select a manner for converting

       img: output image matrix

 

Description:

 

       This function provides three manner for fast overturn.

       1) horizontal 180

       2) deasil 90

       3) anticlockwise 90

 

Example:

 

       im = imread("lena.png");

       img = imconvert(im,2);

 

 

10. Gauss_sharp- harp the image

 

Calling Sequence:

 

       img = Gauss_sharp(im)

      

Parmeters:

 

       im: matrix of an input image

        

       img: output image matrix

 

Description:

      

       Gauss_sharp The function Gauss_sharp calculates the convolution of the input image "im"

       with the Gauss kernel of a specified size apertureSize and stores the result in "img". 

 

Example:

       im = imread("lena.png");

       img = Gauss_sharp(im);

 

 

11. exposal - get an exposal image

 

Calling Sequence:

 

       img = exposal(im)

      

Parmeters:

 

       im: matrix of an input image

       img: output image matrix

 

Description:

 

       if a color value of a pixel < 128,then set this value be (255-thisValue),else no change.

       Then we can get an effect as we see a negative in a studio

 

Example:

       im = imread("lena.png");

       img = exposal(im);

 

 

12. emboss - create emboss of an image

 

Calling Sequence:

 

       img = emboss(im,n)

      

Parmeters:

 

       im: matrix of an input image

       n: select a manner for embossing

       img: output image matrix

 

Description:

      

       We provide eight methods for getting an embossed image,that is,southwest south southeast west east northwest north northeast.

 

Example:

 

       im = imread("lena.png");

       img = emboss(im,2);

 

 

13. contrast - adjust contrast of an image

 

Calling Sequence:

 

       img = contrast(im,rate)

      

Parmeters:

 

       im: matrix of an input image

       rate: a value between -100 and 100,it shows the degree of contrast

       img: output image matrix

 

Description:

       This function adjust contrast of an input image.It relates to the diffence between bright and dark.

        The diffence is clearer if "rate" is larger.

 

Example:

 

       im = imread("lena.png");

       img = contrast(im,25);

 

 

14. color_balance - increases or decreases the brightness of RGB color channels in the image independently

 

Calling Sequence:

 

       img = color_balance(im,red,green,blue)

      

Parmeters:

      

       im: matrix of an input image

       red: set contribution to R channel

       green: set contribution to G channel

       blue: set contribution to B channel

       img: output image matrix

      

Description:

      

       some colors can be highlighted, while other are suppressed or remain untouched.Color balance may be quite handful, e.g., when viewing an image on a display with different color calibration than the calibration of the device the image was acquired with. Another field of usage is art photography and video processing, as different colors possess the ability to evoke specific emotions.

 

Example:

 

       im = imread("lena.png");

       img = color_balance(im,255,0,0);

 

 

 

15. col2gray - convert an image to a grayscale image

 

Calling Sequence:

 

       img = col2gray(im,my_select)

      

Parmeters:

      

       im: matrix of an input image

       my_selcet: select a mothod for converting

       img: output image,it's a grayscale image

      

Description:

      

        this function provides three methods for converting an image to a grayscale image:

        (1)average.   rgb=R/3+G/3+B/3

        (2)max.               rgb=max(R,G,B)

        (3)weighted average.           rgb=0.11*R+0.59*G+0.30*B

        if my_select=1,then we use the first method to convert the image to a grayscale image

      

Example:

 

       im = imread("lena.png");

       img = col2gray(im,2);

 

 

16 bright      - adjust brightness of an image

 

Calling Sequence:

 

       img = bright(im,rate)

      

Parmeters:

 

       im: this is a MxNx3 unsigned char matrix(uint8).

       rate: a value between -100 and 100,it shows the degree of brightness

       img: a MxNx3 unsigned char matrix of output image

 

Description:

 

       This function adjust brightness of an input image.If "rate" equals to 0,we'll not change the image's brightness.if rate<0,we get an image darker than input.The more ratio,the more brightness.

      

Example:

 

       im = imread("lena.png");

       img = brightness(im,25);

 

 

 

17. Blur- blur the image

Calling Sequence:

 

       img = Blur(im)

      

Parmeters:

 

       im: matrix of an input image

         

       img: output image matrix

 

Description:

      

       blur the image

 

Example:

       im = imread("lena.png");

       img = Blur(im);