Пример #1
0
        public static void NormalizeRGB(this Mat self, Mat output, double clip)
        {
            if (self.Channel != 3)
            {
                throw new NotSupportedException("Channel sould be RGB");
            }

            ConvertColor(self, ColorConversionCodes.BGR2Lab);

            Mat[] spl = Split(self);

            CLAHE c = CLAHE.Create(clip, new OpenCvSharp.Size(8, 8));

            c.Apply(spl[0], spl[0]);

            Merge(self, spl);

            ConvertColor(self, ColorConversionCodes.Lab2BGR);
        }
Пример #2
0
        public void cuda_CLAHE()
        {
            Mat  src  = Image("lenna.png", ImreadModes.Grayscale);
            Size size = src.Size();

            Cuda.CLAHE clahe      = Cuda.CLAHE.create(20.0);
            CLAHE      clahe_gold = CLAHE.Create(20.0);

            using (GpuMat g_src = new GpuMat(size, src.Type()))
                using (GpuMat dst = new GpuMat()) {
                    g_src.Upload(src);

                    clahe.Apply(g_src, dst);
                    Mat dst_gold = new Mat();
                    clahe_gold.Apply(src, dst_gold);

                    ImageEquals(dst_gold, dst, 1.0);
                    ShowImagesWhenDebugMode(src, dst);
                }
        }