1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3<head> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 8.0.0.0 for Windows"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<title>PRCResampleMethod</title> 8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css"> 9</head> 10<body> 11<h1 align="left">PRCResampleMethod <img src="../../image/NTR.gif"align="middle"><img src="../../image/TWL.gif" align="middle"></h1> 12<h2>Definition</h2> 13<dl> 14 <dd><PRE><CODE>#include <nitro/prc.h> 15typedef enum PRCResampleMethod 16{ 17 PRC_RESAMPLE_METHOD_NONE = 0, 18 PRC_RESAMPLE_METHOD_DISTANCE, 19 PRC_RESAMPLE_METHOD_ANGLE, 20 PRC_RESAMPLE_METHOD_RECURSIVE, 21} PRCResampleMethod; 22</CODE></PRE></dd> 23</dl> 24<h2>Elements</h2> 25<table border="1" width="100%"> 26 <tbody> 27 <TR> 28<TD width="13%"><CODE>PRC_RESAMPLE_METHOD_NONE</CODE></TD> 29<TD width="87%">No resampling.</TD> 30 </TR> 31 <TR> 32<TD width="13%"><CODE>PRC_RESAMPLE_METHOD_DISTANCE</CODE></TD> 33<TD width="87%">Use the next point if the city block distance exceeds the threshold.</TD> 34 </TR> 35 <TR> 36<TD width="13%"><CODE>PRC_RESAMPLE_METHOD_ANGLE</CODE></TD> 37<TD width="87%">If the angle differs from the line previously used by at least <CODE>threshold</CODE>, the next point will be used. The angle is in units of 2π/65536 radians.</TD> 38 </TR> 39 <TR> 40<TD width="13%"><CODE>PRC_RESAMPLE_METHOD_RECURSIVE</CODE></TD> 41<TD width="87%">Recursively processes so the points are used that cause all of the points before resampling to be distant from the line segments after resampling by no more than <CODE>threshold</CODE>.</TD> 42 </TR> 43 </tbody> 44</table> 45<H2>Description</H2> 46<P>This enumerated type is contained in the argument <A href="PRCInputPatternParam.html"><CODE>PRCInputPatternParam</CODE></A> in the <A href="PRC_InitInputPattern.html"><CODE>PRC_InitInputPatternEx</CODE></A> function.</P> 47<P>If raw input strokes are used as is, there will be too many points, and an unsteady hand will cause much additional noise. Therefore, a resampling process that keeps only the characteristic points is required. This enumerated type is for specifying the algorithm that is used to resample.</P> 48<dl> 49<dt><CODE>PRC_RESAMPLE_METHOD_NONE</CODE></dt> 50<dd>No resampling will be done. Only consecutive identical coordinate values will be removed. <BR> This is the quickest resampling method. However, because there is no removal of points targeted for resampling, overall processing slows down.</dd> 51<dt><CODE>PRC_RESAMPLE_METHOD_DISTANCE</CODE></dt> 52<dd>First, this method uses the start point of each image. Then, after a total transverse distance exceeds a <CODE>threshold</CODE>, it uses the next point. Additionally, it always uses each final image point. It does not use normal Euclidean distances, but instead uses city block distance (logical sum of the x coordinate difference and the y coordinate difference).<BR>Although processing speed is fast, it tends to not be very good at extracting characteristic points.</dd> 53<dt><CODE>PRC_RESAMPLE_METHOD_ANGLE</CODE></dt> 54<dd>First, this method uses the start point of each image. Then it remembers the drawing direction as the "previous direction." Next, it sequentially traces the line segments in the image. Whenever the angle deviates from the "previous direction" by at least the threshold, it uses that line segment's start point and remembers the direction of that segment as the "previous direction." It then repeats the process. Additionally, it always uses each final image point.<BR>It uses <A href="../../fx/FX_Atan2Idx.html"><CODE>FX_Atan2Idx</CODE></A> to calculate the angle at each input point. Therefore the threshold is expressed using a <CODE>u16</CODE> range for a complete circle (for example, a right angle is 16384). Processing speed is in the mid range.</dd> 55<dt><CODE>PRC_RESAMPLE_METHOD_RECURSIVE</CODE></dt> 56<dd>It first uses the image's start and stop point, as point A and point B respectively. Next, for all of the points between A and B it seeks the distance from the points to the straight line that connects A and B, and obtains as point C the one having the largest distance. If this distance is at least as long as the <CODE>threshold</CODE>, it uses the point. If the distance is less, it discards the point. If point C is used, it then creates two new pairs of A and B points from the A-C pair and the C-B pair. It then recursively repeats the above process.<br>The calculation for the distances between a line segment and a point will be completed in a few integrations. However in a worst case, the distance calculation for each image could be in the order of the square of the number of points that constitute the image, which could become extremely slow. However, normally it will complete in a number that is several times the number of dots that constitute an image. Furthermore, compared to other resampling algorithms there will be fewer dots and better characteristics will be obtained.</dd> 57</dl> 58<P>For details on resampling algorithms, see <CODE>docs/TechnicalNotes/PatternRecognition.pdf</CODE>.</P> 59<h2>See Also</h2> 60<p><A href="PRCInputPatternParam.html"><CODE>PRCInputPatternParam</CODE></A><br> <A href="PRC_InitInputPattern.html"><CODE>PRC_InitInputPattern*</CODE></A><br> <A href="PRC_ResampleStrokes.html"><CODE>PRC_ResampleStrokes*</CODE></A></p> 61<H2>Revision History</H2> 62<P>2005/02/18 Revised file name of reference document.<br /> 2004/06/23 Initial version.</P> 63<hr><p>CONFIDENTIAL</p></body> 64</html> 65