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-HZ...
Photo 2: https://drive.google.com/file/d/0B-HZ...
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);
hi fabiano, please don't write answers, when you have another question. instead, rather go and edit your original question.
I'd say the first problem is with your input image, it has really poor quality - I don't even know where those blood drops are
Is it this method you have try?
Exactly LBerger and LorenaGdl. Even using a picture with paint circles in the program is not working. You have any suggestions . Thank you.