Ask Your Question
0

create a waiting time

asked 2013-01-21 04:27:51 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

this is my bitmap:

protected Bitmap processFrame(VideoCapture capture) { capture.retrieve(mRgba, Highgui.CV_CAP_ANDROID_COLOR_FRAME_RGBA); capture.retrieve(mGray, Highgui.CV_CAP_ANDROID_GREY_FRAME);

        if (mCascade != null) {
            int height = mGray.rows();
            int faceSize = Math.round(height * FdActivity.minFaceSize);
            //int faceSize = 40;
            MatOfRect faces = new MatOfRect();
            mCascade.detectMultiScale(mGray, faces, 1.1, 2, 2 // TODO: objdetect.CV_HAAR_SCALE_IMAGE
                    , new Size(faceSize, faceSize), new Size());




            Rect[] e = faces.toArray();
            for( int i=0; i<e.length;i++){
                     Core.rectangle(mRgba, e[i].tl(), e[i].br(), new Scalar(0, 255, 0, 255),3);

            }
         }// parentesi primo if


        //uscita
        Bitmap bmp = Bitmap.createBitmap(mRgba.cols(), mRgba.rows(), Bitmap.Config.RGB_565/*.ARGB_8888*/);


   try {
            Utils.matToBitmap(mRgba, bmp);
            return bmp;
        } catch(Exception e) {
            Log.e("org.opencv.samples.puzzle15", "Utils.matToBitmap() throws an exception: " + e.getMessage());
            return null;
        }
    }

I want to wait 5 seconds to copy the rectangle e[i] and work with him, how can I do? thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-01-21 07:46:37 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

Under Unix / Linux you could use the sleep command (see man 3 sleep), I'm not sure if that command exists under Windows, too. Alternatively you could actively wait with a while-loop and break if the 5 seconds are done using cv::getTickCount() and cv::getTickFrequency(). Furthermore, I'd point out the answer of http://stackoverflow.com/questions/1974166/what-does-boostthread-sleep-do , where a solution with c++11 is presented.

edit flag offensive delete link more

Comments

thanks, but i'm using java

walter88 gravatar imagewalter88 ( 2013-01-21 07:56:08 -0600 )edit

oh right, I should have noticed that ^^ , than only my second solution with cv::getTickCount() is apropriate for you

Guanta gravatar imageGuanta ( 2013-01-21 07:59:28 -0600 )edit

Question Tools

Stats

Asked: 2013-01-21 04:27:51 -0600

Seen: 1,716 times

Last updated: Jan 21 '13