can you help us for area segmentation method on temporal bone object to segment the region marked with arrows
조회 수: 1 (최근 30일)
이전 댓글 표시
can you help us for area segmentation method on temporal bone object to segment the region marked with arrows
Thank you
댓글 수: 0
답변 (2개)
yanqi liu
2021년 9월 28일
sir,please check the follow code to get some information
clc; clear all; close all;
im = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/751599/image.jpeg');
im = rgb2gray(im);
% make bw
bw = imbinarize(im,'adaptive','ForegroundPolarity','dark','Sensitivity',0.85);
% choose target
bw2 = imfill(bw, 'holes'); bt = imclose(bw2, strel('disk', 2));
bw2 = imfill(bt, 'holes');
bw2 = imopen(bw2, strel('disk', 10));
bw2(:,round(size(bw2,2)/2):end)=0;
bw2 = bwareafilt(logical(bw2),1);
bt = logical(bw.*bw2);
bt2 = ~bt; bt2 = imclearborder(bt2);
bt(bt2) = 0;
bt = logical(bt);
bt = bwareaopen(bt, 80);
bt = imclose(bt, strel('disk', 20));
bt(bt2) = 0;
bt = logical(bt);
% make result
im1 = im; im2 = im; im3 = im;
im1(bt) = 255; im2(bt) = 0; im3(bt) = 0;
imr = cat(3,im1,im2,im3);
% display
figure; imshow(imr, []);
댓글 수: 13
yanqi liu
2022년 1월 5일
clc; clear all; close all;
img = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/853405/image.png');
im = imcrop(img, [24 88 379 219]);
im = rgb2gray(im);
bw = im2bw(im);
bw = imclose(bw, strel('disk', 19));
[L,num] = bwlabel(bw);
stats = regionprops(L);
rects = cat(1, stats.BoundingBox);
[~,ind] = sort(rects, 1);
im1 = im; im2 = im;
im1(L~=ind(1)) = 0; im2(L~=ind(2)) = 0;
figure;
subplot(1,3,1); imshow(im, []);
subplot(1,3,2); imshow(im1, []); title('left');
subplot(1,3,3); imshow(im2, []); title('right');
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!