The Catchoom's CraftAR Service for Augmented Reality and Image Recognition is a service that allows you to build a wide range of Image Recognition and Augmented Reality applications and services.
This client library provides access to CraftAR API:
- [CraftAR Management API] (http://craftar.com/documentation/api/management/) allows upload and management of collections of reference images, and associated meta-data such as Augmented Reality experiences and their content. All requests must be authenticated using your Management API key.
gem install craftar
Or if you are using rails
gem 'craftar', require: false
Follow these steps to create a collection with one item and perform an image recognition request against that collection. A collection is a set of items representing entities that you want to recognize. Examples of items are logos, physical objects, or a drawings, among others. You can do it directly from your python interpreter.
Get your management api_key. This is needed to authenticate your requests to the Management API.
require craftar
# use your own api_key!
Craftar.api_key = ENV['craftar_api_key']
name = "My cool colection" # use your own collection name
collection = Craftar::Collection.create(name: name)
name = 'My newly named cool collection'
collection.update(name: name)
collection.destroy
uuid = '' #The uuid of the collection you want to find
Craftar::Collection.find(uuid)
Craftar::Collection.list
Craftar::Collection.list name: 'name', limit: 10
Craftar::Collection.list name__contains: 'nam', offset: 10, limit: 20
name = 'test' # use your own item name
custom = { key1: value1, key2: value2}.to_json #custom parameter must be a string
item = Craftar::Item.create(collection: collection.resorce_uri, name: name, trackable: false, custom: custom)
item.update(trackable: true)
Possible parameters: name, collection, url, content, custom, trackable, tags
item.destroy
uuid = '8a95c8ab98e9c464' #The uuid of the item you want to find
Craftar::Item.find(uuid)
Craftar::Item.list
Craftar::Item.list name: 'name', limit: 10
Craftar::Item.list name_contains: 'nam', offset: 10, limit: 20
You can also filter by
- collection__uuid
- collection__name
- collection__name__contains
file = 'http://blabla/image.jpg'
image = Craftar::Image.create(item: item.resorce_uri, file: file)
Possible parameters: name, collection, url, content, custom, trackable
image.destroy
uuid = '8a95c8ab98e9c464' #The uuid of the image you want to find
Craftar::Image.find(uuid)
You will receive uuid, item, file, resource_uri, name, status, thumb_120, thumb_60, tracking_data_status
Craftar::Image.list
Craftar::Image.list name: 'name', limit: 10
Craftar::Image.list name_contains: 'nam', offset: 10, limit: 20
You can also filter by
- item__uuid: filter by item UUID.
- item__name: filter by item by this exact match.
- item__name__contains: filter by item by case-sensitive containment.
- item__collection__uuid: filter by item’s collection UUID.
- item__collection__name: filter by item’s collection name, using this exact match.
- item__collection__name__contains: filter by item’s collection name, using case-sensitive containment.
- status: filter by image status (ER or OK).
token = Craftar::Token.create(collection: collection.collection_uri, tags: [tag_uri])
token = Craftar::Token.find(token)
token.update(tags: [tag_uri])
token.destroy
Craftar::Token.list
Craftar::Token.list offset: 10, limit: 20
You can also filter by:
- collection__uuid: filter by collection UUID.
- collection__name: filter by collection name, using this exact match.
- collection__name__contains: filter by collection name, using case-sensitive containment.
file = 'http://test/test.jpg' # use your own media url
media = Craftar::Media.create(name: name, file: file)
uuid = '8a95c8ab98e9c464' #The uuid of the media you want to find
Craftar::Media.find(uuid)
Craftar::Media.list
Craftar::Media.list name: 'name', limit: 10
Craftar::Media.list name_contains: 'nam', offset: 10, limit: 20
You can also filter by
- mimetype
- mimetype__contains
media = Craftar::App.create(name: name, collection: collection.resource_uri)
uuid = '8a95c8ab98e9c464' #The uuid of the app you want to find
Craftar::App.find(uuid)
Craftar::App.list
Craftar::App.list name: 'name', limit: 10
Craftar::App.list name_contains: 'nam', offset: 10, limit: 20
uuid = '8a95c8ab98e9c464' #The uuid of the version you want to find
Craftar::SdkVersion.find(uuid)
Craftar::SdkVersion.list
Craftar::SdkVersion.list, offset: 10, limit: 20
collection_bundle = Craftar::CollectionBundle.create(collection: collection.resource_uri, app: app.resource_uri, version: version.resource_uri)
collection_bundle.destroy
uuid = '8a95c8ab98e9c464' #The uuid of the collection bundle you want to find
Craftar::Item.find(uuid)
Craftar::CollectionBundle.list
Craftar::CollectionBundle.list, offset: 10, limit: 20
name = 'my_tag' # your tag name
tag = Craftar::Tag.create(collection: collection.resorce_uri, name: name)
tag.update(name: 'my_new_tag')
Possible parameters: name, collection
tag.destroy
uuid = '8a95c8ab98e9c464' #The uuid of the tag you want to find
Craftar::Tag.find(uuid)
Craftar::Tag.list
Craftar::Tag.list name: 'name', limit: 10
Craftar::Tag.list name_contains: 'nam', offset: 10, limit: 20
Please, if you use it, report back any bugs/problems.
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Don't forget to test your feature
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request