From: Roshan Rajaratnam on
i need to calculate the boundingbox for a signature. but the issue is that some signatures are not connected so how can i get one boundingbox for the whole signature?

thanx
From: Ashish Uthama on
An image would help.

Can you threshold the image so that only the signature (or most parts of
it) remain while the rest is zero? If so, you could just find the largest
and smallest row column indices of non-zero pixels:

>> img=peaks(10)>2

img =

0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 0 1 1 0 0
0 0 0 0 0 0 1 1 0 0
0 0 0 0 1 1 1 0 0 0
0 0 0 1 1 1 1 0 0 0
0 0 0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0 0 0

>> [r,c]=find(img);
>> min(r)

ans =

5

>> max(r)

ans =

9

>> img=peaks(10)>2;
>> [r,c]=find(img);
>> bb = [ min(r) max(r) min(c) max(c)]

bb =

5 9 4 8


>> img(5:9, 4:8)

ans =

0 1 0 1 1
0 0 0 1 1
0 1 1 1 0
1 1 1 1 0
0 1 1 0 0