使用matlab找到包含边界框内手写字符的图像的重心

时间:2015-02-27 14:27:00

标签: matlab

我正在撰写论文"手写文本文档的细分" 。我正在阅读并尝试在纸张"文本行和手写文档的分词" " G上执行代码。 Louloudis,B.Gatos,I。Pratikakis,C。Halatsis" 使用 Matlab 。在本文索引" 3.2 Hough变换映射" 我需要找到重心就像这个图像

enter image description here

使用字符的平均高度和宽度创建框,并在最右边的块上应用了异常。我的图像是二进制的,我已经尝试获得重力中心&#39 ; s坐标通过取每个像素的平均值(因为图像是二进制)在每个边界框内并尝试绘制一个红色圆圈来显示重心。

但我对结果不满意。有没有有效的方法来使用Matlab获得重力中心? 如果您需要本文,请点击链接Text line and word segmentation of handwritten documents

1 个答案:

答案 0 :(得分:0)

这是一个尝试,使用此图像:

enter image description here

% --- Load image
Img = imread('letter.jpg');

% Convert to double and grey levels 
Img = rgb2gray(double(Img));

% --- Find the barycenter of the thresholded image
[I, J] = find(Img>100);
x = mean(J);
y = mean(I);

% --- Display
hold on
imshow(Img);
caxis auto
scatter(x, y, 'rx');

结果:

enter image description here

这只是一种可能性,有很多方法可以获得图像的质心。