CN110913060A - 一种基于Android获取名片信息添加到通讯录的实现方法 - Google Patents

一种基于Android获取名片信息添加到通讯录的实现方法 Download PDF

Info

Publication number
CN110913060A
CN110913060A CN201811079081.3A CN201811079081A CN110913060A CN 110913060 A CN110913060 A CN 110913060A CN 201811079081 A CN201811079081 A CN 201811079081A CN 110913060 A CN110913060 A CN 110913060A
Authority
CN
China
Prior art keywords
business card
mobile phone
card information
phone number
android
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811079081.3A
Other languages
English (en)
Inventor
陈林
张来卿
庞严冬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Hengqin Shengda Zhaoye Technology Investment Co Ltd
Original Assignee
Zhuhai Hengqin Shengda Zhaoye Technology Investment Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Hengqin Shengda Zhaoye Technology Investment Co Ltd filed Critical Zhuhai Hengqin Shengda Zhaoye Technology Investment Co Ltd
Priority to CN201811079081.3A priority Critical patent/CN110913060A/zh
Publication of CN110913060A publication Critical patent/CN110913060A/zh
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/60Type of objects
    • G06V20/62Text, e.g. of license plates, overlay texts or captions on TV images
    • G06V20/63Scene text, e.g. street names
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/26Devices for calling a subscriber
    • H04M1/27Devices whereby a plurality of signals may be stored simultaneously
    • H04M1/274Devices whereby a plurality of signals may be stored simultaneously with provision for storing more than one subscriber number at a time, e.g. using toothed disc
    • H04M1/2745Devices whereby a plurality of signals may be stored simultaneously with provision for storing more than one subscriber number at a time, e.g. using toothed disc using static electronic memories, e.g. chips
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Telephone Function (AREA)

Abstract

本发明涉及Android技术领域,特别涉及一种获取名片信息添加到通讯录的实现方法:一、在项目中添加依赖包;二、在Application中初始化ImageTranslator;三、配置权限;四、拍照名片;五、提取图片,进行修剪;六、定位手机号码,使用tess‑three解析;七、添加到通讯录。本发明解决了手工录取名片上手机号码保存到通讯录不方便的问题。

Description

一种基于Android获取名片信息添加到通讯录的实现方法
技术领域
本发明涉及Android技术领域,特别涉及一种基于Android获取名片信息添加到通讯录的实现方法。
背景技术
如今,随着移动手机互联的发展,移动手机端应用成爆发式的增长,在很多移动手机端中都涉及到对名片信息的录入,如移动手机CRM、移动手机端OA,移动手机访客系统等;如果手动输入名片信息,速度慢,易出错,用户体验非常差。
本发明在基于OCR识别与tess-three解析技术之上,实现了移动手机端名片扫描识别技术,提高在移动手机终端上输入名片信息的速度和准确性,能满足各个行业对名片信息自动录入的需求,用户只需在移动手机端中集成移动手机端名片扫描识别技术,便可通过手机拍照,自动录入识别名片信息。
发明内容
本发明解决的技术问题在于提供一种基于Android获取名片信息添加到通讯录的实现方法;本发明解决了手工录取名片上手机号码保存到通讯录不方便的问题。
本发明解决上述技术问题的技术方案是:
一、在项目中添加依赖包;二、在Application中初始化ImageTranslator;三、配置权限;四、拍照名片;五、提取图片,进行修剪;六、定位手机号码,使用tess-three解析;七、添加到通讯录。
所述的方法具体包括如下步骤:
步骤一、在项目中添加依赖包,首先在project的build.gradle中添加,然后在module的build.gradle中添加;
步骤二、在Application中初始化ImageTranslator;
步骤三、在AndroidManifest.xml文件中配置网络、获取摄像头、读写联系人、图片保存与读取等所需的权限;
步骤四、拍照名片;
步骤五、提取图片,进行修剪,所述的修剪主要有图片旋转、裁剪等步骤;
步骤六、定位手机号码,使用tess-three解析,所述的具体步骤:1、转为二值图像 并判断图像中是否可能有手机号;2、捕捉单行文字在图片中的矩形区域;3、把捕捉到的图块,写进新的bitmap中;4、调整阈值与二值化;5、粗略计算文字高度;6、判断区域中有几个字符;7、得到文字块的精准位置;8、将最终捕捉到的手机号区域像素提取到新的数组;9、使用递归的算法,从字符的第一个黑色像素,开始,分别进行上下左右的捕捉;
步骤七、添加到通讯录。
本发明的有益效果:在基于OCR识别与tess-three解析技术之上,实现了移动手机端名片扫描识别技术,提高在移动手机终端上输入名片信息的速度和准确性。有效地解决了手工录取名片上手机号码保存到通讯录不方便的问题。
附图说明
下面结合附图对本发明进一步说明:
图1为本发明的流程图。
具体实施方式
如图1所示,本发明采用如下步骤:
步骤一、在项目中添加依赖包,首先在project的build.gradle中添加,然后在module的build.gradle中添加;如:
allprojects {
repositories {
maven { url 'https://sdzy.io' }
}
}
dependencies {
compile 'com.github.SiKang123:ImgTranslator:lastVersion'
}
步骤二、在Application中初始化ImageTranslator;如:
public class App extends Application{
ImageTranslator.getInstance().init(ApplicationContext);
}
步骤三、在AndroidManifest.xml文件中配置网络、获取摄像头、读写联系人、图片保存与读取等所需的权限;如:
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<!-- 二维码扫描所需权限 -->
<uses-feature android:name="android.hardware.camera2.full" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
步骤四、拍照名片;如:
public void onPhoto(byte[] data, Camera camera) {
//识别中不处理其他帧数据
if (!isScanning) {
isScanning = true;
new Thread(new Runnable() {
@Override
public void run() {
try {
Camera.Size size = camera.getParameters().getPreviewSize();
//将帧数据转为bitmap
YuvImage image = new YuvImage(data, ImageFormat.NV21,size.width, size.height, null);
if (image != null) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
image.compressToJpeg(new Rect(0, 0, size.width, size.height), 80, stream);
Bitmap bmp = BitmapFactory.decodeByteArray(stream.toByteArray(), 0, stream.size());
});
}
} catch (Exception ex) {
isScanning = false;
}
}).start();
}
}
步骤五、提取图片,进行修剪,所述的修剪主要有图片旋转、裁剪等步骤;如:
public static Bitmap imgCrop(Bitmap bitmap, int left, int top, int width,int height) {
if (null == bitmap || width <= 0 || height < 0) {
return null;
}
int widthOrg = bitmap.getWidth();
int heightOrg = bitmap.getHeight();
if (widthOrg >= width && heightOrg >= height) {
try {
bitmap = Bitmap.createBitmap(bitmap, left, top, width, height);
} catch (Exception e) {
return null;
}
}
return bitmap;
}
//图片旋转
public static Bitmap imgRotate(Bitmap tmpBitmap, float degrees) {
Matrix matrix = new Matrix();
matrix.reset();
matrix.setRotate(degrees);
return Bitmap.createBitmap(tmpBitmap, 0, 0, tmpBitmap.getWidth(), tmpBitmap.getHeight(), matrix,
true);
}
步骤六、定位手机号码,使用tess-three解析,所述的具体步骤:1、转为二值图像 并判断图像中是否可能有手机号;2、捕捉单行文字在图片中的矩形区域;3、把捕捉到的图块,写进新的bitmap中;4、调整阈值与二值化;5、粗略计算文字高度;6、判断区域中有几个字符;7、得到文字块的精准位置;8、将最终捕捉到的手机号区域像素提取到新的数组;9、使用递归的算法,从字符的第一个黑色像素,开始,分别进行上下左右的捕捉;如:
public Bitmap getContact(final Bitmap bmp, int tmp) {
int width = bmp.getWidth(); // 获取位图的宽
int height = bmp.getHeight(); // 获取位图的高
int[] pixels = new int[width * height]; // 通过位图的大小创建像素点数组
bmp.getPixels(pixels, 0, width, 0, 0, width, height);//得到图片的所有像素
int lineHeight = 0;
int row = 0;
boolean isOutOfRect= false;
int left = 0;
int top = 0;
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
int grey = pixels[width * i + j];
// 分离三原色
alpha = ((grey & 0xFF000000) >> 24);
int red = ((grey & 0x00FF0000) >> 16);
int green = ((grey & 0x0000FF00) >> 8);
int blue = (grey & 0x000000FF);
if (red > tmp) {
red = 255;
} else {
red = 0;
}
}
if (bottom - top < height * 0.2f) {
isScanning = false;
return null;
}
int space = 0;
int textWidth = 0;
int startX = 0;
for (int j = 0; j < width; j++) {
}
if (right - left < width * 0.3f) {
isScanning = false;
return null;
}
int targetWidth = right - left;
int targetHeight = bottom - top;
int[] targetPixels = new int[targetWidth * targetHeight];
int index = 0;
for (int i = top; i < bottom; i++) {
for (int j = left; j < right; j++) {
if (index < targetPixels.length)
targetPixels[index] = pixels[width * i + j];
index++;
}
}
//销毁之前的图片
bmp.recycle();
// 新建图片
final Bitmap newBmp = Bitmap.createBitmap(targetWidth, targetHeight, Bitmap.Config.ARGB_8888);
//返回需要交给tess-three识别的内容
return newBmp;
}
步骤七、添加到通讯录。如:
public void insertConstacts() {
ContentValues values = new ContentValues();
Uri rawContactUri = mContext.getContentResolver().insert(
ContactsContract.RawContacts.CONTENT_URI, values);//EPApplication是我定义的Application的子类,getContextObject方法返回的是context
long rawContactId = ContentUris.parseId(rawContactUri);
// 表插入姓名数据
values.clear();
values.put(ContactsContract.Data.RAW_CONTACT_ID, rawContactId);
values.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE);/. ......
}。

Claims (2)

1.一种基于Android获取名片信息添加到通讯录的实现方法,其特征在于:一、在项目中添加依赖包;二、在Application中初始化ImageTranslator;三、配置权限;四、拍照名片;五、提取图片,进行修剪;六、定位手机号码,使用tess-three解析;七、添加到通讯录;从而本发明解决了手工录取名片上手机号码保存到通讯录不方便的问题。
2.根据权利要求1所述的基于Android平台的一种获取名片信息添加到通讯录的实现方法,其特征在于:使用OCR对图片识别,使用tess-three解析手机号码;所述的方法具体包括如下步骤:
步骤一、在项目中添加依赖包,首先在project的build.gradle中添加,然后在module的build.gradle中添加;
步骤二、在Application中初始化ImageTranslator;
步骤三、在AndroidManifest.xml文件中配置网络、获取摄像头、读写联系人、图片保存与读取等所需的权限;
步骤四、拍照名片;
步骤五、提取图片,进行修剪,所述的修剪主要有图片旋转、裁剪等步骤;
步骤六、定位手机号码,使用tess-three解析,所述的具体步骤:1、转为二值图像 并判断图像中是否可能有手机号;2、捕捉单行文字在图片中的矩形区域;3、把捕捉到的图块,写进新的bitmap中;4、调整阈值与二值化;5、粗略计算文字高度;6、判断区域中有几个字符;7、得到文字块的精准位置;8、将最终捕捉到的手机号区域像素提取到新的数组;9、使用递归的算法,从字符的第一个黑色像素,开始,分别进行上下左右的捕捉;
步骤七、添加到通讯录。
CN201811079081.3A 2018-09-17 2018-09-17 一种基于Android获取名片信息添加到通讯录的实现方法 Pending CN110913060A (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811079081.3A CN110913060A (zh) 2018-09-17 2018-09-17 一种基于Android获取名片信息添加到通讯录的实现方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811079081.3A CN110913060A (zh) 2018-09-17 2018-09-17 一种基于Android获取名片信息添加到通讯录的实现方法

Publications (1)

Publication Number Publication Date
CN110913060A true CN110913060A (zh) 2020-03-24

Family

ID=69813035

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811079081.3A Pending CN110913060A (zh) 2018-09-17 2018-09-17 一种基于Android获取名片信息添加到通讯录的实现方法

Country Status (1)

Country Link
CN (1) CN110913060A (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103975342A (zh) * 2012-01-12 2014-08-06 柯法克斯公司 用于移动图像捕获和处理的系统和方法
CN105791503A (zh) * 2016-04-28 2016-07-20 乐视控股(北京)有限公司 一种将名片信息存储到通讯录的方法及装置
CN106331308A (zh) * 2015-07-07 2017-01-11 西安中兴新软件有限责任公司 一种联系人信息处理方法及装置
CN106713605A (zh) * 2015-11-18 2017-05-24 青岛海日安电子有限公司 一种基于Android智能名片摄像扫描的信息传送方法
US20170235844A1 (en) * 2016-02-11 2017-08-17 Jack Chmela Device having multiple platforms for facilitating connection to a url

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103975342A (zh) * 2012-01-12 2014-08-06 柯法克斯公司 用于移动图像捕获和处理的系统和方法
CN106331308A (zh) * 2015-07-07 2017-01-11 西安中兴新软件有限责任公司 一种联系人信息处理方法及装置
CN106713605A (zh) * 2015-11-18 2017-05-24 青岛海日安电子有限公司 一种基于Android智能名片摄像扫描的信息传送方法
US20170235844A1 (en) * 2016-02-11 2017-08-17 Jack Chmela Device having multiple platforms for facilitating connection to a url
CN105791503A (zh) * 2016-04-28 2016-07-20 乐视控股(北京)有限公司 一种将名片信息存储到通讯录的方法及装置

Similar Documents

Publication Publication Date Title
US11675985B2 (en) Systems and methods for generating and reading intrinsic matrixed bar codes
CN102722881B (zh) 可操作地处理单色图像数据的方法和系统
JP6595714B2 (ja) 動的な効果を有する2次元コード画像を生成するための方法および装置
CN108399405B (zh) 营业执照识别方法和装置
Fujisawa et al. Information capturing camera and developmental issues
EP2568412A1 (en) Apparatus for recognizing character and barcode simultaneously and method for controlling the same
CN101645081A (zh) 一种通过二维码追溯农产品信息的方法和系统
WO2019161809A1 (zh) 基于4g/5g网络和二维码扫描识别的记录系统及方法
CN1466099A (zh) 正身识别系统及其方法
WO2019072127A1 (zh) 基于二维码扫描识别的执法记录仪及全程音视频记录方法
CN113010703A (zh) 一种信息推荐方法、装置、电子设备和存储介质
WO2019072126A1 (zh) 基于二维码扫描识别的全过程音视频记录系统及使用方法
CN103793676A (zh) 识别二维码与点阵图形构成的防伪标识的方法及装置
CN103632724A (zh) 一种非易失性存储芯片的烧录方法和系统
CN112163443A (zh) 一种扫码方法、扫码装置及移动终端
CN105718980A (zh) 一种生成二维码图片的方法
CN113065374A (zh) 一种二维码识别方法、装置及设备
CN111291846B (zh) 一种二维码生成、解码、识别方法、装置及设备
KR100404306B1 (ko) 코드화된 패턴 및 이의 코드 추출 방법
CN113850253A (zh) 基于深度学习的车牌识别方法及系统、服务器及介质
CN110913060A (zh) 一种基于Android获取名片信息添加到通讯录的实现方法
CN101042726B (zh) 在终端中实现连续识别条码的方法
Jiju et al. OCR text extraction
CN114821623A (zh) 文档处理方法、装置、电子设备及存储介质
KR20210083148A (ko) 영상이미지 인식을 이용한 디지털포렌식 데이터베이스 구축 시스템 및 그 방법

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20200324