Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Count drops of blood

Hi, I need to develop a java program openCV to run on Android. The program will capture an image of a skin and make the score drops of blood that is enclosed within a square of 2.5 cm. I'm currently using the blob detection, but the program is not functioning well. Still unable to delineate the count within the area of 2.5 cm. I would like some help from you. Thank you.

Photo 1: https://drive.google.com/file/d/0B-HZe0eHDlhENlJCOWdGZlIzZU0/view?usp=sharing

Photo 2:https://drive.google.com/file/d/0B-HZe0eHDlhERDdmaV9lcHBCOGM/view?usp=sharing

Count drops of blood

Hi, I need to develop a java program openCV to run on Android. The program will capture an image of a skin and make the score drops of blood that is enclosed within a square of 2.5 cm. I'm currently using the blob detection, but the program is not functioning well. Still unable to delineate the count within the area of 2.5 cm. I would like some help from you. Thank you.

Photo 1: https://drive.google.com/file/d/0B-HZe0eHDlhENlJCOWdGZlIzZU0/view?usp=sharing

Photo 2:https://drive.google.com/file/d/0B-HZe0eHDlhERDdmaV9lcHBCOGM/view?usp=sharing2: https://drive.google.com/file/d/0B-HZe0eHDlhERDdmaV9lcHBCOGM/view?usp=sharing

click to hide/show revision 3
No.3 Revision

updated 2015-10-06 00:31:20 -0600

berak gravatar image

Count drops of blood

Hi, I need to develop a java program openCV to run on Android. The program will capture an image of a skin and make the score drops of blood that is enclosed within a square of 2.5 cm. I'm currently using the blob detection, but the program is not functioning well. Still unable to delineate the count within the area of 2.5 cm. I would like some help from you. Thank you.

Photo 1: https://drive.google.com/file/d/0B-HZe0eHDlhENlJCOWdGZlIzZU0/view?usp=sharing

Photo 2: https://drive.google.com/file/d/0B-HZe0eHDlhERDdmaV9lcHBCOGM/view?usp=sharing

Edit:

I wrote the code to Java and it's not working . Could someone help me?

int count=0;
        Mat orig = Highgui.imread("E:\\photo.jpg",Highgui.CV_LOAD_IMAGE_GRAYSCALE);
        Imgproc.adaptiveThreshold(orig, orig, 255, Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY , 15, 5);
        Imgproc.dilate(orig, orig, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(2, 2)));
        ArrayList <MatOfPoint> contours =  new  ArrayList < MatOfPoint >(); 
        contours.clear();
        Imgproc.findContours ( orig , contours ,  new  Mat (),  Imgproc . RETR_LIST ,  Imgproc.CHAIN_APPROX_SIMPLE );
        for(int a=0;a<contours.size();a++)  
        {
             if(Imgproc.contourArea(contours.get(a)) > 20 & Imgproc.contourArea(contours.get(a)) < 150 )
             {
                 Rect rect = Imgproc.boundingRect(contours.get(a));
                 Core.rectangle(orig,new Point(rect.x,rect.y),new Point(rect.x+rect.width,rect.y+rect.height),new Scalar(0, 255, 0));
                 count++;
             }
        }
         Highgui.imwrite("e:\\photoout.jpg", orig);