0

I'd like to generate and draw some bezier paths based on an image in my app. The image will be really simple (black lines on a white background) such as the following:

http://i47.tinypic.com/otj2p2.jpg

Is there a method to process the image and create a bezier path based on the black lines? I'm completely lost here.

If you're wondering the reason for needing the image to be a bezier path, I'm going to be comparing the generated bezier path with another bezier path that the user draws (basically a picture-password that the user will have to draw).

If there's a better way to accomplish comparing an image to a bezier path, I'm all ears. Or, if bezier paths aren't the way to go, then let me know. Thanks!

Dave DeLong
  • 242,470
  • 58
  • 448
  • 498
Brian
  • 77
  • 1
  • 4

2 Answers2

0

Why not do it the other way around?

  • let the user draw the path
  • create an image from the drawn path using core graphics
  • compare both images with a framework like opencv
polyclick
  • 2,704
  • 4
  • 32
  • 58
  • Oh ok that sounds good. I have no clue how to make an image from a path or compare the images with opencv. Any suggestions for where to start? – Brian Aug 05 '12 at 23:48
  • Did some digging and found this for making an image from a view: http://stackoverflow.com/questions/746421/iphone-saving-current-view-as-image. How to I compare two images with opencv? – Brian Aug 06 '12 at 00:05
  • Honestly, I didn't compare images yet with OpenCV. I suggest you make a new SO question to get some good answers. There are several ways to compare images and there definatly is a difference between comparing two images then comparing one image against a database of multiple images. Maybe this can get you started: http://stackoverflow.com/a/7054711/341358 ? – polyclick Aug 06 '12 at 09:14
-3

You cannot do this with bezier lines. Those are curves, while what you want is lines. If you wanted to solve for control points though the solutions for this inverse problem are infinite therfore you must set the number of control point that the bezier curve has.

msmechanized
  • 436
  • 4
  • 19
  • Well i was speaking from a mathematical point of view. The method you are refering to, propably falls back to straight lines. BTW i am not an ios developer, so please undo my rep. – msmechanized Aug 05 '12 at 23:43