WritePadSDK icon indicating copy to clipboard operation
WritePadSDK copied to clipboard

Shape recognition

Open danikula opened this issue 8 years ago • 5 comments

Is it possible to learn SDK to recognize shapes? Circle, Square, Arrow, Line, etc..

danikula avatar Aug 04 '16 14:08 danikula

There is already a basic recognizer of several geometrical shapes in the INK_ API. See Doc.

phatware avatar Sep 09 '16 23:09 phatware

There is another problem i have met during work with a shape recognition. Documentation says: a function SHAPETYPE INK_RecognizeShape(CGStroke *pStroke, int nStrokeCnt, SHAPETYPE inType) analyzes the stroke. If a geometrical shape is recognized, your pStroke will point on a new array of points representing recognized shape. Also function returns a type of shape.

I may say the function returns a correct type of a recognized shape, but, unfortunately, it doesn't change CGStroke data i have passed as parameter.

By the way, it makes sense to say InkWrapper.h has the same function, but the first parameter is CGStroke stroke, not CGStroke *pStroke.

alexeysmirnow avatar Nov 09 '16 10:11 alexeysmirnow

Right, the INK_RecognizeShape will not return the new stroke data only the type if it is recognized shape, if any. Instead of this method, first use INK_EnableShapeRecognition( ... true ) then use INK_AddStroke(...) it will add a new stroke to INK_DATA object or a shape if it is recognized. To disable ink recognition, use INK_EnableShapeRecognition( ... false )

phatware avatar Nov 09 '16 20:11 phatware

Thanks. It really works.

alexeysmirnow avatar Nov 11 '16 08:11 alexeysmirnow

Also, i have noticed a shape recognition doesn't work from background threads (INK_RecognizeShape returns SHAPE_UNKNOWN; INK_AddStroke - false). But from the main thread it properly works. Do I need to make this shape recognition asynchronous at all? Or it doesn't load the main thread too much?

alexeysmirnow avatar Nov 15 '16 09:11 alexeysmirnow