public void LearningBasedWBBalanceWhite() { using var wb = CvXPhoto.CreateLearningBasedWB(null); using var src = Image("lenna.png"); using var dst = new Mat(src.Rows, src.Cols, src.Type()); wb.BalanceWhite(src, dst); if (Debugger.IsAttached) { using var combined = new Mat(src.Rows, src.Cols * 2, src.Type()); using var roi1 = new Mat(combined, new Rect(0, 0, src.Cols, src.Rows)); using var roi2 = new Mat(combined, new Rect(src.Cols, 0, src.Cols, src.Rows)); src.CopyTo(roi1); dst.CopyTo(roi2); Window.ShowImages(combined); } }
public void LearningBasedWBBalanceWhiteWithModel() { // About model file // http://docs.opencv.org/trunk/dc/dcb/tutorial_xphoto_training_white_balance.html using var wb = CvXPhoto.CreateLearningBasedWB(""); using var src = Image("lenna.png"); using var dst = new Mat(src.Rows, src.Cols, src.Type()); wb.BalanceWhite(src, dst); if (Debugger.IsAttached) { using var combined = new Mat(src.Rows, src.Cols * 2, src.Type()); using var roi1 = new Mat(combined, new Rect(0, 0, src.Cols, src.Rows)); using var roi2 = new Mat(combined, new Rect(src.Cols, 0, src.Cols, src.Rows)); src.CopyTo(roi1); dst.CopyTo(roi2); Window.ShowImages(combined); } }