background image
C H A P T E R 1 0
Recognition: Advanced Topics
Using Advanced Topics in Recognition
10-15
If you provide a grid in which the user is to write characters or words, you need to
use an
rcGridInfo
frame to define the grid to the text recognizer. For example,
the
protoCharEdit
system prototype uses an
rcGridInfo
frame internally to
define the input areas (cells) in the comb view it provides.
The recognizer uses the information in an
rcGridInfo
frame to make character-
segmentation decisions. You can use the
rcGridInfo
frame in conjunction with
an
rcBaseInfo
frame to provide more accurate recognition within boxes in a
single view. Recognition in the most recently used grid box begins as soon as the
user writes in a new box in the grid.
The NewtonScript code used to create the grid shown in Figure 10-4 looks like the
following example.
rcGridInfo := {
boxLeft: 100,// x coordinate of left of top-left box
boxRight:145,// x coordinate of right of top-left box
xSpace:55,// x distance from boxLeft to boxLeft
boxTop: 50,// y coordinate of top of top-left box
boxBottom:95,// y coordinate of bottom of top-left box
ySpace:55// y distance from boxTop to boxTop
};
To obtain the best performance and to conserve available memory, create your
rcGridInfo
frame by cloning the frame provided by the
ROM_canonicalCharGrid
constant. Store your frame in a slot named
rcGridInfo
in your view's
recConfig
frame.
For a detailed description of the
rcGridInfo
frame, see "Data Structures Used in
recConfig Frames" (page 8-24) in Newton Programmer's Reference
Creating Single-Letter Input Views
10
The following code fragment creates a single-letter input view's
recConfig
frame. This frame, which includes
rcBaseInfo
and
rcGridInfo
frames, is
based on the
ROM_rcSingleCharacterConfig
frame supplied by the system.
// specify box (or horizontal array of boxes)
// into which character(s) are written.
myView := {
recConfig: ROM_rcsinglecharacterconfig,
...}
// height of a lowercase letter
constant kSmallHeight := 11;
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна