I want to implement an application that uses image recognition system IQEngines. I'm using eclipse for that. I'm trying test codes IQEngines provide but the result I'm getting is that "File apple.jpg does't exist"
I'm not sure where the problem lies. It seems like I imported all relevant jar files so the code should work. In eclipse I changed Main method into onCreate so that the activity can run Does anyone have a clue?? Has anyone ever used IQEngines?
There's javaiqe.java that javaiqe_test.java is using but it's very long so I don't want to attach
package com.Camera;
import java.io.File;
import java.util.ArrayList;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import com.iqengines.javaiqe.javaiqe;
import com.iqengines.javaiqe.javaiqe.IQEQuery;
/**
* IQEngines Java API
*
* test file
*
* @author
*/
public class javaiqe_test extends Activity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView tv = (TextView) findViewById(R.id.resultImg);
final String KEY = "64bc6a7fd77643899d3af8b305924165";
final String SECRET = "c27e162ea7c24c619f850014124598";
/*
* An API object is initialized using the API key and secret
*/
iqe = new javaiqe(KEY, SECRET);
uploadObject();
/*
* You can quickly query an image and retrieve results by doing:
*/
File test_file = new File("apple.jpg");
// Query
IQEQuery query = iqe.query(test_file);
System.out.println("query.result : " + query.getResult());
System.out.println("query.qid : " + query.getQID());
tv.setText(query.getResult());
// Update
/* String update = iqe.update();
System.out.println("Update : " + update);*/
// Result
String result = iqe.result(query.getQID(), true);
System.out.println("Result : " + result);
// Upload
//uploadObject();
}
/**
* Sample code for uploading an object
*/
public static void uploadObject() {
// Your object images
ArrayList<File> images = new ArrayList();
images.add(new File("res/drawable/apple.jpg"));
// Object infos
String name = "Computational Geometry, Algorithms and Applications, Third Edition";
// Optional infos
String custom_id = "book0001";
String meta = "{\n\"isbn\": \"9783540779735\"\n}";
boolean json = false;
String collection = "books";
// Upload
//System.out.println("Upload : " + iqe.upload(images, name, custom_id, meta, json, collection));
System.out.println("Upload : " + iqe.upload(images, name));
}
private static javaiqe iqe = null;
}