Hi guys, I'm trying to convert image from jpeg format to png format. I'm also trying to apply Alpha on image so png save imag must be with alpha channel. I am not able to execute this(result.push_back<mat>(mask);) line in the code successfully.
Mat jpegImageMat = Highgui.imread("mnt/sdcard/aaawatermark/bird.jpg"); Mat gray_image = new Mat(), mask = new Mat(), rgba_image = new Mat(); List<mat> result = new ArrayList<mat>(); Core.split(jpegImageMat, result); Imgproc.cvtColor(jpegImageMat, gray_image, Imgproc.COLOR_BGR2RGBA); Imgproc.threshold(gray_image, mask, 128, 255, Imgproc.THRESH_BINARY); result.push_back<mat>(mask); Core.merge(result, rgba_image); Highgui.imwrite("mnt/sdcard/aaawatermark1/rgba.png", rgba_image);
Anybody help me will be appreciated.