How to compute 3D histogram for RGB image

asked 2018-06-21 04:43:56 -0500

Macho gravatar image

Since java opencv Mat don't support 3D Mat elements, I wonder if i calculated Histogram for R channel , Histogram for G channel and Histogram for B channel and appended all the outputs together would it be the same if i calculated 3D histogram this way

    Mat histogram = new Mat();              
    MatOfInt histSizes = new MatOfInt(10,10,10);        
    MatOfFloat histRanges = new MatOfFloat(0,256,0,256,0,256);  
    MatOfInt channels = new MatOfInt(0,1,2);
    Imgproc.calcHist(sourceImages,channels,new Mat(), histogram, histSizes, histRanges);
edit retag flag offensive close merge delete


there is an example of 3D histogram with opencv in C++. Try same method in java and post your result

LBerger gravatar imageLBerger ( 2018-06-21 08:41:13 -0500 )edit