Code Monkey home page Code Monkey logo

coinlq / guji_repository Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 2.0 81.52 MB

华夏文明给我们留下了浩如烟海的文献典籍,古籍的数字化可以让大众更方便更大范围的享受这一文化大餐,弥补不能接触原典的遗憾。古籍数字化中汉字分割是关键环节,诚邀您共同参与。古籍汉字切分算法研究:将古籍扫描图片上的汉字切分出来的算法研究。

License: MIT License

guji_repository's People

Contributors

feixeyes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

guji_repository's Issues

高丽藏图片matlab投影切图方法

f = imread('gl_40_76.jpg'); %读原图文件
%f = imread('dh224_b.jpg');
figure(1);imshow(f); %显示原图
g = rgb2gray(f) %彩色图转换为灰度图
figure(2); imshow(g); %显示灰度图

level = graythresh(g); %设定灰度阈值
bw = ~im2bw(g,level); %灰度图转换为二值图
figure(4); imshow(bw); %显示二值图

s = size(bw); %计算矩阵大小
%求图像的列像素累加和
for i = 1:s(2)
gx(i) = 0;
for j = 1:s(1)
gx(i) = gx(i)+ bw(j,i);
end
end
x = 1:s(2);
%line(x, gx,'Color','b'); %显示求和曲线

windowSize = 15; %滤波窗宽
gy = filter(ones(1,windowSize)/windowSize,1,gx); %对曲线进行滑动平均滤波
gy = filter(ones(1,windowSize)/windowSize,1,gy); %再次滤波
gmax = find(diff(sign(diff(gy)))== -2)+1; %求极大值
%line(x, gy,'Color','r'); %绘滤波后的曲线
smax = size(gmax); %极大值点数
ly = 1:s(1) %绘切割竖线
for k = 1:smax(2)
if(k == 1) %左边第一列字两边都划线
lq(1) = gmax(k)-4*windowSize; %左边第一条竖线水平坐标
line(lq(1), ly,'Color','y'); %绘第一条竖线
lq(2) = gmax(k) + windowSize; %第二条竖线的水平坐标
line(lq(2), ly,'Color','y'); %绘第二条竖线
end

lq(k+1) = gmax(k) + windowSize;                        %其余竖线的水平坐标
line(lq(k+1), ly,'Color','y');                                     %绘其余的竖线

end

for k = 1:gmax+1 %列字条水平像素累加
for i = 1:s(1)
py(i) = 0;
for j = lq(k):lq(k+1)
py(i) = py(i)+ bw(i,j);
end
end
windowSize = 23; %滤波窗宽
py = filter(ones(1,windowSize)/windowSize,1,py); %对投影曲线滑动滤波
fpy = filter(ones(1,windowSize)/windowSize,1,py); %二次滤波
pmax = find(diff(sign(diff(fpy)))==- 2)+1; %求极大值
psmax = size(pmax); %极值点数

lx = lq(k):lq(k+1);
for m = 1:psmax(2)
    hq(m) = pmax(m);                                                     %横切线的竖直坐标
    line(lx, hq(m), 'Color','r');                                                    %绘横切割线
    hold on                                                                               %保持绘图
end   

end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.