手写识别源码
1. 如何写一个简单的手写识别算法
对于这个问题
我原来看过一个算法,她说觉得gesture recognizer 是比较好的解法。
他也有一个类似的算法,借鉴了原始手写ocr的思路来实现的。
不过ocr问题的重点是怎么选择特征,比如知名的uci 数据集就有以下这些特征量:
1. lettr capital letter (26 values from A to Z) 2. x-box horizontal position of box (integer) 3. y-box vertical position of box (integer) 4. width width of box (integer) 5. high height of box (integer) 6. onpix total # on pixels (integer) 7. x-bar mean x of on pixels in box (integer)
2. 谁有C#手写输入法的源码
什么 具体点啊
3. 谁有手写的ASP源码呀
有,自己开发的,后台功能完全符合目前所有企业级网站需求~,QQ:89190686,来着请注明来由,因为一般情况不加人,谢谢理解~
4. C#winform如何实现手写并且识别
手写识别的算法是可能跟一般人想的不一样,它不是基于图像的OCR技术,是基于笔画顺序的,把你书写的笔画的角度方向等信息生成一组序列,再与数据库中存储的每个字的序列进行比对,大致是这样,如果从头做起,非常的麻烦,切要做大量的实验,微软提供了现成的手写识别开发包,直接调用就好
http://download.csdn.net/detail/coolstar1204/2008061
这是个delphi调用的例子,简单改改就行了,加到C#中应该就是的[DllImport.....]巴拉巴拉的问题,相信这个你会的......亲..加了个油......
5. 请c语言高手写个源代码
呵呵···你想用来坑人还是追学妹····
#include <stdio.h>
int main()
{
char ch;
printf("你是猪嘛? \n");
printf("请输入选项AorBorC \n");
scanf("%c",&ch);
switch(ch - 48)
{
case 0:printf(' B → \n");
case 1:printf(" C → \n");
case 2:printf(" Yes! \n");break;
default : printf("input error!\n");
}
return 0;
}
改了一下选项设置,A :B B:C C: yes!
这样用switch语句可以很好的达到你要的效果,输入A B C都会对应输出,然后指向yes。
希望对你有帮助~
6. android开发中如何实现手写输入的记事本
实现手写功能的主要步骤:
1. 自定义两个View,一个是TouchView,用于在上面画图,另一个是EditText,用于将手写的字显示在其中,并且,要将两个自定义View通过FrameLayout帧式布局重叠在起,以实现全屏手写的功能。
2 在TouchView中实现写字,并截取画布中的字以Bitmap保存。
3. 设置定时器,利用handle更新界面。
下面是实现的细节:
1. 手写的界面设计:
如上图所示,和上节的画板界面一致,底部分选项菜单栏,有5个选项,分别是调整画笔大小,画笔颜色,撤销,恢复,以及清空,对于这些功能,之后几节再实现。
布局文件activity_handwrite.xml
<!--?xml version=1.0 encoding=utf-8?-->
<relativelayout android:background="@android:color/white" android:layout_height="match_parent" android:layout_width="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"><imageview android:layout_above="@+id/paintBottomMenu" android:layout_height="wrap_content" android:layout_width="match_parent" android:src="@drawable/line">
</imageview></relativelayout>
可以看出,里面有两个自定义view,并且通过FrameLayout重叠在一起。
先来看com.example.notes.LineEditText,这个其实和添加记事中的界面一样,就是自定义EditText,并且在字的下面画一条线。
LineEditText.java
public class LineEditText extends EditText {
private Rect mRect;
private Paint mPaint;
public LineEditText(Context context, AttributeSet attrs) {
// TODO Auto-generated constructor stub
super(context,attrs);
mRect = new Rect();
mPaint = new Paint();
mPaint.setColor(Color.GRAY);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//得到EditText的总行数
int lineCount = getLineCount();
Rect r = mRect;
Paint p = mPaint;
//为每一行设置格式
for(int i = 0; i < lineCount;i++){
//取得每一行的基准Y坐标,并将每一行的界限值写到r中
int baseline = getLineBounds(i, r);
//设置每一行的文字带下划线
canvas.drawLine(r.left, baseline+20, r.right, baseline+20, p);
}
}
}
另一个就是com.example.notes.TouchView,实现了绘制,及定时更新界面的功能,具体看代码
TouchView.java
public class TouchView extends View {
private Bitmap mBitmap,myBitmap;
private Canvas mCanvas;
private Path mPath;
private Paint mBitmapPaint;
private Paint mPaint;
private Handler bitmapHandler;
GetCutBitmapLocation getCutBitmapLocation;
private Timer timer;
DisplayMetrics dm;
private int w,h;
public TouchView(Context context) {
super(context);
dm = new DisplayMetrics();
((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm);
w = dm.widthPixels;
h = dm.heightPixels;
initPaint();
}
public TouchView(Context context, AttributeSet attrs) {
super(context,attrs);
dm = new DisplayMetrics();
((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm);
w = dm.widthPixels;
h = dm.heightPixels;
initPaint();
}
//设置handler
public void setHandler(Handler mBitmapHandler){
bitmapHandler = mBitmapHandler;
}
//初始化画笔,画布
private void initPaint(){
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setDither(true);
mPaint.setColor(0xFF00FF00);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeJoin(Paint.Join.ROUND);
mPaint.setStrokeCap(Paint.Cap.ROUND);
mPaint.setStrokeWidth(15);
getCutBitmapLocation = new GetCutBitmapLocation();
//画布大小
mBitmap = Bitmap.createBitmap(w, h,
Bitmap.Config.ARGB_8888);
mCanvas = new Canvas(mBitmap); //所有mCanvas画的东西都被保存在了mBitmap中
mCanvas.drawColor(Color.TRANSPARENT);
mPath = new Path();
mBitmapPaint = new Paint(Paint.DITHER_FLAG);
timer = new Timer(true);
}
/**
* 处理屏幕显示
*/
Handler handler = new Handler(){
public void handleMessage(Message msg) {
switch (msg.what) {
case 1:
myBitmap = getCutBitmap(mBitmap);
Message message = new Message();
message.what=1;
Bundle bundle = new Bundle();;
bundle.putParcelable(bitmap,myBitmap);
message.setData(bundle);
bitmapHandler.sendMessage(message);
RefershBitmap();
break;
}
super.handleMessage(msg);
}
};
/**
* 发送消息给handler更新ACTIVITY
*/
TimerTask task = new TimerTask() {
public void run() {
Message message = new Message();
message.what=1;
Log.i(线程, 来了);
handler.sendMessage(message);
}
};
//切割画布中的字并返回
public Bitmap getCutBitmap(Bitmap mBitmap){
//得到手写字的四周位置,并向外延伸10px
float cutLeft = getCutBitmapLocation.getCutLeft() - 10;
float cutTop = getCutBitmapLocation.getCutTop() - 10;
float cutRight = getCutBitmapLocation.getCutRight() + 10;
float cutBottom = getCutBitmapLocation.getCutBottom() + 10;
cutLeft = (0 > cutLeft ? 0 : cutLeft);
cutTop = (0 > cutTop ? 0 : cutTop);
cutRight = (mBitmap.getWidth() < cutRight ? mBitmap.getWidth() : cutRight);
cutBottom = (mBitmap.getHeight() < cutBottom ? mBitmap.getHeight() : cutBottom);
//取得手写的的高度和宽度
float cutWidth = cutRight - cutLeft;
float cutHeight = cutBottom - cutTop;
Bitmap cutBitmap = Bitmap.createBitmap(mBitmap, (int)cutLeft, (int)cutTop, (int)cutWidth, (int)cutHeight);
if (myBitmap!=null ) {
myBitmap.recycle();
myBitmap= null;
}
return cutBitmap;
}
//刷新画布
private void RefershBitmap(){
initPaint();
invalidate();
if(task != null)
task.cancel();
}
@Override
protected void onDraw(Canvas canvas) {
canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint); //显示旧的画布
canvas.drawPath(mPath, mPaint); //画最后的path
}
private float mX, mY;
private static final float TOUCH_TOLERANCE = 4;
//手按下时
private void touch_start(float x, float y) {
mPath.reset();//清空path
mPath.moveTo(x, y);
mX = x;
mY = y;
if(task != null)
task.cancel();//取消之前的任务
task = new TimerTask() {
@Override
public void run() {
Message message = new Message();
message.what=1;
Log.i(线程, 来了);
handler.sendMessage(message);
}
};
getCutBitmapLocation.setCutLeftAndRight(mX,mY);
}
//手移动时
private void touch_move(float x, float y) {
float dx = Math.abs(x - mX);
float dy = Math.abs(y - mY);
if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) {
mPath.quadTo(mX, mY, x, y);
// mPath.quadTo(mX, mY, (x + mX)/2, (y + mY)/2);//源代码是这样写的,可是我没有弄明白,为什么要这样?
mX = x;
mY = y;
if(task != null)
task.cancel();//取消之前的任务
task = new TimerTask() {
@Override
public void run() {
Message message = new Message();
message.what=1;
Log.i(线程, 来了);
handler.sendMessage(message);
}
};
getCutBitmapLocation.setCutLeftAndRight(mX,mY);
}
}
//手抬起时
private void touch_up() {
//mPath.lineTo(mX, mY);
mCanvas.drawPath(mPath, mPaint);
mPath.reset();
if (timer!=null) {
if (task!=null) {
task.cancel();
task = new TimerTask() {
public void run() {
Message message = new Message();
message.what = 1;
handler.sendMessage(message);
}
};
timer.schele(task, 1000, 1000); //2200秒后发送消息给handler更新Activity
}
}else {
timer = new Timer(true);
timer.schele(task, 1000, 1000); //2200秒后发送消息给handler更新Activity
}
}
//处理界面事件
@Override
public boolean onTouchEvent(MotionEvent event) {
float x = event.getX();
float y = event.getY();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
touch_start(x, y);
invalidate(); //刷新
break;
case MotionEvent.ACTION_MOVE:
touch_move(x, y);
invalidate();
break;
case MotionEvent.ACTION_UP:
touch_up();
invalidate();
break;
}
return true;
}
}
这里面的难点就是利用TimerTask和Handle来更新界面显示,需要在onTouchEvent的三个事件中都要通过handle发送消息来更新显示界面。
接下来就是在activity里通过handle来得到绘制的字,并添加在editText中。
关于配置底部菜单,以及顶部标题栏,这里不再赘述,直接如何将绘制的字得到,并添加在edittext中:
得到绘制字体的Bitmap
//处理界面
Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
Bundle bundle = new Bundle();
bundle = msg.getData();
Bitmap myBitmap = bundle.getParcelable(bitmap);
InsertToEditText(myBitmap);
}
};
其中myBitmap就是取得的手写字,保存在Bitmap中, InsertToEditText(myBitmap);是将该图片添加在edittext中,具体如下:
?
1
private LineEditText et_handwrite;
?
1
et_handwrite = (LineEditText)findViewById(R.id.et_handwrite);
//将手写字插入到EditText中
private void InsertToEditText(Bitmap mBitmap){
int imgWidth = mBitmap.getWidth();
int imgHeight = mBitmap.getHeight();
//缩放比例
float scaleW = (float) (80f/imgWidth);
float scaleH = (float) (100f/imgHeight);
Matrix mx = new Matrix();
//对原图片进行缩放
mx.postScale(scaleW, scaleH);
mBitmap = Bitmap.createBitmap(mBitmap, 0, 0, imgWidth, imgHeight, mx, true);
//将手写的字插入到edittext中
SpannableString ss = new SpannableString(1);
ImageSpan span = new ImageSpan(mBitmap, ImageSpan.ALIGN_BOTTOM);
ss.setSpan(span, 0, 1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
et_handwrite.append(ss);
}
7. 如何判断输入的字符变量为大写字母(手写源代码)
#include<stdio.h>
int main()
{
char ch;
scanf("%c",&ch);
if(ch>='A'&&ch<='Z')//这里可以改为ch>=65&&ch<=90;这两个数就是A,Z对应的ASCII码
printf("该是字符大写字母");
if(ch>='a'&&ch<='z')//这里可以改为ch>=97&&ch<=122;同上;
printf("该字符是小写字母");
return 0;
}
8. 有用VC或C#做的 类似汉王之类 连笔手写识别系统的源代码的么
S&B,都没人理你吧?
几千块都买不着,你还想随便要?
你是我今年见过的最大的白&痴
回楼下的,不是我不文明。
我开始回他说不会有人给,他竟然发消息骂我
我是来教育这个S&B的
你妈&比的,还发消息骂人
我当年怎么没把你射墙上……
我天天上来骂你这个S&B两句,天天更新
瞧你那S&B德行,还想往这行跑。你妈&比的生错地方了吧?
9. 手写源码-实现深拷贝
实现一个深拷贝,包括 Symbol 类型及 Regexp(正则)的拷贝
究极版
10. 人脸比对算法开源代码有吗
开源代码不会给你的,现在最多是像虹软这样打包好SDK了给你用