Grouping objects (blobs) in an image

1 次查看(过去 30 天)
Aliyu Abdu
Aliyu Abdu 2012-5-31
回答: syeda saba 2021-1-25
I want to group a number of blobs in my image: https://www.dropbox.com/s/0d6mrvssx9vr3yg/im.png. The blobs are separated at certain distances from each other. Below is the code I'm working with;
clc, close all, clear all
I = imread('im.png');
re = I;
spacevector = zeros;
n = 0;
lines = 0;
while 1
[fl re]=lines_crop(re); %fl= first line, re= remaining image
%imgn=fl;
lines = lines + 1;
rc = fl;
while 1
%Fcn 'letter_crop' separate letters in a line
[fc rc space]=letter_crop(rc); %fc = first letter in the line
%rc = remaining cropped line
%space = space between the letter
%cropped and the next letter
n = n + 1;
spacevector(n)=space;
if isempty(rc)
break;
end
end
if isempty(re)
break
end
end
median_space = median(spacevector); %Gets the median separation space.
%figure,imshow(I);
% title('Original binary Image')
I have gotten the space between adjacent blobs in the "space_vector" as well as the "median" distance. What I want to do is to group blobs that are separated by the distance "median" in each line and assign a number such that the first group would be "1", second group "2".....and so on. I can't figure out how to do it . Please can anyone help? Thanks in advance.

回答(1 个)

syeda saba
syeda saba 2021-1-25
clear all;
close all;
clc;
%1. Display the image.
I=imread('blobs.png');
subplot(2,2,1);
imshow(I);
title('Original Image');
%2. Adjust the histogram so that 1% data is saturated at high and low intensities.
H1=fspecial('motion',50,45); % inducing perpendicular motian blur to the original image
blurred_im=imfilter(I,H1);
subplot(2,2,2);
imshow(blurred_im);
title(' motion blurred image');

类别

Help CenterFile Exchange 中查找有关 Images 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by