Ask Your Question

liran's profile - activity

2018-08-10 09:46:46 -0600 received badge  Notable Question (source)
2017-08-22 14:33:06 -0600 received badge  Popular Question (source)
2016-01-22 04:19:18 -0600 received badge  Popular Question (source)
2013-01-17 03:29:10 -0600 received badge  Student (source)
2013-01-10 06:27:35 -0600 received badge  Scholar (source)
2013-01-10 06:27:30 -0600 commented answer Converting YUV to RGBA generates a gray preview

Thanks, it works!

2013-01-10 04:58:19 -0600 received badge  Editor (source)
2013-01-10 04:57:35 -0600 asked a question Converting YUV to RGBA generates a gray preview

Hi,

I am trying to covert YUV to RGBA using openCV, but the preview somehow is gray. here is the relevant code:

if(mYuv != null) mYuv.release();
  mYuv = new Mat(mFrameHeight+mFrameHeight/2, mFrameWidth, CvType.CV_8UC1);
if(Sample2View.mRgba != null) Sample2View.mRgba.release();
  Sample2View.mRgba = new Mat(mFrameHeight, mFrameWidth,CvType.CV_8UC4);
     ....
       while(mThreadRun) {
        synchronized(this) {
            try {
                this.wait();
                mYuv.put(0, 0, mFrame);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
          ...
Imgproc.cvtColor(mYuv,mRgba,Imgproc.COLOR_YUV2RGBA_I420);

what am I doing wrong that makes the preview gray and not colored?

Thanks for the help!

2012-12-19 08:25:03 -0600 asked a question Blink detection

Hi, I'm trying to use blink detection with openCV. I tried using:

  • haarcascade_lefteye_2splits.xml (and haarcascade_righteye_2splits.xml)
  • haarcascade_mcs_lefteye.xml (and haarcascade_mcs_righteye.xml)
  • haarcascade_eye.xml
  • haarcascade_eye_tree_eyeglasses.xml

but all of the above detects opened and closed eyes. any idea or XML files that detects opened OR closed eyes?

Thanks!

2012-12-03 17:13:10 -0600 received badge  Necromancer (source)
2012-12-03 11:14:50 -0600 answered a question how to detect eyes and face

Hi,

I know this thread is old, but I'm stuck with the same problem and haven't found the answer. the code (which runs on openCV) works fine if I use face detection only or eyes detection only, but when I combine both, like in the code attached, the program crashes at run time. I'm not sure how to combine these two cascades. Any help will be appreciated!

here is the code attached:

      try {
        // DO CASCASE SETUP
        InputStream is3 = context.getResources().openRawResource(R.raw.lbpcascade_frontalface);
        File cascadeDir = context.getDir("cascade", Context.MODE_PRIVATE);
        File cascadeFile = new File(cascadeDir, "lbpcascade_frontalface.xml");
        File cascadeFileEye = new File(cascadeDir, "eyes_detect.xml");
        FileOutputStream os = new FileOutputStream(cascadeFile);

        byte[] buffer = new byte[4096];
        int bytesRead;

        while ((bytesRead = is3.read(buffer)) != -1) {
            os.write(buffer, 0, bytesRead);
            }

        is3.close();
        os.close();
        FileOutputStream os1 = new FileOutputStream(cascadeFileEye);

        byte[] bufferEye = new byte[4096];
        int bytesReadEye;

        while ((bytesReadEye = is3.read(bufferEye)) != -1) {
            os1.write(bufferEye, 0, bytesReadEye);
            }

        is3.close();
        os1.close();

        mCascade = new CascadeClassifier(cascadeFile.getAbsolutePath());
        mCascadeEye = new CascadeClassifier(cascadeFileEye.getAbsolutePath());
        if (mCascade.empty()) {
            //Log.e(TAG, "Failed to load cascade classifier");
            mCascade = null;
            }  

        if (mCascadeEye.empty()) {
            //Log.e(TAG, "Failed to load cascade classifier");
            mCascadeEye = null;
            }  

        cascadeFile.delete();
        cascadeDir.delete();

        } 
    catch (IOException e) {
        e.printStackTrace();
        // Log.e(TAG, "Failed to load cascade. Exception thrown: " + e);
        }