手写识别开发包:Zinnia

jopen 12年前

Zinnia 是一个简单、可定制和可移植的手写识别系统,基于 Support Vector Machines (SVM) 算法。SVM算法简介

实例代码:

#include <stdio.h>  #include "zinnia.h"    int main(int argc, char **argv) {    size_t i;    zinnia_recognizer_t *recognizer;    zinnia_character_t *character;    zinnia_result_t *result;      recognizer = zinnia_recognizer_new();      if (!zinnia_recognizer_open(recognizer, "/usr/local/lib/zinnia/model/tomoe/handwriting-ja.model")) {      fprintf(stderr, "ERROR: %s\n", zinnia_recognizer_strerror(recognizer));      return -1;    }      zinnia_character_t  *character  = zinnia_character_new();    zinnia_character_clear(character);    zinnia_character_set_width(character, 300);    zinnia_character_set_height(character, 300);    zinnia_character_add(character, 0, 51, 29);    zinnia_character_add(character, 0, 117, 41);    zinnia_character_add(character, 1, 99, 65);    zinnia_character_add(character, 1, 219, 77);    zinnia_character_add(character, 2, 27, 131);    zinnia_character_add(character, 2, 261, 131);    zinnia_character_add(character, 3, 129, 17);    zinnia_character_add(character, 3, 57, 203);    zinnia_character_add(character, 4, 111, 71);    zinnia_character_add(character, 4, 219, 173);    zinnia_character_add(character, 5, 81, 161);    zinnia_character_add(character, 5, 93, 281);    zinnia_character_add(character, 6, 99, 167);    zinnia_character_add(character, 6, 207, 167);    zinnia_character_add(character, 6, 189, 245);    zinnia_character_add(character, 7, 99, 227);    zinnia_character_add(character, 7, 189, 227);    zinnia_character_add(character, 8, 111, 257);    zinnia_character_add(character, 8, 189, 245);      result = zinnia_recognizer_classify(recognizer, character, 10);    if (result == NULL) {      fprintf(stderr, "%s\n", zinnia_recognizer_strerror(recognizer));      return -1;    }        for (i = 0; i < zinnia_result_size(result); ++i) {      fprintf(stdout, "%s\t%f\n",              zinnia_result_value(result, i),              zinnia_result_score(result, i));    }      zinnia_result_destroy(result);    zinnia_character_destroy(character);    zinnia_recognizer_destroy(recognizer);      return 0;  }

项目主页:http://www.open-open.com/lib/view/home/1360139482080