Found this link below very helpful
http://cmm.ensmp.fr/~beucher/wtshed.html
And wikipedia is good for knowledge,
Found this link below very helpful
http://cmm.ensmp.fr/~beucher/wtshed.html
And wikipedia is good for knowledge,
Loop example in MATLAB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
function [ output_args ] = Untitled( input_args ) %UNTITLED Summary of this function goes here % Detailed explanation goes here A= [ 1 2 3; 4 5 6; 7 8 9]; [x,y]=size(A); K=1; for i=1:x for j=1:y C(K) = A(i,j); K=K+1; end; end; A C end |
Output:
A =
1 2 3
4 5 6
7 8 9
C =
1 2 3 4 5 6 7 8 9
A=[1 2 3;4 5 6;7 8 9]
A =
1 2 3
4 5 6
7 8 9
B=[2 3 4;5 6 7;8 9 10]
B =
2 3 4
5 6 7
8 9 10
A+B
ans =
3 5 7
9 11 13
15 17 19
F=A-B
F =
-1 -1 -1
-1 -1 -1
-1 -1 -1
A’
ans =
1 4 7
2 5 8
3 6 9
size(A)
ans =
3 3
It may help
Posted in A ll Codes, Digital Image Processing
Tagged Digital Image Processing, MATLAB
To show image from desktop folder to matlab image viewer
1 2 |
I=imread('C:\Users\Daffodil\Desktop\imread\zaki.jpg'); image(I) |
then to convert YIQ value we need to write this line
1 |
YIQ=rgb2ntsc(I); |
and for converting rgb to hsv we need tghis line
1 |
HSV=rgb2hsv(I); |
To make it grayscale
1 2 |
B=rgb2gray(I); imshow(B); |
For showing the size:
1 2 |
size(I); //outpput will be 300x205x3 height x width x byte ; it's for color image size(B); //output will be 300x205 height x width ; it's for grayscale image |
For plotting in a matrix it follow subplot(m,n,p), imshow(X); format of 2×2 matrix 1 no. coloumn where p=1 and if p=2 then it will be plot in 2 no column
1 2 |
subplot(2,2,1), imshow(I); subplot(2,2,2), imshow(B); |
For finding edges from grayscale image and plot in coloumn 3 using canny method
1 2 |
C=edge(B,'canny'); subplot(2,2,3), imshow(C); |
For finding edges from grayscale image and plot in coloumn 4 using sobel method
1 2 |
D=edge(B,'sobel'); subplot(2,2,4), imshow(D); |
Example:
Posted in A ll Codes, Digital Image Processing
Tagged Digital Image Processing, MATLAB