List of usage examples for org.opencv.core Mat convertTo
public void convertTo(Mat m, int rtype, double alpha, double beta)
From source file:utils.PreProcessing.java
public BufferedImage enhance(BufferedImage img) { Utils ut = new Utils(); ut.Img2GrayScale(img);//from w w w . j a v a 2s . com Mat source = ut.bufferedImageToMat(img); Mat destination = new Mat(source.rows(), source.cols(), source.type()); //Melhora constraste //Imgproc.equalizeHist(source, destination); //Melhora brilho source.convertTo(destination, -1, 2, 60); //Suavizao // Imgproc.GaussianBlur(source, destination, new Size(11, 11), 0); //Melhora a definio Imgproc.GaussianBlur(source, destination, new Size(0, 0), 10); Core.addWeighted(source, 1.8, destination, -0.8, 0, destination); //return ut.convertMatToImage(destination); BufferedImage imgRetorno = ut.matToBufferedImage(destination); return imgRetorno; }