Ask Your Question

Amit Dev's profile - activity

2016-04-06 11:58:10 -0600 received badge  Popular Question (source)
2013-06-18 03:09:31 -0600 commented question Iris Detection

I have tried to debug the code but i get stuck at the following piece of code:

if (grayImage1 == null || grayImage1.width() != width/f || grayImage1.height() != height/f) -breakpoint-----grayImage1 = IplImage.create(width/f, height/f, IPL_DEPTH_8U, 1);

if I try to step over it it gives:

public NoClassDefFoundError(String detailMessage) { super(detailMessage); }

and gets stuck in a loop

2013-06-17 09:50:33 -0600 commented question Iris Detection

I have tried a lot. Please someone help

2013-06-17 09:29:18 -0600 received badge  Editor (source)
2013-06-17 02:55:27 -0600 asked a question Iris Detection

Hi, I'am using the following code for Iris Detection. Apparently the code for hough circles thatI picked up from this website http://opencvlover.blogspot.in/2012/07/hough-circle-in-javacv.html for cvsmooth, cvthreshold, cvhoughcircles is not working. The code that I'am using is the following. It doesn't give a compilation error. But it doesn't detect the iris/circle either. Could someone please help me out

package com.googlecode.javacv.eyepreview;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ImageFormat;
import android.graphics.Paint;
import android.hardware.Camera;
import android.hardware.Camera.Size;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.List;
import com.googlecode.javacpp.Loader;
import com.googlecode.javacv.cpp.opencv_core.CvSeq;
import com.googlecode.javacv.cpp.opencv_core.IplImage;
import com.googlecode.javacv.cpp.opencv_objdetect;

import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_imgproc.*;
import static com.googlecode.javacv.cpp.opencv_objdetect.*;
import static com.googlecode.javacv.cpp.opencv_highgui.*;

// ----------------------------------------------------------------------

public class EyePreview extends Activity {
    private FrameLayout layout;
    private EyeView eyeView;
    private Preview mPreview;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

        // Hide the window title.
        requestWindowFeature(Window.FEATURE_NO_TITLE);

        // Create our Preview view and set it as the content of our activity.
        try {
            layout = new FrameLayout(this);
            eyeView = new EyeView(this);
            mPreview = new Preview(this, eyeView);
            layout.addView(mPreview);
            layout.addView(eyeView);
            setContentView(layout);
        } catch (IOException e) {
            e.printStackTrace();
            new AlertDialog.Builder(this).setMessage(e.getMessage()).create().show();
        }
    }
}

// ----------------------------------------------------------------------

class EyeView extends View implements Camera.PreviewCallback {
    public static final int SUBSAMPLING_FACTOR = 4;

    private IplImage grayImage, grayImage1;
    private CvHaarClassifierCascade classifier;
    private CvMemStorage storage, mem;
    private CvSeq eyes;

    public EyeView(EyePreview context) throws IOException {
        super(context);

        // Load the classifier file from Java resources.
        File classifierFile = Loader.extractResource(getClass(),
            "/com/googlecode/javacv/eyepreview/haarcascade_eye.xml",
            context.getCacheDir(), "classifier", ".xml");
        if (classifierFile == null || classifierFile.length() <= 0) {
            throw new IOException("Could not extract the classifier file from Java resource.");
        }

        // Preload the opencv_objdetect module to work around a known bug.
        Loader.load(opencv_objdetect.class);
        classifier = new CvHaarClassifierCascade(cvLoad(classifierFile.getAbsolutePath()));
        classifierFile.delete();
        if (classifier.isNull()) {
            throw new IOException("Could not load the classifier file.");
        }
        storage = CvMemStorage.create();

    }

    public void onPreviewFrame(final byte[] data, final Camera camera) {
        try {
            Camera.Size size = camera.getParameters().getPreviewSize();
            processImage(data, size.width, size.height);
            camera.addCallbackBuffer(data);
        } catch (RuntimeException e) {
            // The camera has probably just been released, ignore.
        }
    }

    protected void processImage(byte[] data, int width, int height) {
        // First, downsample our image and convert it into a grayscale IplImage
        int f = SUBSAMPLING_FACTOR;
       /* if (grayImage == null || grayImage.width() != width/f || grayImage.height() != height/f) {
            grayImage = IplImage.create(width/f, height/f, IPL_DEPTH_8U, 1);
        }
        int imageWidth  = grayImage.width();
        int imageHeight = grayImage.height();
        int dataStride = f*width;
        int imageStride = grayImage.widthStep();
        ByteBuffer imageBuffer ...
(more)