Exemplo n.º 1
0
  public static void main(String[] args) {
    System.loadLibrary("opencv_java2410");

    Mat src = Highgui.imread("img/hx_30.jpg", 0);
    Mat dst = new Mat();

    Imgproc.equalizeHist(src, dst);

    Highgui.imwrite("out/hx_30_src.jpg", src);
    Highgui.imwrite("out/hx_30.jpg", dst);
  }
Exemplo n.º 2
0
  public static Mat Histogram(Mat im) {

    Mat img = im;

    Mat equ = new Mat();
    img.copyTo(equ);
    // Imgproc.blur(equ, equ, new Size(3, 3));

    Imgproc.cvtColor(equ, equ, Imgproc.COLOR_BGR2YCrCb);
    List<Mat> channels = new ArrayList<Mat>();
    Core.split(equ, channels);
    Imgproc.equalizeHist(channels.get(0), channels.get(0));
    Core.merge(channels, equ);
    Imgproc.cvtColor(equ, equ, Imgproc.COLOR_YCrCb2BGR);

    Mat gray = new Mat();
    Imgproc.cvtColor(equ, gray, Imgproc.COLOR_BGR2GRAY);
    Mat grayOrig = new Mat();
    Imgproc.cvtColor(img, grayOrig, Imgproc.COLOR_BGR2GRAY);
    System.out.println("Histogram work ///");
    return grayOrig;
  }