I
摘要
近几年来,智能手机的迅猛发展给人们的生活带来了极大的改变,移动互联网时代的
来临使得人手拥有一台配置强悍的智能手机已不再是奢望。但随着社会老龄化问题的日益
严重,智能手机市场对老年人市场的投入却依旧跟不上时代发展的步伐。老年人由于视力
衰退,阅读报纸上的文字较为吃力,长时间戴眼镜更会加剧眼睛的疲劳状况。本设计提出
了用智能手机帮助老年人阅读报纸的可能,并实现了一款基于 Android 智能手机的应用。
本设计实现了一款基于安卓智能手机的报纸阅读器,具有将拍照得到的图片转成文字
再朗读出来的功能,并支持报纸内容存储、音量调节、自定义朗读语言等功能,能极大缓
解老年人阅读报纸时的不便。论文首先介绍了 Android 开发平台以及 Cordova 跨平台开
发方案,然后详细分析了该应用的所有功能需求,再结合应用开发的基础知识,讲解了开
发所需的知识点,最后给了详细的代码实现方案。
关键词:Android;Cordova;报纸阅读器;OCR;TTS
II
Abstract
In recent years, the rapid development of smart phones changed people's lives dramatically,
and the advent of the mobile Internet era make everybody having a powerful configuration
smartphone is no longer a luxury. But with an aging society is becoming increasingly serious,
smart phone market for the elderly still can not keep up the pace of their development. Elderly
due to vision loss, read the newspaper is more difficult to them, and long wear glasses can
exacerbate eye fatigue condition. This design made smart phones may help the elderly to read the
newspaper, and implemented of an Android-based smartphone application for them.
This design implemented an Android-based smartphone newspaper reader, which can
transform photo into text and then read out it, and also support the content storage, volume
control, custom speaking language to greatly alleviate the elderly inconvenience when reading
the newspaper. This paper introduces the Android development platform and Cordova first, and
then analysis of the the application of all functional requirements, combined with development
and application of basic knowledge and explain the knowledge required to develop, finally give
the detailed code scheme.
Keyword: Android; Cordova; newspaper reader; OCR; TTS
III
目录
摘要..........................................................................................................................................I
Abstract ...................................................................................................................................II
第一章 引言.........................................................................................................................1
1.1 课题背景 .............................................................................................................1
1.2 课题任务 .............................................................................................................1
1.3 内容的安排 .........................................................................................................2
第二章 开发环境及相关技术简介.....................................................................................3
2.1 Android 简介...........................................................................................................3
2.2 Cordova 简介 ..........................................................................................................4
2.2.1 Cordova 介绍 ..................................................................................................4
2.2.2 Cordova 原理简要分析 ..................................................................................5
2.3 OCR 简介.................................................................................................................5
2.3.1 OCR 介绍 ........................................................................................................5
2.3.2 OCR 识别方式介绍 ........................................................................................6
2.4 TTS 简介..................................................................................................................7
2.4.1 TTS 介绍 .........................................................................................................7
2.4.2 TTS 基本组成 .................................................................................................7
2.4.3 中文 TTS 系统 ...............................................................................................8
2.5 Node.js 简介 ...........................................................................................................8
2.5.1 Node.js 介绍....................................................................................................8
2.5.2 Node.js 模块....................................................................................................9
2.5.3 NPM 简介........................................................................................................9
2.6 本章小结 ..................................................................................................................9
第三章 报纸阅读器的需求分析.......................................................................................10
3.1 业务描述 ...........................................................................................................10
3.2 业务处理流程 ...................................................................................................10
3.3 客户需求分析 ...................................................................................................11
3.4 本章小结 ................................................................................................................11
IV
第四章 报纸阅读器的功能设计.......................................................................................12
4.1 主要业务处理流程 ...........................................................................................12
4.2 UI 组件布局 ..........................................................................................................13
4.2.1 HTML,CSS 简介........................................................................................13
4.2.2 总体设计风格 ..............................................................................................14
4.2.3 UI 布局 ..........................................................................................................14
4.3 拍照功能的调用 ...............................................................................................16
4.4 裁剪图片 ...........................................................................................................17
4.5 上传图片 ................................................................................................................17
4.6 OCR 识别 .................................................................................................................17
4.7 TTS 功能的使用 ......................................................................................................18
4.8 本章小结 ................................................................................................................18
第五章 报纸阅读器的实现...............................................................................................19
5.1 项目开发软硬件平台 .............................................................................................19
5.2 项目创建 .................................................................................................................20
5.2.1 开发环境搭建 ..............................................................................................20
5.2.2 Cordova 工程创建........................................................................................20
5.2.3 项目目录介绍..............................................................................................21
5.3 软件功能实现 .........................................................................................................22
5.3.1 UI 界面 ..........................................................................................................22
5.4.2 数据存储 .......................................................................................................22
5.4.3 拍照功能 ......................................................................................................22
5.4.4 裁剪图片 ......................................................................................................23
5.4.5 上传图片 ......................................................................................................24
5.4.6 浏览新闻 ......................................................................................................25
5.4.7 朗读 ..............................................................................................................26
5.4.8 音量调节 ......................................................................................................27
5.4.9 音量条 UI .....................................................................................................27
5.4.10 检测网络状态 .............................................................................................28
5.4.11 检测是否安装讯飞语音 .............................................................................28
5.4.12 跳转至设置界面 .........................................................................................29
5.5 兼容性测试 .......................................................................................................29
5.6 模块功能测试 ...................................................................................................31
5.7 OCR 识别效果测试...............................................................................................35
V
5.7.1 正常情况 .......................................................................................................35
5.7.2 光线暗处 .......................................................................................................36
5.7.3 纸张弯曲时 ...................................................................................................38
5.7.4 字体较小时 ...................................................................................................41
5.7.4 结论 ...............................................................................................................42
5.8 应用效果 ...........................................................................................................42
5.9 本章小结 ...........................................................................................................49
结束语...................................................................................................................................50
参考文献...............................................................................................................................50
致谢.......................................................................................................................................50