MATLAB Answers

Grouping objects (blobs) in an image

11 views (last 30 days)
Aliyu Abdu
Aliyu Abdu on 31 May 2012
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.

  0 Comments

Sign in to comment.

Answers (0)

Categories


Translated by