From 573e8184151e261c687db6fda5581fbabfdda907 Mon Sep 17 00:00:00 2001 From: siddharth Date: Wed, 6 Nov 2013 20:29:01 +0530 Subject: [PATCH] New changes done and removed opencv_extra folder Removed opencv_extra folder inside opencv folder New changes done Removed test images --- modules/photo/src/contrast_preserve.hpp | 5 ++--- modules/photo/src/npr.hpp | 13 ++---------- modules/photo/src/seamless_cloning.hpp | 28 +++++++++---------------- 3 files changed, 14 insertions(+), 32 deletions(-) diff --git a/modules/photo/src/contrast_preserve.hpp b/modules/photo/src/contrast_preserve.hpp index 54b9525af..8a95170e3 100644 --- a/modules/photo/src/contrast_preserve.hpp +++ b/modules/photo/src/contrast_preserve.hpp @@ -427,7 +427,6 @@ void Decolor::grayImContruct(vector &wei, Mat img, Mat &Gray) maxval = Gray.at(i,j); } - for(int i=0;i(i,j) = (Gray.at(i,j) - minval)/(maxval - minval); + Gray -= minval; + Gray /= maxval - minval; } diff --git a/modules/photo/src/npr.hpp b/modules/photo/src/npr.hpp index 9658e25a6..744b2bdfb 100644 --- a/modules/photo/src/npr.hpp +++ b/modules/photo/src/npr.hpp @@ -173,7 +173,6 @@ void Domain_Filter::compute_Rfilter(Mat &output, Mat &hz, float sigma_h) { int h = output.rows; int w = output.cols; - int channel = output.channels(); float a = (float) exp((-1.0 * sqrt(2.0)) / sigma_h); @@ -190,11 +189,7 @@ void Domain_Filter::compute_Rfilter(Mat &output, Mat &hz, float sigma_h) { for(int j =1; j < w; j++) { - for(int c = 0; c(i,j*channel+c) = temp.at(i,j*channel+c) + - (temp.at(i,(j-1)*channel+c) - temp.at(i,j*channel+c)) * V.at(i,j); - } + temp.at(i,j) = temp.at(i,j) + (temp.at(i,j-1) - temp.at(i,j)) * V.at(i,j); } } @@ -202,11 +197,7 @@ void Domain_Filter::compute_Rfilter(Mat &output, Mat &hz, float sigma_h) { for(int j =w-2; j >= 0; j--) { - for(int c = 0; c(i,j*channel+c) = temp.at(i,j*channel+c) + - (temp.at(i,(j+1)*channel+c) - temp.at(i,j*channel+c))*V.at(i,j+1); - } + temp.at(i,j) = temp.at(i,j) + (temp.at(i,j+1) - temp.at(i,j)) * V.at(i,j+1); } } diff --git a/modules/photo/src/seamless_cloning.hpp b/modules/photo/src/seamless_cloning.hpp index 612d764d9..73d719c1b 100644 --- a/modules/photo/src/seamless_cloning.hpp +++ b/modules/photo/src/seamless_cloning.hpp @@ -482,7 +482,6 @@ void Cloning::normal_clone(Mat &I, Mat &mask, Mat &wmask, Mat &cloned, int num) { int w = I.size().width; int h = I.size().height; - int channel = I.channels(); initialization(I,mask,wmask); @@ -496,25 +495,18 @@ void Cloning::normal_clone(Mat &I, Mat &mask, Mat &wmask, Mat &cloned, int num) { for(int i=0;i < h; i++) for(int j=0; j < w; j++) - for(int c=0;c(i,j) - sgy.at(i,j)) > abs(grx.at(i,j) - gry.at(i,j))) { - if(abs(sgx.at(i,j*channel+c) - sgy.at(i,j*channel+c)) > - abs(grx.at(i,j*channel+c) - gry.at(i,j*channel+c))) - { - - srx32.at(i,j*channel+c) = sgx.at(i,j*channel+c) - * smask.at(i,j); - sry32.at(i,j*channel+c) = sgy.at(i,j*channel+c) - * smask.at(i,j); - } - else - { - srx32.at(i,j*channel+c) = grx.at(i,j*channel+c) - * smask.at(i,j); - sry32.at(i,j*channel+c) = gry.at(i,j*channel+c) - * smask.at(i,j); - } + srx32.at(i,j) = sgx.at(i,j) * smask.at(i,j); + sry32.at(i,j) = sgy.at(i,j) * smask.at(i,j); } + else + { + srx32.at(i,j) = grx.at(i,j) * smask.at(i,j); + sry32.at(i,j) = gry.at(i,j) * smask.at(i,j); + } + } } else if(num == 3) {