RSS

matlab.exe

11 Jan


praguire(binarizare):
>> a=imread(‘peppers.png’);
>> level=graythresh(a);
>> b=rgb2gray(a);
>> out=b>level*255;
>> imshow(out);

praguire cu nivel:
>> a=imread(‘peppers.png’);
>> b=rgb2gray(a);
>> level=50;
>> out=b>level;
>> imshow(out);

clipping:
>> a=imread(‘peppers.png’);
>> out=(a>=30)&(b<=60);
imgfinala=uint8(double(a).*double(out));
>> imshow(imgfinala);

Slicing:
>> a=imread(‘cameraman.tif’);
>> level1=30;
>> level2=60;
>> b=(a>level1)&(a> imshow(b);

contrast streching:
>> a=imread(‘cameraman.tif’);
>> out=imadjust(a, [0.25, 0.3], [0,1]);
>> imshow(out);

Logaritm(compandare):
>> a=imread(‘cameraman.tif’);
>> out=uint8(255/log(256)*log(double(a)+1));
>> imshow(out);

Exponentiala(expandare):
>> a=imread(‘peppers.png’);
>> out=uint8((255*exp((double(a)/255)-1)/(exp(1)-1)));
>> imshow(out);

Putere:
>> a=imread(‘cameraman.tif’);
>> out=uint8(255*(double(a)/255)^1);
>> imshow(out);

Egalizare de histograma:
>> a=imread(‘cameraman.tif’);
>> hgrama=histeq(a);
>> imshow(hgrama);

erodare:
>> a=imread(‘peppers.png’);
>> b=rgb2gray(a);
>> imshow(b);
>> SE=strel(‘disk’,11);
>> out=imerode(b,SE);
>> imshow(out);

etichetare:
>> a=imread(‘peppers.png’);
>> BW=im2bw(a,graythresh(a));
>> L=bwlabel(BW);
>> RGB=label2rgb(L);
>> imshow(RGB)

sau i=imread(‘cameraman.tif’);
>> a=i>50;
>> b=bwlabel;
>> c=label2rgb(b);
>> imshow(c);

modif liniara de contrast:
i=imread(‘cameraman.tif’);
Ta=30;
Tb=70;
a=20;
b=80;
c(1:a)=Ta/a*[0:a-1];
c(a+1)=Ta+(Tb-Ta)/(b-a)*([a-1]-a);
c(b+1:256)=Tb+(255-Tb)/(255-b)*([b:255]-b);c=uint8(c);
out=c(i+1);
imshow(out);

cei mai mici 3 pixeli:
a=imread(‘cameraman.tif’);
b=unique(sort(a( : )));
c=b(1:3)

oglindire pe verticala:
>> c=imread(‘peppers.png’);
>> a(:,1:256)=c(:,256:-1:1);
>> figure, imshow(a);

oglindire pe orizontala:
>> c=imread(‘peppers.png’);
>> b(1:256,:)=c(256:-1:1,:);
>> figure, imshow(b);

Inserarea unui disc alb intr-o imagine
discul este cu centrul in punctul de coordonate (x,y) si are raza r
x=30;
y=40;
r=10;
nivel=255; nivelul de gri al discului
s=size(imagine);
for i=1:s(1)
for j=1:s(2)
if ((i-x)^2+(j-y)^2)<=r^2
imagine(i,j)=nivel;
end
end
end

Advertisements
 
Leave a comment

Posted by on January 11, 2011 in 1

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: