diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /3176/CH10/EX10.23/Ex10_23.sce | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '3176/CH10/EX10.23/Ex10_23.sce')
-rw-r--r-- | 3176/CH10/EX10.23/Ex10_23.sce | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/3176/CH10/EX10.23/Ex10_23.sce b/3176/CH10/EX10.23/Ex10_23.sce new file mode 100644 index 000000000..808c93a5a --- /dev/null +++ b/3176/CH10/EX10.23/Ex10_23.sce @@ -0,0 +1,73 @@ +//Ex10_23
+// Segmentation by Region Growing
+// Version : Scilab 5.4.1
+// Operating System : Window-xp, Window-7
+//Toolbox: Image Processing Design 8.3.1-1
+//Toolbox: SIVP 0.5.3.1-2
+//Reference book name : Digital Image Processing
+//book author: Rafael C. Gonzalez and Richard E. Woods
+
+clc;
+close;
+clear;
+xdel(winsid())//to close all currently open figure(s).
+a=imread("Ex10_23.tif");
+a1=im2double(a);
+figure,ShowImage(a1,'Gray Image');
+title('Original Image','color','blue','fontsize',4);
+[M,N]=size(a);
+
+[count cell]=imhist(a);
+figure,plot2d3(cell,count);
+title('Histogram','color','blue','fontsize',4);
+
+th=254/255;
+Thresh_Image=im2bw(a1,th);
+figure,ShowImage(Thresh_Image,'Gray Image');
+title('Thresholded Image','color','blue','fontsize',4);
+for i=1:M
+ for j=1:N
+ if(Thresh_Image(i,j)) then
+ Thresh_Image1(i,j)=1;
+ else
+ Thresh_Image1(i,j)=0;
+ end
+ end
+end
+
+BlobImage = SearchBlobs(Thresh_Image); // Connected Compoment Labelling
+IsCalculated = CreateFeatureStruct(%f); // Feature struct is generated.
+IsCalculated.Centroid = %t; // The bounding box shall be calculated for each blob.
+BlobStatistics = AnalyzeBlobs(BlobImage, IsCalculated);
+Seed_Image=zeros(M,N);
+for i=1:max(BlobImage) // Centroid Calculation
+ Seed_Image(BlobStatistics(i).Centroid(1,2),BlobStatistics(i).Centroid(1,1))=1;
+end
+figure,ShowImage(Seed_Image,'Gray Image');
+title('Seed Point Image','color','blue','fontsize',4);
+
+Diff=uint8(255*imsubtract(a1,Thresh_Image1));
+figure,ShowImage(Diff,'Gray Image');
+title('Seed Point Image','color','blue','fontsize',4);
+[count cell]=imhist(Diff);
+figure,plot2d3(cell,count);
+title('Histogram','color','blue','fontsize',4);
+
+Thresh_Image2=uint8(zeros(M,N))
+for i=1:M
+ for j=1:N
+ if(Diff(i,j)<=68) then
+ Thresh_Image2(i,j)=255;
+ else if(Diff(i,j)>68 & Diff(i,j)<=165) then
+ Thresh_Image2(i,j)=125;
+ else
+ Thresh_Image2(i,j)=0;
+ end
+ end
+ end
+end
+figure,ShowImage(uint8(Thresh_Image2),'Gray Image');
+title('Seed Point Image','color','blue','fontsize',4);
+
+
+
|