0

要分割的图像

 To segment above image i want to use line height. I don't know even any algorithm for   this. I want a useful link pls help..

 just i want an efficient algorithm link for this.....

 I shall be very thankful to you for this..

// 我一直尝试到现在

 function [avmax avmin avgwidth]=firstsvg(Imag)
 %Imag=imread('D:\THAPAR\poj\images\ndpj.jpg');
 imtool(Imag);
 G=Imag;
 %xlswrite('G.xlsx',Imag(:,:,1));
 [y,x]=size(G);  % y dentoes rows and x denotes columns
 T=160;%sum(sum(I))/(y*x)%T dentoes threshhold value - i.e avg
 HYT=zeros(1,1);
 GY=zeros(y,1);  %single column of zeros              
 for j=1:y   
     for i=1:x
        if (G(j,i)<T)         
         GY(j,1)=GY(j,1)+1;  % count of no. of black pixel
       end    
    end
 end
 for c=1:y
    if (GY(c,1)> min)
     min = GY(c,1);
     gt(ce,1)=GY(c,1);
     ce=ce+1;
    end
 end
 dgt=zeros(ce,1);
 for b=1:(ce-2)
   dgt(b,1)= gt(b+1,1)- gt(b,1);
 end
 mdgt= mean(dgt);
 avgwidth= thyt;
 avmax =thyt;
 avmin = gt(1,1);

 just i want an algorithm link to calculate line height ???
4

1 回答 1

-1

假设您有 M x N 维度的图像,其中 M 是行,N 是列。对行中的像素执行逻辑或。如果你得到 1,那么你在特定行中至少有一个黑色像素。只需查看您获得的连续 1 的数量,它将是每个句子的大致高度。

于 2013-03-07T07:09:35.480 回答