Convert image to binary image, based on threshold
X=imread(‘trees.tif’);BW = im2bw(X, map,0.4);
subplot(1,2,1), subimage (X), subplot(1,2,2), subimage (BW);
Global image threshold using Otsu's method
I = imread('cameraman.tif');
level = graythresh(I);
BW = im2bw (I, level);
subplot(1,2,1), subimage (I), subplot(1,2,2), subimage (BW);
CONVERT RGB image or colormap to grayscale
I = imread('peppers.png');
J = rgb2gray(I);
subplot(1,2,1), subimage (I), subplot(1,2,2), subimage (J);
Convert grayscale or binary image to indexed image
I = imread('cameraman.tif');[X, map] = gray2ind(I, 16);
subplot(1,2,1), subimage (I), subplot(1,2,2), subimage (X,map);
Convert RGB image to indexed image
RGB = imread('peppers.png');[X,map] = rgb2ind(RGB,128);
subplot(1,2,1), subimage (RGB), subplot(1,2,2), subimage (X,map);
Convert indexed image to grayscale image
X=imread(‘trees.tif’);I = ind2gray(X,map);
subplot(1,2,1), subimage (X,map), subplot(1,2,2), subimage (I);
Convert indexed image to RGB image
X=imread(‘trees.tif’);I = ind2rgb(X,map);
subplot(1,2,1), subimage (X,map), subplot(1,2,2), subimage (I);
Convert grayscale image to indexed image using multilevel thresholding
I = imread('snowflakes.png');X = grayslice(I,16);
subplot(1,2,1), subimage(I),subplot(1,2,2),subimage(X,jet(16))
Convert matrix to grayscale image
I = imread('rice.png');J = filter2(fspecial('sobel'),I);
K = mat2gray(J);
subplot(1,2,1), subimage(I),subplot(1,2,2),subimage(K)
No comments:
Post a Comment