Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

converting Lqb to RGB

I'm using opencv 3.4.0 and android-studio, I want to apply CLAHE on the L channel so i used the Lab color space, but after applying CLAHE on th L channel i and last i converted the image back to RGB color space but i got this error whil trying to display the image. this is the error :

CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.0-dev) ../../modules/imgproc/src/color.cpp:11207: error: (-215) scn == 3 && (dcn == 3 || dcn == 4) &&



L = new Mat(newImage.rows(), newImage.cols(), CvType.CV_8UC(1));
a = new Mat(newImage.rows(), newImage.cols(), CvType.CV_8UC(1));
b = new Mat(newImage.rows(), newImage.cols(), CvType.CV_8UC(1));

BGR_RGB = Utils.loadResource(getApplicationContext(), R.drawable.retinalimage, CvType.CV_32FC3); 
Imgproc.cvtColor(BGR_RGB, newImage, Imgproc.COLOR_BGR2RGB);
Imgproc.cvtColor(newImage,newImage,Imgproc.COLOR_RGB2Lab);
split(newImage,Lab);
L = Lab.get(0);
a = Lab.get(1);
b = Lab.get(2);

CLAHE ce = Imgproc.createCLAHE();
ce.setClipLimit(2);
ce.setTilesGridSize(new Size(8, 8));
ce.apply(L, L);

Lab.add(0,L);
Core.merge(Lab,newImage);
Imgproc.cvtColor(newImage,newImage,Imgproc.COLOR_Lab2RGB);
showImage1(newImage);

converting Lqb to RGB

I'm using opencv 3.4.0 and android-studio, I want to apply CLAHE on the L channel so i used the Lab color space, but after applying CLAHE on th L channel i and last i converted the image back to RGB color space but i got this error whil trying to display the image. this is the error :

CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.0-dev) ../../modules/imgproc/src/color.cpp:11207: error: (-215) scn == 3 && (dcn == 3 || dcn == 4) &&



L = new Mat(newImage.rows(), newImage.cols(), CvType.CV_8UC(1));
a = new Mat(newImage.rows(), newImage.cols(), CvType.CV_8UC(1));
b = new Mat(newImage.rows(), newImage.cols(), CvType.CV_8UC(1));

BGR_RGB = Utils.loadResource(getApplicationContext(), R.drawable.retinalimage, CvType.CV_32FC3); 
Imgproc.cvtColor(BGR_RGB, newImage, Imgproc.COLOR_BGR2RGB);
Imgproc.cvtColor(newImage,newImage,Imgproc.COLOR_RGB2Lab);
split(newImage,Lab);
L = Lab.get(0);
a = Lab.get(1);
b = Lab.get(2);

CLAHE ce = Imgproc.createCLAHE();
ce.setClipLimit(2);
ce.setTilesGridSize(new Size(8, 8));
ce.apply(L, L);

Lab.add(0,L);
Core.merge(Lab,newImage);
Imgproc.cvtColor(newImage,newImage,Imgproc.COLOR_Lab2RGB);
showImage1(newImage);

converting Lqb Lab to RGB

I'm using opencv 3.4.0 and android-studio, I want to apply CLAHE on the L channel so i used the Lab color space, but after applying CLAHE on th L channel i and last i converted the image back to RGB color space but i got this error whil trying to display the image. this is the error :

CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.0-dev) ../../modules/imgproc/src/color.cpp:11207: error: (-215) scn == 3 && (dcn == 3 || dcn == 4) &&



L = new Mat(newImage.rows(), newImage.cols(), CvType.CV_8UC(1));
a = new Mat(newImage.rows(), newImage.cols(), CvType.CV_8UC(1));
b = new Mat(newImage.rows(), newImage.cols(), CvType.CV_8UC(1));

BGR_RGB = Utils.loadResource(getApplicationContext(), R.drawable.retinalimage, CvType.CV_32FC3); 
Imgproc.cvtColor(BGR_RGB, newImage, Imgproc.COLOR_BGR2RGB);
Imgproc.cvtColor(newImage,newImage,Imgproc.COLOR_RGB2Lab);
split(newImage,Lab);
L = Lab.get(0);
a = Lab.get(1);
b = Lab.get(2);

CLAHE ce = Imgproc.createCLAHE();
ce.setClipLimit(2);
ce.setTilesGridSize(new Size(8, 8));
ce.apply(L, L);

Lab.add(0,L);
Core.merge(Lab,newImage);
Imgproc.cvtColor(newImage,newImage,Imgproc.COLOR_Lab2RGB);
showImage1(newImage);
showImage(newImage);