Face HDR (MergeDebevec, TonemapDurand)

Post your Android related questions here.
Post Reply
Posts: 1
Joined: Wed Dec 05, 2018 8:28 am

Face HDR (MergeDebevec, TonemapDurand)

Post by gwen » Wed Dec 05, 2018 9:27 am


I would like implement differents algorithme of this website : https://docs.opencv.org/3.1.0/d2/df0/tu ... y_hdr.html

I have tried to use MergeDebevec with different exposure of image like it's show. I think my code don't works because when i writted the image result it's a blank image... I haven't errors but no results. Could you find what it doesn't works or gives a sample of code it works for that i understand why ?

My code it's the following :

First step, I load color images like the website, i sure that it's not here the issue because i have writted them and its the good.

Code: Select all

Java.IO.File path = Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryPictures);

Mat mat1 = new Mat(path + "//exposure4.JPG");

Mat mat2 = new Mat(path + "//exposure2.JPG");

Mat mat3 = new Mat(path + "//exposureMoins2.JPG");

Mat mat4 = new Mat(path + "//exposureMoins4.JPG");

The Second step it's load image in a Vector of Matrice (Vector of images)

Code: Select all

            VectorOfMat vectorImages = new VectorOfMat();

Third Step, i'm push in a vector of double the exposure associated at the pictures :

Code: Select all

            VectorOfDouble vectorOfExposure = new VectorOfDouble();
            vectorOfExposure.Push(new[] { 15.0 });
            vectorOfExposure.Push(new[] { 2.5 });
            vectorOfExposure.Push(new[] { 0.25 });
            vectorOfExposure.Push(new[] { 0.0333 });

I create a matrice of 1 cols and 256 rows with DepthType.Cv32F because i have this error else :

(Inner Exception #12) Emgu.CV.Util.CvException: OpenCV: depth == CV_32F || depth == CV_64F

I don't know what it changes because on the website the function has not this matrice. If you can explain me in more details why this matrice because i don't understand on the documentation : http://www.emgu.com/wiki/files/3.0.0/do ... 38230a.htm

Code: Select all

           Mat matResponse = new Mat(new Size(1,256), DepthType.Cv32F, mat1.NumberOfChannels);

The fourth step i create the image result with a matrice :

Code: Select all

            Mat matHDRDebevc = new Mat(new Size(mat1.Width, mat1.Height),DepthType.Cv32F, 3);
And for finish i do the processing with all the parameters and i write the image result (but like i have say it's a blank image) :

Code: Select all

            mergeDebevec.Process(vectorImages, matHDRDebevc, vectorOfExposure, matResponse);

            Image<Bgr, byte> imageHDR = matHDRDebevc.ToImage<Bgr, byte>();
            List<Image<Bgr, byte>> listLuminenceImage = new List<Image<Bgr, byte>>();


            foreach (Image<Bgr, byte> img in listLuminenceImage)
                FaceRecognitionHelper.WriteImage(img, "Hdr1");

Sorry if you don't understand me clearly with my english...

Thanks in advance ;)


Site Admin
Posts: 1011
Joined: Thu Feb 28, 2008 4:16 pm

Re: Face HDR (MergeDebevec, TonemapDurand)

Post by canming » Fri Dec 07, 2018 12:54 pm

Here is a sample code for performing HDR computation:
https://github.com/emgucv/emgucv/blob/m ... s.cs#L3596

Hope that helps.

Post Reply