Eliminating Groups of Connected Pixels.
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Amanda Johnson
el 31 de Jul. de 2014
Comentada: mika
el 25 de Nov. de 2014
I would like to be able to look at the matrices of an image and convert certain connected pixel groups from 1’s to 0’s. I would like to be able look at each individual rows and columns and convert groups or individual pixel that are smaller than a defined amount of pixels. I have used the bwareaopen function to eliminate pixel groups that are smaller than a defined amount. But I cannot determine how to use this concept for individual rows or columns.
For example, I would like to eliminate the square in the first image below. . .

. .
0 comentarios
Respuesta aceptada
Image Analyst
el 31 de Jul. de 2014
First of all, you shouldn't use highly compressed jepg images for image analysis or else you get bad artifacts like you're seeing.
The "square" is the outermost object and will have label 1. So label everything and remove it. Something like this (untested off the top of my head);
[labeledImage, numberOfRegions] = bwlabel(binaryImage);
% Binarize the labeled image to get back to a binary image again.
binaryImage = labeledImage > 1; % Keep all except region #1.
5 comentarios
Image Analyst
el 1 de Ag. de 2014
Well if you already knew where the things were so that you could draw a template, you can just erase them a lot easier than creating a template, then dilating and subtracting fro original. You can simply erase:
BW(row1:row2, col1:col2) = false;
Just do that 4 times, once for each side of the square. I'm pretty sure it will be faster also.
mika
el 25 de Nov. de 2014
Hello Image Analyst,
Can you please tell me how to calculate the the distance transform image knowing that i want to delete edges from a skeleton that are >12 pixels
thak you!
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!