1

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;

}
  • 2
    Where is your file "apple.jpg"? The Android system doesn't know where to look for it. Are you putting this file in your assets directory, or is it somewhere on your SD card, or is it a resource? – Grimmace Jan 10 '12 at 19:45
  • From your question I get the idea that you cannot find your resource, not external libraries? – karla Jan 10 '12 at 19:56

1 Answers1

0

If you're sure you've imported everything you need, then it could be useful, if you clean your eclipse project, and rebuild it again. Other reason might be - that you've forgotten to 'redeploy' your application.

This might be helpful too.

Good luck! Probably you've missed some minor detail - I've been using external jars without any problems in Android projects.

Community
  • 1
  • 1
karla
  • 4,506
  • 5
  • 34
  • 39