Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

detect object from images

Hi after detecting an object from video using a spefic color, i want to recognize this object from images, so i use compare histogram but it gives me double d = 1.0 for all images ? then i try to use detect feature (ORB,FAST,SIFT) then i count the good matching and retrieve the image who had the biggest length of good_matching but it return me the false image.

for compare hisogram i do like this : i travel all elements image : images

List<Mat> imagesList=new ArrayList<Mat>();
            imagesList.add(object);
            List<Mat> imagesList1=new ArrayList<Mat>();
            imagesList1.add(image);

            MatOfInt channels=new MatOfInt(0);
            Mat hist=new Mat();
            Mat hist1=new Mat();
            MatOfInt histSize=new MatOfInt(50);

            float hrangesArray[]={0.0f,255.0f};
            MatOfFloat ranges=new MatOfFloat(hrangesArray);


            Mat mask=new Mat();
            Imgproc.calcHist(imagesList, channels,mask, hist, histSize, ranges);
            Imgproc.calcHist(imagesList1, channels,mask, hist1, histSize, ranges);


          double i=  Imgproc.compareHist(hist1, hist, Imgproc.CV_COMP_BHATTACHARYYA);

and for the detecting feature i proced like in the tutorial.

but i don't know where is the problem ? thanks for help me