Ask Your Question

pocahentez's profile - activity

2020-10-05 07:09:55 -0500 received badge  Popular Question (source)
2017-06-14 04:01:37 -0500 received badge  Popular Question (source)
2016-04-18 14:21:28 -0500 received badge  Popular Question (source)
2015-07-04 16:43:12 -0500 received badge  Famous Question (source)
2014-08-04 19:35:40 -0500 received badge  Notable Question (source)
2014-03-06 23:34:02 -0500 received badge  Popular Question (source)
2013-05-12 10:02:32 -0500 asked a question extruct 3D points

Hi Is there any function in opencv API to get the 3D coordonate of the 3D model to use it in the solvePNP function? How can i get the 3d coordonate then?

2013-05-07 07:16:29 -0500 commented question skin detection

I want to delete the question but i can't ,so that i tried to delete the code unfortunately it works.I'm sorry i couldn't return it. The delete button doesn't work! any idea how can I delete it?

2013-04-18 03:48:03 -0500 commented answer skin detection

i'm sorry i forget it thank you

2013-04-18 02:57:14 -0500 answered a question skin detection

Hi, this is the code of skin detection, my problem is that i always get the size of contours=0.

   boolean first_frame;
   Rect windows;
        /*we use the first_frame variable to flag the first frame and the subsequent frames. 
        On the first frame, we detect faces using the built-in cascade classifier. 
       On the next frames, we use skin detection to detect faces.*/
 void detectionface(Mat frame,CascadeClassifier cascade,MatOfRect faces)

 Log.i("skindetection","enter detection function");

   if (cascade.empty())
       Log.i("cascade", "null");

first_frame= true;


    if (frame.empty())
        Log.i("skindetection","frame is empty");

    if (first_frame )
    { // we convert the frame to grayscale, increase the image contrast, and perform object detection.
                       Imgproc.equalizeHist(frame, frame);
           Log.i("skindetection","enter equalizeHist");

           if (frame.empty())
              Log.i("skindetection", "frame empty");

               cascade.detectMultiScale(frame, faces, 1.1, 2, 2, // TODO: objdetect.CV_HAAR_SCALE_IMAGE
                   new Size(50, 50), new Size());

           if (faces.empty())
               Log.i("skindetection","faces empty");
           Rect[] facesArray=faces.toArray();
           Log.i("skindetection","la taille est"+facesArray.length);
           for (int i = 0; i < facesArray.length; i++)


               //Set a search window windows for each detected face.
                 Point pt=new Point(facesArray[i].tl().x + facesArray[i].width/2, facesArray[i].tl().y + facesArray[i].height/2);
                 Log.i("skindetection","point ok");
                 Rect win=new Rect();
                 win.width  = 120;
                 win.height = 120;
                 win.x      = (int) (pt.x - win.width/2);
                 win.y      = (int) (pt.y - win.height/2);
                 Log.i("skindetection","rect ok");
            Log.i("skindetection","end loop");
           Log.i("skindetection","first done");
        first_frame = false;

      //Given the search windows in windows, loop  to get a search window and detect the skin.

        for (int i = 0; i < 1; i++)
                Rect win = windows;
                //we have to crop to make sure the window is inside the image. We then use the window to set the region of interest (ROI).
                win.x      = Math.max(win.x, 0);
                win.y        = Math.max(win.y, 0);

               win.width  = Math.min(win.width, frame.cols() - win.x);//frame
               win.height = Math.min(win.height, frame.rows() - win.y);
               Imgproc.cvtColor(frame, frame, Imgproc.COLOR_GRAY2BGR);

                Mat subimg = new Mat(frame, win);

                Log.i("skindetection","subimag created");
                //Convert the subimg to the HSV colorspace and threshold the image for pixels with skin tone.
                Mat hsv=new Mat();
                Imgproc.cvtColor(subimg, hsv, Imgproc.COLOR_BGR2HSV);
                /* The bw image now contains some contours with the largest contour being the face.
                We call detectLargestBlob() function to select the largest contour. 
                The function will return a Rect and we use it to update the face position.*/
                Mat bw=new Mat();

                Core.inRange(hsv, new Scalar(0,51,89), new Scalar(17,140,255), bw);
                facesArray[i] = detectLargestBlob(bw);
                //Adjust the position of the search window to make it "follow" the detected face:
                facesArray[i].x += win.x;
                Log.i("skindetection","after detect blob");
                facesArray[i].y += win.y;



* Detect the largest blob in a binary image
 Rect detectLargestBlob(Mat bw)
 if (bw.empty())
     Log.i("skindetection","bw empty");

   Log.i("skindetection","enter function");
   List ...
2013-04-16 07:49:52 -0500 commented answer skin detection

As i'm a new user i must wait 2 days before answering my own i'll post it tomorrow.thanks Steven

2013-04-16 03:18:50 -0500 commented answer skin detection

Thank you Steven ,i changed it as you have mentioned it but i still have the same problem, can i put all the skin detection code here? or it's not allowed? i don't know if it will be rude ? please i need help really .and thank you again

2013-04-15 16:21:35 -0500 commented answer skin detection

actually i combine skin detection and the viola & jones algorithm. and i'm not asking about the best algorithm to detect face.and my question is clear :get contours size=0 after the findcontours function so if you haven't understand any questions please don't answer it . and thank you for the effort you had made.

2013-04-15 08:44:52 -0500 asked a question skin detection

Hi I am trying to do skin detection to detect face regions. I have done the following but I always get contours size = 0. I can't figure out the problem.

Please guide me to a solution.

2013-04-15 08:43:18 -0500 asked a question skin detection_find contour

hi i'm trying to do skin detection to detect face.i have done

 List<MatOfPoint> contours=new ArrayList<MatOfPoint>();
Mat  hierarchy = new Mat(new Size(250, 250), CvType.CV_8UC1, new Scalar(0));
Imgproc.findContours(bw.clone(), contours, hierarchy, Imgproc.RETR_EXTERNAL,Imgproc.CHAIN_APPROX_NONE);
Log.i("skindetection","findcontours1 function");
if (contours.size()==0)
{ Log.i("skindetection"," size contour =0");
    return (new Rect(0, 0, bw.cols(), bw.rows()));

But i always get contours size=0. i can't figure out the problem.please guide me.

2013-04-14 01:56:22 -0500 asked a question Core max function

hi, what is the equivalent of this function in opencv wrapper java:

  Rect win;
 win.x = std::max(win.x, 0);

thank you.

2013-04-09 11:49:07 -0500 asked a question How to calibrate the camera of my mobile device?


is there a function to do calibration of the camera of my mobile device?

My idea is to calibrate the head on an oval so that the application has the necessary co├Ârdinate to place a 3D object on top of it.

Thank you in advance.

2013-04-04 08:57:38 -0500 asked a question opencv face detection

hi I want to convert the detected face rectangle (the original face detection sample)into a 3D coordinates . I have the intrinsic parameters of my camera, how can I determine the depth Z? using the projection equation? how can i get the face depth ?

x = fx X / Z + u

y = fy Y / Z + v

I understand that fx fy and u v are intrinsic parameters, x y are given by the detected face rectangle.what does the X,Y represents?

2013-04-04 05:11:54 -0500 commented question How to replace a certain ROI with another image?

you can be inspired from this project :
this project allows to detect the eyes and insert images of fire there. it's not a java code.

2013-04-04 04:35:03 -0500 commented question How to replace a certain ROI with another image?

do you want to superimpose an image over the face?

2013-04-03 08:13:48 -0500 commented answer face detection sample

actually i'm using vuforia sdk and i want to change the tracking part of the vuforia sdk by using the opencv. i have a calibrated vuforia camera. i don't know how can i use the detected face?

2013-04-03 06:20:34 -0500 asked a question face detection sample

hi,i have a few question concerning the face detection sample.What does the face detection provides ? does it provide a pose with respect to the camera ? a 3D point in the camera reference frame ? (and if yes, how are the camera axis defined ?)

2013-04-02 11:32:43 -0500 asked a question point coordinate

hi, i have the facedetection sample where i have Rect[] facesArray = faces.toArray(); i wanna know if these two points: facesArray[i].tl() and facesArray[i].br() are calculated from the camera pose? if they aren't ,how they are calculated then?

2013-04-02 09:27:34 -0500 asked a question 3D point in the camera reference frame

HI, i have made the face detection using the cascade classifier,the detection returned a MatOfRect from which i have extracted two points, now i wanna know how can i get the 3D point in the camera reference frame from the points i have extracted from the detected region of face.

2013-03-26 03:09:55 -0500 commented answer problem in cvtColor function

thank you it is clear now.

2013-03-25 05:53:03 -0500 commented question problem in cvtColor function

also what does this: Imgproc.cvtColor(mRgba, mGray, Imgproc.COLOR_BGRA2GRAY); in t he face detection sample?does it mean that we convert mrgba matrix into 1 chanel and stored in mgray matrix?

2013-03-25 05:35:07 -0500 asked a question problem in cvtColor function

Hi,I have a native methode which play frame so i retreive the pixels of the image into a byte [] buffer and call a java methode to proceed the processing :

 public void processCameraImage(byte[] buffer, int width, int height)  {
    System.out.println("setRGB565CameraImage....intent received..."); 
    Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565);
    Mat inputFrame= new Mat();
    inputFrame.put(0, 0, buffer);
    {      /* Grayscale */  Log.i("grayscale", "grayscale"); 
   Imgproc.cvtColor(inputFrame, mGray, Imgproc.COLOR_GRAY2BGR565); // i have a problem here//
    else if (inputFrame.channels()==4)
    {      /* ARGB or RGBA image */      Log.i("ARGB or RGBA", "ARGB or RGBA");                               }
    {      /* RGB, BGR, HSV, or any other 3-channel representation */Log.i("RGB, BGR, HSV", "RGB, BGR, HSV");   }

i have this in logcat:

03-24 11:23:45.322: I/System.out(9915): setRGB565CameraImage....intent received...
03-24 11:23:45.362: D/dalvikvm(9915): GC_CONCURRENT freed <1K, 22% free 8108K/10311K, paused 1ms+3ms   
03-24 11:23:45.372: I/grayscale(9915): grayscale    
03-24 11:23:45.372: W/dalvikvm(9915): JNI WARNING: JNI method called with exception pending

03-24 11:23:45.372: W/dalvikvm(9915):  in Lcom/qualcomm/ar/pl/CameraPreview;.newFrameAvailable:       (IIII[B)V (CallIntMethodV)
03-24 11:23:45.372: W/dalvikvm(9915): Pending exception is:
03-24 11:23:45.372: I/dalvikvm(9915): java.lang.NullPointerException:
03-24 11:23:45.372: I/dalvikvm(9915):   at   org.opencv.imgproc.Imgproc.cvtColor(
03-24 11:23:45.372: I/dalvikvm(9915): at   com.qualcomm.QCARSamples.ImageTargets.ImageTargets.processCameraImage(
03-24 11:23:45.372: I/dalvikvm(9915): at Method)

Please i need help as soon as possible i'm stucked here.

2013-03-24 05:24:04 -0500 asked a question release mat

Hi,how can i release a mat with native code?

2013-03-24 03:09:16 -0500 asked a question change the camera access

Hi, how can i change the camera access ?i don't want to use CvCameraView :i meant that i have an application which display the video and i want to use face detection sample with it.

2013-03-23 11:55:03 -0500 asked a question make Mat from buffer byte


I have a Byte buffer and i want to make a Mat.How can i achieve it using a java code?Should i make a bitmap with the byte buffer first then transform it to Mat?

2013-03-23 03:45:51 -0500 received badge  Scholar (source)
2013-03-23 01:58:17 -0500 asked a question native opencv for android project

I tried to integrate opencv library in my android project so i followed this link:

but now i still have these errors:

jni/DetectionBasedTracker.cpp:5:23: error: opencv/cv.h: No such file or directory jni/DetectionBasedTracker.cpp:6:28: error: opencv/highgui.h: No such file or directory

should i change the

2013-03-23 01:55:19 -0500 received badge  Critic (source)
2013-03-22 12:03:58 -0500 answered a question integrate opencv

is there any tutorial of how to change file to integrate opencv?

2013-03-19 03:39:49 -0500 commented answer integrate opencv

thx but i'm using eclipse (to make apps under the android platform) not visual studio.I don't think that they have the same issue isn't?