Hi all
Is it possible to get the boundary central more dense region - ignoring the blobs on the side

댓글 수: 6

DGM
DGM 2021년 7월 3일
You might want to describe the method you're currently using.
Image Analyst
Image Analyst 2021년 7월 3일
What does this thing represent? What is the real world object you images to get this? Is the real object known to be a rectangle or cylinder, with straight sides, or does it have ragged sides?
Conor O'Keeffe
Conor O'Keeffe 2021년 7월 4일
Sorry yeah, the original image is attaced. I want to get the outline of the metal strut.
Basically getting to this point by thresholding.
Its an old image Im going back to so wasent thinking about getting a good contrast.
Image Analyst
Image Analyst 2021년 7월 4일
@Conor O'Keeffe, after seeing your original gray scale image, I think Matt's solution is the one you should use and Accept.
DGM
DGM 2021년 7월 4일
I think I'd agree with that.
Conor O'Keeffe
Conor O'Keeffe 2021년 7월 4일
Yes thats great, thank you all for the help. Seems to be matching to the greyscale image (attached)

댓글을 달려면 로그인하십시오.

 채택된 답변

Matt J
Matt J 2021년 7월 3일
편집: Matt J 2021년 7월 3일

1 개 추천

Perhaps as follows,
BW0=load('Image.mat').BW;
BW= imclose(BW0,strel('disk',3));
BW = imfill( BW ,'holes') ;
BW=bwareafilt( BW,1);
boundary=fliplr( cell2mat( bwboundaries( BW ) ) );
imshow(insertMarker(double(BW0),boundary,'o','Size',1,'Color','m'));

추가 답변 (1개)

DGM
DGM 2021년 7월 3일
편집: DGM 2021년 7월 4일

1 개 추천

I'll throw this out there. I'm assuming that the goal here is density-dependent (linear) mask constriction. On that assumption, I'm avoiding erosion and using an averaging filter and thresholding. It works, but it would likely require adjustment, considering I don't know what the particular limits are or what other images will look like.
% parameters
frad = 15;
masklevel = 0.1;
outlevel = 0.18;
% flattened, binarized image
inpict = rgb2gray(imread('capture.jpg'))>128;
% if you want to filter by local density, maybe use an avg filter
wpict = imfilter(double(inpict),fspecial('disk',frad));
% first pass to get rid of stray exterior points
mask = double(bwareafilt(wpict>masklevel,1));
wpict = wpict.*mask;
% second pass to tighten group following density
wpict = wpict>outlevel;
% as opposed to erosion which follows envelope
%wpict = imerode(wpict,strel('disk',10));
% for viewing, i'm just going to slap together a weighted mean
% you can use whatever you want. wpict is just a binary mask like any other.
k = 0.3;
comp = inpict*k + wpict*(1-k);
imshow(comp)

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

질문:

2021년 7월 3일

댓글:

2021년 7월 4일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by