Search code examples
androidopencvjavacv

making panorama using android opencv and javacv


I am currently doing my final year project and i am new to android.I want to use image stitching art in my project for making a panorama view of a class room.I have tried lot of tutorials and codes.It seems to be the code with http://www.cs.cornell.edu/courses/cs4670/2010fa/projects/final/results/group_of_acc269_ty244_yc563/cs4670_final.html

is correct.but I have seen lots of errors when I am going to run this code..can anyone please give an idea about this.This is really a help.Thank you..

the codes are which error occur....

import com.opencv.camera.NativePreviewer;

import com.opencv.camera.NativeProcessor;

import com.opencv.camera.NativeProcessor.PoolCallback;

import com.opencv.jni.image_pool;

import com.opencv.opengl.GL2CameraViewer;

import com.theveganrobot.cvcamera.jni.Processor;

import com.theveganrobot.cvcamera.jni.cvcamera;

public class CVCamera extends Activity { -----> in here errors are import com.opencv.camera.NativePreviewer;import com.opencv.opengl.GL2CameraViewer;import com.theveganrobot.cvcamera.jni.Processor;import com.theveganrobot.cvcamera.jni.cvcamera;import com.opencv.jni.opencv;

in NativeProcessor class import com.opencv.jni.opencv; ------> importing this and its functions

public class NativeProcessor {

private class ProcessorThread extends Thread {



    private void process(NPPostObject pobj) throws Exception {




        if (pobj.format == PixelFormat.YCbCr_420_SP) {




            opencv.addYUVtoPool(pool, pobj.buffer, 0, pobj.width, pobj.height, false);





        } else if (pobj.format == PixelFormat.YCbCr_422_SP) {




            opencv.addYUVtoPool(pool, pobj.buffer, 0, pobj.width,pobj.height, true);


        }

in image_pool.java class

package com.opencv.jni;

public class image_pool {



  private long swigCPtr;




  protected boolean swigCMemOwn;




  public image_pool(long cPtr, boolean cMemoryOwn)

{ swigCMemOwn = cMemoryOwn;

        swigCPtr = cPtr;




  }


  public static long getCPtr(image_pool obj) {




        return (obj == null) ? 0 : obj.swigCPtr;



  }

protected void finalize() {

    delete();



  }

  public synchronized void delete() {




    if (swigCPtr != 0) {




      if (swigCMemOwn) {




        swigCMemOwn = false;




        opencvJNI.delete_image_pool(swigCPtr);




      }



      swigCPtr = 0;




    }



  }

  public image_pool() {




    this(opencvJNI.new_image_pool(), true);




  }



  public PtrMat getImage(int i) {





    return new PtrMat(opencvJNI.image_pool_getImage(swigCPtr, this, i), true);



  }

  public void addImage(int i, PtrMat mat) {




    opencvJNI.image_pool_addImage(swigCPtr, this, i, PtrMat.getCPtr(mat), mat);




  }




}

in here importing opencvJNI. functions on image_pool.java class and creating the PtrMat class.I think it seems to be those impordet class are not with the project..I really try to find the codes but they give big errors with them..can you please consider this issue please.


Solution

  • Please follow the tutorials to setup your environment.

    Several things including but not limited to the following should be done before you try to run the downloaded code:

    1) download Opencv4Android

    2) link the Opencv4Android lib into your eclipse project as a "lib" in property page

    3) setup Java NDK environment (downloading, adding into the "environment variable")

    4) javaCV setup and android integration

    Hope that helps.

    P.S. I just finished two of my course designs involving opencv4android