zones.cc

来自「手写识别是模式识别中研究得一个热点」· CC 代码 · 共 60 行

CC
60
字号
#include "HWRawDataC.hh"#include <assert.h>#include <stdlib.h>#include <fstream.h>int main(int argc, char *argv[]){  if (argc < 2 || argc > 3)    {      cout << "Usage: " << argv[0] << " <Threshold> [<EventBase>]\n";      cout << "Where <Threshold> is the horizontal line over which the stylus must pass\n";      cout << "                  for an event to be recognized, and\n";      cout << "      <EventBase> is the event number for a downward crossing of the\n";      cout << "                  threshold line and <EventBase>+1 is an upward crossing.\n";      cout << "                  The default value for EventBase is 50.\n";      return 1;    }  const long Threshold = atoi(argv[1]);  int EventBase = 6;  if (argc == 3) EventBase = atoi(argv[2]);  long LastY = -1;  long PenUp = 1;  HWHeaderC Header;  cin >> Header;  cout << Header;  while (1)    {      HWRawDataC Rec;      cin >> Rec;      if (!cin) break;      cout << Rec;      if (PenUp) LastY = -1;      if (Rec.Type == PEN_UP) PenUp = 1;      if (Rec.Type == PEN_DOWN) PenUp = 0;      if (Rec.Type != 0) 	continue;            if (LastY != -1 && LastY <= Threshold && Rec.DataPoint.YPos > Threshold) 	{	  Rec.Type = EventBase;	  cout << Rec;	}      else if (LastY != -1 && LastY > Threshold && Rec.DataPoint.YPos <= Threshold) 	{	  Rec.Type = EventBase+1;	  cout << Rec;	}      LastY = Rec.DataPoint.YPos;    }  return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?