Valid XHTML 1.0 Strict

milpix

Technical Specifications - Visual Search Software Development Kit (SDK) Pixee

The SDK provides visual recognition, bar code reading, optical caracter recognition and image classification, to be integrated in a few minutes into a web application, a mobile application such as yours or Pixee mobile app.

Table of contents


1. Introduction

This aim of this document is to define the MilPix / Pixee SDK and the relevent part of the MilPix API and is described using iOS sample code.

2. Insert Data

2.1. ATOM Feed

ATOM is the protocol to add, update and delete data into PIXEE application. For that purpose, send to MILPIX Team your ATOM feed URL and in return you'll be attributed a layer name layer_name.

GET parameters published-min, start-index and max-results, as well as OpenSearch parameters totalResults, startIndex and itemsPerPage, MUST be implemented following GDATA specifications.

Only the ATOM tags <id>, <updated>, <content type=“xhtml“> and <link rel="alternate"> are used by PIXEE.

2.2. XHTML Content

Data for the index

Page title<h1>Required//h1[1]
Page description (summary)<p>Required//p[1]
Page icon<img class=“icon“ src=““ /> or <a class=“icon“ href=““ />JPEG.//img[@class="icon"][1]
Images to recognize<img class=“mx“ src=““ /> or <a class=“mx“ href=““ />JPEG. Best possible quality. Size >= 200x200//img[@class="mx"]
Action (redirection)<a class=“url-redirect“ href=““ />Required action (web and web mobile).//a[@class="redirect"][1]
Category<span class="category">film</span>Tag a category//span[@class="category"]
Language<span class="language">fr</span>Set current page language//span[@class="language"]
Specification version<span class=“version“>1.0<span>Required//span[@class="version"][1]
Places<div class="vcard">//div[@class="vcard"]
Events<div class="vevent">//div[@class="vevent"]

Icon image can be indexed by PIXEE search engine if you write <a class=“icon mx“ href=““ />

Vcard Example

<div class="vcard">
	<span class="fn org">L'Adresse Musée de La Poste</span><br />
	<div class="adr">
		<span class="type">Work :</span><br />
		<div class="street-address">34 boulevard de Vaugirard</div>
		<span class="locality">Paris</span><br />
		<span class="postal-code">75015</span><br />
		<div class="country-name">France</div>
	</div>
	<div class="tel">
		<span class="type">Work :</span><br />
		Téléphone : <div class="value">+33 1 49 54 73 73</div>
	</div>
	<div class="geo">
		Latitude : <div class="latitude">48.8430093</div><br/>
		Longitude : <div class="longitude">48.8430093</div><br/>
	</div>	
	<div class="note">Cela est un exemple</div>	
</div>

Vevent Example

<div class="vevent">
	<h3 class="summary">Madame Grès</h3>
	<span class="category">museum</span><br />
	<div class="location vcard">
		<span class="fn org">L'Adresse Musée de La Poste</span><br />
		<div class="adr">
			<span class="type">Work :</span><br />
			<div class="street-address">34 boulevard de Vaugirard</div>
			<span class="locality">Paris</span><br />
			<span class="postal-code">75015</span><br />
			<div class="country-name">France</div>
		</div>
	</div>
	Début : <abbr class="dtstart" title="2011-03-24 23:55:00"> 2011-03-24 23:55:00</abbr><br />
	Répétition : <abbr class="rrule" title="FREQ=DAILY; \\
	until=20120324T184800Z">2012-03-24 18:48:00</abbr><br />
	Fin : <abbr class="dtend" title="2012-03-24 18:48:00"> 2012-03-24 18:48:00</abbr><br />
</div>

Other Data

Any other tag can be used to send to Milpix other data for web or web mobile rendering, except the following reserved class : status, layer, source.

Advanced Possible Options

Translations<ul class="languages"><li id="urn:uuid:c4517411-1a15-41f1-97d0-b48c8713d865">en</li></ul>Page translation for id matching Atom Id//ul[@class="languages"]
Web-only Redirection<a class=“url-redirect-web“ href=““ />
Mobile-Web-only Redirection<a class=“url-redirect-mobile“ href=““ />
... with phone parameters as GET params (*)<a class=“url-redirect-mobile-with-params“ href=““ />
Default Web rendering (**)<a href=".xsl" alt="xsl" title="web">default<a>
Default Mobile-Web rendering (**)<a href=".xsl" alt="xsl" title="mobile">default<a>
Any other rendering (**)<a href=".xsl" alt="xsl" title="web">test<a>when URL is in ?xsl=test for this example

(*) GET parameters are GPS location (or selected location), (selected) date, UDID, phone and PIXEE version, and selected user language, as follow: location=48.8567,2.35099&address=Paris&date=2010-07-31T12:35Z&udid=00000000-0000-1000-8000-0016CBC97727&pixee=iphone_v3.3&lang=fr

(**) XSL references MUST be local and XSL files sent to Milpix for set-up.

2.3. Delete a page

To delete a page, update the entry with <content> tag empty.

2.4. ATOM Feed example

<?xml version="1.0"?>
<a:feed xmlns:a="http://www.w3.org/2005/Atom" xmlns="http://www.w3.org/1999/xhtml" \\
 xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">
	<a:id>urn:uuid:9d25c239-d94d-aea7-2a56-9e6c1316369b</a:id>
	<a:title>MY ATOM FEED</a:title>
	<a:updated>2011-03-13T22:43:16+01:00</a:updated>
	<a:author>
		<a:name>Milpix</a:name>
		<a:email>info@milpix.com</a:email>
	</a:author>
	<openSearch:totalResults>1</openSearch:totalResults>
	<openSearch:startIndex>0</openSearch:startIndex>
	<openSearch:itemsPerPage>10</openSearch:itemsPerPage>
	<a:entry>
		<a:title>MY ENTRY TITLE</a:title>
		<a:id>urn:uuid:2c35975c-b680-45e0-b3cc-e201fec15dfe</a:id>
		<a:link rel="alternate" href="http://www.pixee.com/product/\\
		2c35975c-b680-45e0-b3cc-e201fec15dfe"/>
		<a:updated>2011-03-13T22:43:16+01:00</a:updated>
		<a:content type="xhtml">
			<span class="version">1.0</span>
			<span class="language">fr</span>
			<h1>BONOBO</h1>
			<p>FULL LIVE BAND</p>
			<img class="mx icon" alt="caption text" \\
			src="http://www.milpix.com/image/18386aa6-64b8-499d-b2f3-f41c96365f5c"/>
			<img class="mx" alt="caption text" \\
			src="http://www.milpix.com/image/d2a7470c-8363-45d1-aab6-71a421b01bb5"/>
			<a class="url-redirect" href="http://www.lemonde.fr">la page résultat</a>
			<span class="category">film</span>
			<span class="category">spectacle</span>
		</a:content>
	</a:entry>
</a:feed>

3. Web integration

Layer Search

URL : http://www.pixee.com/fr/layer_name

Text search :

GET ?q=

Image search :

GET ?uri=, or BINARY POST of the image, or MULTIPART POST with image in fname parameter.

4. iOS integration

4.1. API Constraints

4.1.1. Target Platforms

The API should be able to be included and compilable on iOS 4 (or above).

4.1.2. Frameworks

The API is based on these frameworks which must be included in the project :
  • Foundation
  • UIKit
  • CoreGraphics
  • CoreLocation
  • MapKit
  • QuartzCore
  • SystemConfiguration
  • AVFoundation

4.1.3. Project configuration

To properly use the Pixee SDK, the project must be configured by following these steps :
  • In the Build Settings add the flag -all_load in Other Linker Flags
  • Copy the provided files anywhere in the project, xcode should add the file to the current target and configure the library search path itself. If not, refer to the iOS reference documentation and Xcode help do so.
  • Import MilpixSDK.h either in the project .pch file or in each file calling the SDK classes.
  • Add all the required frameworks in the Link Binaries With Libraries build phase of the project.

4.2. Public API

4.2.1. PXSearchManager

This class handles the search requests. Searches can be initiated with an existing picture or start the camera to capture a new one.
4.2.1.1. sharedSearchManager

Is called to get a unique instance of the search manager.

[PXSearchManager sharedSearchManager];
4.2.1.2. Start picture search from camera

This is done by calling the pxStartPicSearchFromCameraWithFilters method. Filters can be set to choose the language and the layer to search in.

pxStartPicSearchFromCameraWithFilters:(NSDictionary*)filters delegate:(id<PXSearchDelegate>)delegate

Search results are returned as an array through the given delegate. If the camera is not available an alert pop-up is displayed and the gallery is started for the user to choose an existing picture.

Parameters
filters : a dictionary that contain the following search parameters :

  • « layers » : Array of layer names to search in.
  • « language » : language used for the search.

delegate : the PXDelegate used to receive the search results.

NSArray* layers = [NSArray arrayWithObject:@"myLayer"];
NSDictionary* filters = [NSDictionary dictionaryWithObjectsAndKeys:@"fr",@"language",layers,@"layers",nil];
PXSearchManager* searchManager = [PXSearchManager sharedSearchManager];
[searchManager pxStartPicSearchFromCameraWithFilters:filters delegate:self];

Choosing default camera
You can choose the intially used camera (front or rear camera) by changing useFrontalCamera value.

PXSearchManager* searchManager = [PXSearchManager sharedSearchManager];
searchManager.useFrontalCamera = NO;

Choosing default Zoom Level
A float that can be changed with the defaultZoomLevel property of the sharedSearchManager. Its value must be between 1 and 4.

PXSearchManager* searchManager = [PXSearchManager sharedSearchManager];
searchManager.defaultZoomLevel = 2.5;

Choosing default flashMode
A value from PXFlashSelectionModeOFF, PXFlashSelectionModeON or PXFlashSelectionModeAUTO to define the default used flash mode. It can be changed with the defaultFalshMode property of the sharedSearchManager.

PXSearchManager* searchManager = [PXSearchManager sharedSearchManager];
searchManager.defaultFalshMode = PXFlashSelectionModeON;

Choosing Timer Mode
A value from PXTimerViewDurationOFF, PXTimerViewDuration3Sec or PXTimerViewDuration6Sec to define the default used flash mode. It can be changed with the defaultTimerDuration property of the sharedSearchManager.

PXSearchManager* searchManager = [PXSearchManager sharedSearchManager];
searchManager.defaultTimerDuration = PXTimerViewDurationOFF;

Use GPS coordinates with Milpix SDK requests
In order to let the Milpix SDK use your location in image scan request, You should save coordinates as following:
[[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithFormat:@"%.6f",longitude] forKey:@"PXLastStoredLocationLongitude"];
[[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithFormat:@"%.6f",latitude] forKey:@"PXLastStoredLocationLatitude"];
[[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithFormat:@"%.6f",radius] forKey:@"PXLastStoredLocationRadius"];

where latitude, longitude and radius can be abtained from a CLLocation object (here location):
latitude = location.coordinate.latitude;
longitude = location.coordinate.longitude;
radius = location.horizontalAccuracy;

4.2.1.3. Start picture search from existing picture in gallery
This is done by calling the pxStartPicSearchFromGalleryWithFilters method. The usage is the same as the pxStartPicSearchFromCameraWithFilters method.
4.2.1.4. Start picture search from existing image
This is done by calling the pxStartSearchFromImage:withFilters:delegate: method. The usage is the same as the pxStartPicSearchFromCameraWithFilters method.
4.2.2. PXSearchDelegate
This is the protocol to receive events from Milpix search manager.
4.2.2.1. Receive search results

The method pxSearchEndedWithResults is called when a search has completed successfully.

PxSearchEndedWithResults:(NSArray*)results
4.2.2.2. Handle errors

If search fails, the method pxSearchFailed is called.

pxSearchFailed
4.2.2.3. Result format

The structure of the result object is defined by Milpix SA. Be careful to catch the possible absence of some fields depending on the returned object type.

4.2.3. UI Customization

User interface can be customized by calling pxSetTheme:andColor method.

pxSetTheme:(PXTheme)theme andColor:(UIColor*)colorOrNil

Theme can be any of these two values :

  • PXThemeLight : to display black icons on a light toolbar
  • PXThemeDark : to display white buttons on a dark toolbar

The color argument is a ting applied to the toolbar. Be careful to set a color that will display correctly according to the chosen theme.
If no color is provided the toolbar will take a default color depending on the chosen theme.

4.2.4. Texts Customization and Localization

Texts used in the SDK are prepared for localization. You can customize these texts simply with adding these texts in Localizable.strings file. You can see an example in our demo project.

4.3. Download SDK versioning

download sdkDownload SDK versioning

4.4. Download Demo project

download demo projectDownload demo project

5. Thank you !

We hope the SDK will deliver the best for your business and we deeply thank you for your interest in our products. Do not hesitate to contact us via the help button on the right side.

help