Show histogram of gray image in android studio

asked 2014-03-27 22:06:06 -0500

RossWell gravatar image

this my code :

private Mat calHist(Mat src){
        Mat results = new Mat();

        List<Mat> arrMat = Arrays.asList(src);

        MatOfInt channels = new MatOfInt(0);

        Mat hist= new Mat();
        MatOfInt histSize = new MatOfInt(25);
        MatOfFloat ranges = new MatOfFloat(0f, 1f);
        Imgproc.calcHist(arrMat, channels, new Mat(), hist, histSize, ranges);

        return hist;
    }

but i can't show it. When i convert hist to bitmap to show, i have bug.

Utils.matToBitmap(grayHistCalc(Mat_IMG_Gray), results);

plz help me to show it.

edit retag flag offensive close merge delete