public static Bitmap equHistogram(Mat image) {
// Mat image = Imgcodecs.imread(path); //读取矩阵
List<Mat> channels = new ArrayList<>();
Core.split(image, channels);
Mat bluechannel = channels.get(0);//b通道的图像
equalizeHist(bluechannel, bluechannel);//均衡化
Mat greenchannel = channels.get(1);//g通道的图像
equalizeHist(greenchannel, greenchannel);//均衡化
Mat redchannel = channels.get(2);//g通道的图像
equalizeHist(redchannel, redchannel);//均衡化
Core.merge(channels, image);
Bitmap bitmap = Bitmap.createBitmap(image.width(), image.height(), Bitmap.Config.ARGB_8888);
Utils.matToBitmap(image, bitmap, true);//添加透明度
return bitmap;
}
RGB三合一直方图
最新推荐文章于 2024-02-24 22:11:13 发布