On Dec 30, 5:09 am, Daniel Drozdzewski <daniel.drozdzew...@gmail.com>
wrote:
> > On Dec 29, 1:18 am, Paul <pmmen...@gmail.com> wrote:
> >> Hi all.  I am writing an app that will convert touchscreen user inputs
> >> (such as the user 'handwriting' on the screen) into vectors that can
> >> then be saved and recalled later.  I need to get the vectors into a
> >> format I can store locally, either as a file or in an SQLite
> >> database.  Just wondering if anyone had any pointers as to how to get
> >> started...  my initial thought was to listen for MotionEvents and when
> >> an ACTION_DOWN is detected, record the coordinates and use this as the
> >> vector's start point, and then record intermediate coordinates as the
> >> ACTION_MOVE is triggered (used to help define the shape of this Path
> >> they are creating), ending the stroke vector on ACTION_UP... but this
> >> results in many many intermediate points per vector (30 or 40) and
> >> with several hundred vectors (a full page of handwritten text on a
> >> tablet for example) this solution gets quickly out of hand as each
> >> page will potentially require tens of thousands of points...
>
> >> Any suggestions on a better way to represent and store user-inputed
> >> vectors/paths?  Or maybe another approach completely?
>
> >> Thanks for any help!
>
> >> Paul
>
> Paul,
>
> You could blindingly start filtering any intermediate vectors, but you
> would miss some important points, where the writing drastically
> changes its direction.
> As you see, the problem you have is detecting where the continuous
> line changes its direction by much and intermediate points could be
> filtered.
>
> You would need calculating the angles between adjacent vectors and
> when the angle gets bigger than some threshold value, the point
> between said vectors becomes very important.
>
> Hope this helps you somehow.
>
> --
> Daniel Drozdzewski

I was thinking about this issue too... how do I recognize when a path
backs onto itself, makes sharp turns, etc as is normal in
handwriting?  As I mentioned in another reply, I have looked at the
SVG Path standard:

http://www.w3schools.com/svg/svg_path.asp

Looks like a possibility in terms of efficiently storing the shape of
the stroke, but to use it I need to somehow take a set of coordinate
points that Android spits out from MotionEvent and 'recognize' when it
is a curve, arc, etc...  maybe I extend my StrokeGestureDetector I
mentioned to handle the heavy lifting of this recognitions, so that it
simply reports back when the stroke is curved, etc?  The issue remains
how I determine when a set of x,y coords forms a curve, a sharp curve
(such as when printing an M for example), etc.  Off the top of my
head, maybe in my gesture detector, when in a stroke, store the last 3
MotionEvent points, generate a 'line' from point 1 to 2, and point 2
to 3 and determine the angle at this vertex to help recognize
direction changes?  Again, the HOW is where I am stuck at this
point...  once I have the points described, recreating looks straight-
forward simple using the built-in Path class.

Any ideas on how to programatically test for the direction changes,
curves, etc?

Paul

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to