Enclosing Boundary - for blobs
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Conor O'Keeffe
il 3 Lug 2021
Commentato: Conor O'Keeffe
il 4 Lug 2021
Hi all
Is it possible to get the boundary central more dense region - ignoring the blobs on the side
6 Commenti
Risposta accettata
Matt J
il 3 Lug 2021
Modificato: Matt J
il 3 Lug 2021
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'));
0 Commenti
Più risposte (1)
DGM
il 3 Lug 2021
Modificato: DGM
il 4 Lug 2021
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)

0 Commenti
Vedere anche
Categorie
Scopri di più su Computer Vision with Simulink in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
