前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >一种利用熵方法实现声纳图像分割的方法。

一种利用熵方法实现声纳图像分割的方法。

作者头像
裴来凡
发布2022-05-28 15:19:28
2640
发布2022-05-28 15:19:28
举报
文章被收录于专栏:图像处理与模式识别研究所

Cover_Denoise_Image.m

代码语言:javascript
复制
function Expanded_Image = Cover_Denoise_Image(Img_Dilate, Img_Denoise, Removing_Shadow_Boundaries)
%Cover Denoise Original Image
[Localization, yuzhi1, yuzhi2, lyuzhi1, lyuzhi2] = Localization_Ship(Removing_Shadow_Boundaries);
Expanding_Image = Img_Dilate;  %Expanding Image ------> Smaller Image
Expanded_Image = Img_Denoise;  %Expanded Image ------> Bigger Image
[height, width] = size(Expanded_Image);

for line_Expanded_Image = 1:height
    for column_Expanded_Image = 1:width
        for line_Image_Expanding = (yuzhi1+line_Expanded_Image): yuzhi2
            for column_Image_Expanding = (lyuzhi1+column_Expanded_Image): lyuzhi2     
                if Expanding_Image(line_Expanded_Image, column_Expanded_Image) == 1
                    Expanded_Image(yuzhi1+line_Expanded_Image, lyuzhi1+column_Expanded_Image) = 255;
                end
            end
        end
    end
end

main.m

代码语言:javascript
复制
clc
clear all

%Read the Original Image
Original_Image = Read_Image('sonar_original.jpg');

%Gray the Image
Img_gray = Gray_Image(Original_Image);

%Denoise the Image
Img_Denoise = Denoise(Img_gray);

%Edge the Image
Img_Edge = Edge_Detection(Img_Denoise);

%Removing  Shadow Boundaries
Removing_Shadow_Boundaries = Remove_Shadow_Boundary(Img_Edge, Img_Denoise);

%Locate the Ship Body
[Localization, yuzhi1, yuzhi2, lyuzhi1, lyuzhi2] = Localization_Ship(Removing_Shadow_Boundaries);

%Remove the margin of Ship
[Dilate_New_Img, jg_recreate] = Remove_the_margin_of_Ship (Localization);

%Dilate the Image
Img_Dilate = Dilate_Image(Dilate_New_Img);

%Cover the Denoise Image With Dilation Image
Expanded_Image = Cover_Denoise_Image(Img_Dilate, Img_Denoise, Removing_Shadow_Boundaries);

% 2-Dimensionality Entropy Segmentation ------> Expanding Image
Img_Entropy = Entropy_Segmentation(Expanded_Image);

%Filling the Entropy Segmentation Image: Finding the First White and the First Black Pixel Then Merge White Color
Final_Image = postprocessing(Img_Entropy);



%Draw Result
figure(1)
subplot(3, 4, 1), imshow(Original_Image), title('Original Image')
subplot(3, 4, 2), imshow(Img_gray), title('Gray Image')
subplot(3, 4, 3), imshow(Img_Denoise), title('Denoise Image (Discrete Cosine Transform)')
subplot(3, 4, 4), imshow(Img_Edge), title('Edge Image (Roberts)')
subplot(3, 4, 5), imshow(Removing_Shadow_Boundaries), title('Remove Shadow Boundaries')
subplot(3, 4, 6), imshow(Localization), title('Ship Localization (Threshold)')
subplot(3, 4, 7), imshow(jg_recreate), title('Ship Boundaries Extraction (Left & Right Pixel)')
subplot(3, 4, 8), imshow(Dilate_New_Img), title('Remove Ship Boundaries')
subplot(3, 4, 9), imshow(Img_Dilate), title('Dilate White Pixel (Morphology Dilation)')
subplot(3, 4, 10), imshow(Expanded_Image), title('Merge Denoise & Dilation Images')
subplot(3, 4, 11), imshow(Img_Entropy), title('2-D Entropy Segamentation')
subplot(3, 4, 12), imshow(Final_Image), title('Postprocessing')

% imwrite(Img_gray, 'Img_gray.jpg')
% imwrite(Img_Denoise, 'Img_Denoise.jpg')
% imwrite(Img_Edge, 'Img_Edge.jpg')
% imwrite(Removing_Shadow_Boundaries, 'Removing_Shadow_Boundaries.jpg')
% imwrite(Localization, 'Localization.jpg')
% imwrite(Dilate_New_Img, 'Dilate_New_Img.jpg')
% imwrite(Img_Dilate, 'Img_Dilate.jpg')
% imwrite(Expanded_Image, 'Expanded_Image.jpg')
% imwrite(Img_Entropy, 'Img_Entropy.jpg')
% imwrite(Final_Image, 'Final_Image.jpg')
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2020-05-13,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 图像处理与模式识别研究所 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档