Motionscan is a RubyMotion wrapper for the image recognition Moodstocks SDK :
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Code Climate


Motionscan is a RubyMotion wrapper for the Moodstocks SDK. Moodstocks provide an incredibly fast and easy tool to add image recognition to your app.

Watch the video to see what you will be able to build in few minutes :


  • Create an account on
  • Use Moodstocks image uploader to add images to your account
  • Complete your application Rakefile with RakefileExample (most notably pod and credentials)
  • Look at /app to use it in your application
  • add "motionscan" in your Gemfile or install : gem install motionscan
  • add require 'motionscan' in your Rakefile before Motion::Project::App.setup...

If you want build this application you need to upload images with json attached to images, for example :

Look the standalone demo app for more informations :



Moodstocks is fast because the image processor is fast but also because it allows you to cache image signature, the Sync class allows you to decide when and how you want to sync the device cache.


sync = Motionscan::Sync.init

-startWithStatus(syncStarted, success:syncCompleted, error:syncFailed, progress:syncProgressed)

  lambda {
    # sync started
  success:lambda {|result|
    # sync finished
    # Motionscan::Result instance
  error:lambda {|error|
    # an error occured while syncing
    # NSError
  progress:lambda {|progress, total|
    # progress : current number of cached items
    # total : number of items to cache



scanner = Motionscan::Scanner.initWithFrame([[0,0],[320,200]])


scanner.frame = [[0,0],[320,200]]



-startWithStatus(scanStarted, success:scanCompleted, error:scanError, notFound:scanNotFound)

  lambda {
  	# scan started
    # will fire once at the beginning
    # from this point everything captured 
    # by the video will be scanned
  success:lambda {|result|
  	# scan found and image in the cache
    # Motionscan::Result instance
  error:lambda {|error|
  	# scan error
    # NSError 
  notFound:lambda {
  	# scan didn't find the image in the cache
    # you shouldn't do anything expensive here
    # as it will fire very frequently


If you wish to pause the scanner, and prevent current result to change you can use this method. Use scanner.resume to resume scanning process.



Call this method to terminate the scanner, usually in viewWillDisappear(animated). /!\ You have to call it at some point or pushing a new UIViewController and going back to this one, will crash the app.




-searchWithStatus(searchStarted, success:searchCompleted, error:searchError, notFound:searchNotFound)

If an image is not in the cache, you can trigger an API call to search it on your account.

  lambda {
  	#search in remote started
  success:lambda {|result|
  	#search found and image in remote
  error:lambda {|error|
  	#search error
  notFound:lambda {
  	#search didn't find the image in remote


Result is a simple wrapper arround MSResult, every methods that should return a result will give an instance of Motionscan::Result.


Returns the imageId of the scanned image.



Returns the string or the hash (json is converted to a hash) saved with the image. For example if the following json is attached to your image :

{"type":"businessCat", "name":"Carl"}

You will get the following ruby hash :
# {type:"businessCat", name:"Carl"}