mirror of
https://github.com/opencv/opencv.git
synced 2026-07-26 05:43:05 +04:00
Merge branch 4.x
This commit is contained in:
+5
-5
@@ -52,23 +52,23 @@ class CompareHist {
|
||||
|
||||
List<Mat> hsvBaseList = Arrays.asList(hsvBase);
|
||||
Imgproc.calcHist(hsvBaseList, new MatOfInt(channels), new Mat(), histBase, new MatOfInt(histSize), new MatOfFloat(ranges), false);
|
||||
Core.normalize(histBase, histBase, 0, 1, Core.NORM_MINMAX);
|
||||
Core.normalize(histBase, histBase, 1, 0, Core.NORM_L1);
|
||||
|
||||
List<Mat> hsvHalfDownList = Arrays.asList(hsvHalfDown);
|
||||
Imgproc.calcHist(hsvHalfDownList, new MatOfInt(channels), new Mat(), histHalfDown, new MatOfInt(histSize), new MatOfFloat(ranges), false);
|
||||
Core.normalize(histHalfDown, histHalfDown, 0, 1, Core.NORM_MINMAX);
|
||||
Core.normalize(histHalfDown, histHalfDown, 1, 0, Core.NORM_L1);
|
||||
|
||||
List<Mat> hsvTest1List = Arrays.asList(hsvTest1);
|
||||
Imgproc.calcHist(hsvTest1List, new MatOfInt(channels), new Mat(), histTest1, new MatOfInt(histSize), new MatOfFloat(ranges), false);
|
||||
Core.normalize(histTest1, histTest1, 0, 1, Core.NORM_MINMAX);
|
||||
Core.normalize(histTest1, histTest1, 1, 0, Core.NORM_L1);
|
||||
|
||||
List<Mat> hsvTest2List = Arrays.asList(hsvTest2);
|
||||
Imgproc.calcHist(hsvTest2List, new MatOfInt(channels), new Mat(), histTest2, new MatOfInt(histSize), new MatOfFloat(ranges), false);
|
||||
Core.normalize(histTest2, histTest2, 0, 1, Core.NORM_MINMAX);
|
||||
Core.normalize(histTest2, histTest2, 1, 0, Core.NORM_L1);
|
||||
//! [Calculate the histograms for the HSV images]
|
||||
|
||||
//! [Apply the histogram comparison methods]
|
||||
for( int compareMethod = 0; compareMethod < 4; compareMethod++ ) {
|
||||
for( int compareMethod = 0; compareMethod < 6; compareMethod++ ) {
|
||||
double baseBase = Imgproc.compareHist( histBase, histBase, compareMethod );
|
||||
double baseHalf = Imgproc.compareHist( histBase, histHalfDown, compareMethod );
|
||||
double baseTest1 = Imgproc.compareHist( histBase, histTest1, compareMethod );
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.opencv.imgcodecs.Imgcodecs;
|
||||
import org.opencv.imgproc.Imgproc;
|
||||
|
||||
public class MorphologyDemo1 {
|
||||
private static final String[] ELEMENT_TYPE = { "Rectangle", "Cross", "Ellipse" };
|
||||
private static final String[] ELEMENT_TYPE = { "Rectangle", "Cross", "Ellipse", "Diamond" };
|
||||
private static final String[] MORPH_OP = { "Erosion", "Dilatation" };
|
||||
private static final int MAX_KERNEL_SIZE = 21;
|
||||
private Mat matImgSrc;
|
||||
@@ -79,6 +79,8 @@ public class MorphologyDemo1 {
|
||||
elementType = Imgproc.MORPH_CROSS;
|
||||
} else if (cb.getSelectedIndex() == 2) {
|
||||
elementType = Imgproc.MORPH_ELLIPSE;
|
||||
} else if (cb.getSelectedIndex() == 3) {
|
||||
elementType = Imgproc.MORPH_DIAMOND;
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user