whitespaces removed and other minor changes to fix build error

Update 1

update 2

Update 3

Update 4

Update 5

update 6

Update 7

Update 8

Update 9

Update 10

Update 11

Update 12

Update 13

Update 14

Update 15

Update 16

Update 17

Update 18

Update 19

Update 20

Update 21

Update 22

Removed Headers

Update 23

Update 24

Update 25

Update 26

Update 27

Update 28
This commit is contained in:
siddharth
2013-09-14 19:12:25 +05:30
parent 05c7c9325a
commit f85a615f3f
17 changed files with 479 additions and 509 deletions

View File

@@ -46,14 +46,14 @@ int main()
int num;
cin >> num;
cout << endl;
if(num == 1)
{
string folder = "cloning/Normal_Cloning/";
string original_path1 = folder + "source1.png";
string original_path2 = folder + "destination1.png";
string original_path3 = folder + "mask.png";
Mat source = imread(original_path1, IMREAD_COLOR);
Mat destination = imread(original_path2, IMREAD_COLOR);
Mat mask = imread(original_path3, IMREAD_COLOR);
@@ -63,7 +63,7 @@ int main()
cout << "Could not load source image " << original_path1 << endl;
exit(0);
}
if(destination.empty())
if(destination.empty())
{
cout << "Could not load destination image " << original_path2 << endl;
exit(0);
@@ -78,24 +78,24 @@ int main()
Point p;
p.x = 400;
p.y = 100;
seamlessClone(source, destination, mask, p, result, 1);
imshow("Output",result);
imwrite(folder + "cloned.png", result);
}
else if(num == 2)
{
{
string folder = "cloning/Mixed_Cloning/";
string original_path1 = folder + "source1.png";
string original_path2 = folder + "destination1.png";
string original_path3 = folder + "mask.png";
Mat source = imread(original_path1, IMREAD_COLOR);
Mat destination = imread(original_path2, IMREAD_COLOR);
Mat mask = imread(original_path3, IMREAD_COLOR);
if(source.empty())
if(source.empty())
{
cout << "Could not load source image " << original_path1 << endl;
exit(0);
@@ -105,7 +105,7 @@ int main()
cout << "Could not load destination image " << original_path2 << endl;
exit(0);
}
if(mask.empty())
if(mask.empty())
{
cout << "Could not load mask image " << original_path3 << endl;
exit(0);
@@ -115,7 +115,7 @@ int main()
Point p;
p.x = destination.size().width/2;
p.y = destination.size().height/2;
seamlessClone(source, destination, mask, p, result, 2);
imshow("Output",result);
@@ -137,12 +137,12 @@ int main()
cout << "Could not load source image " << original_path1 << endl;
exit(0);
}
if(destination.empty())
if(destination.empty())
{
cout << "Could not load destination image " << original_path2 << endl;
exit(0);
}
if(mask.empty())
if(mask.empty())
{
cout << "Could not load mask image " << original_path3 << endl;
exit(0);
@@ -152,7 +152,7 @@ int main()
Point p;
p.x = destination.size().width/2;
p.y = destination.size().height/2;
seamlessClone(source, destination, mask, p, result, 3);
imshow("Output",result);
@@ -179,7 +179,7 @@ int main()
}
Mat result;
colorChange(source, mask, result, 1.5, .5, .5);
imshow("Output",result);
@@ -194,7 +194,7 @@ int main()
Mat source = imread(original_path1, IMREAD_COLOR);
Mat mask = imread(original_path2, IMREAD_COLOR);
if(source.empty())
if(source.empty())
{
cout << "Could not load source image " << original_path1 << endl;
exit(0);
@@ -206,7 +206,7 @@ int main()
}
Mat result;
illuminationChange(source, mask, result, .2, .4);
imshow("Output",result);
@@ -233,7 +233,7 @@ int main()
}
Mat result;
textureFlattening(source, mask, result, 30, 45, 3);
imshow("Output",result);

View File

@@ -52,9 +52,6 @@ Point* pts = new Point[100];
Point* pts2 = new Point[100];
Point* pts_diff = new Point[100];
char src[50];
char dest[50];
int var = 0;
int flag = 0, flag1 = 0, flag4 = 0;
@@ -76,39 +73,38 @@ void checkfile(char*);
void source(int event, int x, int y, int, void*)
{
if (event == EVENT_LBUTTONDOWN && !drag)
{
if(flag1 == 0)
{
if(var==0)
img1 = img0.clone();
point = Point(x, y);
circle(img1,point,2,Scalar(0, 0, 255),-1, 8, 0);
pts[var] = point;
var++;
drag = 1;
if(var>1)
line(img1,pts[var-2], point, Scalar(0, 0, 255), 2, 8, 0);
if (event == EVENT_LBUTTONDOWN && !drag)
{
if(flag1 == 0)
{
if(var==0)
img1 = img0.clone();
point = Point(x, y);
circle(img1,point,2,Scalar(0, 0, 255),-1, 8, 0);
pts[var] = point;
var++;
drag = 1;
if(var>1)
line(img1,pts[var-2], point, Scalar(0, 0, 255), 2, 8, 0);
imshow("Source", img1);
}
}
imshow("Source", img1);
}
}
if (event == EVENT_LBUTTONUP && drag)
{
imshow("Source", img1);
if (event == EVENT_LBUTTONUP && drag)
{
imshow("Source", img1);
drag = 0;
}
if (event == EVENT_RBUTTONDOWN)
{
flag1 = 1;
img1 = img0.clone();
for(int i = var; i < numpts ; i++)
pts[i] = point;
drag = 0;
}
if (event == EVENT_RBUTTONDOWN)
{
flag1 = 1;
img1 = img0.clone();
for(int i = var; i < numpts ; i++)
pts[i] = point;
if(var!=0)
if(var!=0)
{
const Point* pts3[1] = {&pts[0]};
polylines( img1, pts3, &numpts,1, 1, Scalar(0,0,0), 2, 8, 0);
@@ -169,67 +165,67 @@ void source(int event, int x, int y, int, void*)
waitKey(0);
}
}
if (event == EVENT_MBUTTONDOWN)
{
for(int i = 0; i < numpts ; i++)
{
pts[i].x=0;
pts[i].y=0;
}
var = 0;
flag1 = 0;
minx = INT_MAX; miny = INT_MAX; maxx = INT_MIN; maxy = INT_MIN;
imshow("Source", img0);
}
if (event == EVENT_MBUTTONDOWN)
{
for(int i = 0; i < numpts ; i++)
{
pts[i].x=0;
pts[i].y=0;
}
var = 0;
flag1 = 0;
minx = INT_MAX; miny = INT_MAX; maxx = INT_MIN; maxy = INT_MIN;
imshow("Source", img0);
if(num == 1 || num == 2 || num == 3)
imshow("Destination",img2);
drag = 0;
}
drag = 0;
}
}
void destination(int event, int x, int y, int, void*)
{
Mat im1;
minxd = INT_MAX; minyd = INT_MAX; maxxd = INT_MIN; maxyd = INT_MIN;
im1 = img2.clone();
if (event == EVENT_LBUTTONDOWN)
{
Mat im1;
minxd = INT_MAX; minyd = INT_MAX; maxxd = INT_MIN; maxyd = INT_MIN;
im1 = img2.clone();
if (event == EVENT_LBUTTONDOWN)
{
flag4 = 1;
if(flag1 == 1)
{
point = Point(x, y);
if(flag1 == 1)
{
point = Point(x, y);
for(int i=0;i<var;i++)
{
pts2[i].x = point.x + pts_diff[i].x;
pts2[i].y = point.y + pts_diff[i].y;
}
for(int i=var;i<numpts;i++)
{
pts2[i].x = point.x + pts_diff[0].x;
pts2[i].y = point.y + pts_diff[0].y;
}
const Point* pts5[1] = {&pts2[0]};
polylines( im1, pts5, &numpts,1, 1, Scalar(0,0,255), 2, 8, 0);
const Point* pts5[1] = {&pts2[0]};
polylines( im1, pts5, &numpts,1, 1, Scalar(0,0,255), 2, 8, 0);
destx = x;
desty = y;
destx = x;
desty = y;
imshow("Destination", im1);
}
}
if (event == EVENT_RBUTTONUP)
{
for(int i=0;i<flag;i++)
{
minxd = min(minxd,pts2[i].x);
maxxd = max(maxxd,pts2[i].x);
minyd = min(minyd,pts2[i].y);
maxyd = max(maxyd,pts2[i].y);
}
imshow("Destination", im1);
}
}
if (event == EVENT_RBUTTONUP)
{
for(int i=0;i<flag;i++)
{
minxd = min(minxd,pts2[i].x);
maxxd = max(maxxd,pts2[i].x);
minyd = min(minyd,pts2[i].y);
maxyd = max(maxyd,pts2[i].y);
}
if(maxxd > im1.size().width || maxyd > im1.size().height || minxd < 0 || minyd < 0)
{
@@ -254,7 +250,7 @@ void destination(int event, int x, int y, int, void*)
if(num == 1 || num == 2 || num == 3)
{
seamlessClone(img0,img2,res1,point,blend,num);
seamlessClone(img0,img2,res1,point,blend,num);
imshow("Cloned Image", blend);
imwrite("cloned.png",blend);
waitKey(0);
@@ -302,25 +298,24 @@ int main()
cin >> num;
cout << endl;
char s[]="Source";
char d[]="Destination";
minx = INT_MAX; miny = INT_MAX; maxx = INT_MIN; maxy = INT_MIN;
minxd = INT_MAX; minyd = INT_MAX; maxxd = INT_MIN; maxyd = INT_MIN;
int flag3 = 0;
if(num == 1 || num == 2 || num == 3)
{
string src,dest;
cout << "Enter Source Image: ";
cin >> src;
cout << "Enter Destination Image: ";
cin >> dest;
img0 = imread(src);
img2 = imread(dest);
if(!img0.data)
@@ -333,7 +328,7 @@ int main()
cout << "Destination Image does not exist" << endl;
exit(0);
}
channel = img0.channels();
res = Mat::zeros(img2.size(),CV_8UC1);
@@ -358,7 +353,7 @@ int main()
string src;
cout << "Enter Source Image: ";
cin >> src;
cout << "Enter RGB values: " << endl;
cout << "Red: ";
cin >> red;
@@ -428,10 +423,10 @@ int main()
cout << "high_threshold: ";
cin >> high_t;
cout << "kernel_size: ";
cin >> kernel_size;
img0 = imread(src);
if(!img0.data)
@@ -439,7 +434,7 @@ int main()
cout << "Source Image does not exist" << endl;
exit(0);
}
res1 = Mat::zeros(img0.size(),CV_8UC1);
final = Mat::zeros(img0.size(),CV_8UC3);
@@ -449,12 +444,15 @@ int main()
setMouseCallback("Source", source, NULL);
imshow("Source", img0);
}
int flag3 = 0;
while(true)
else
{
char key = waitKey(0);
cout << "Wrong Option Choosen" << endl;
exit(0);
}
for(;;)
{
char key = (char) waitKey(0);
if(key == 'd' && flag3 == 0)
{

View File

@@ -1,4 +1,4 @@
/*
/*
* create_mask.cpp
*
* Author:
@@ -9,8 +9,6 @@
* mask image.
*/
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/core.hpp"
@@ -41,86 +39,85 @@ void mouseHandler(int, int, int, int, void*);
void mouseHandler(int event, int x, int y, int, void*)
{
if (event == EVENT_LBUTTONDOWN && !drag)
{
if(flag1 == 0)
{
if(var==0)
img1 = img0.clone();
point = Point(x, y);
circle(img1,point,2,Scalar(0, 0, 255),-1, 8, 0);
pts[var] = point;
var++;
drag = 1;
if(var>1)
line(img1,pts[var-2], point, Scalar(0, 0, 255), 2, 8, 0);
if (event == EVENT_LBUTTONDOWN && !drag)
{
if(flag1 == 0)
{
if(var==0)
img1 = img0.clone();
point = Point(x, y);
circle(img1,point,2,Scalar(0, 0, 255),-1, 8, 0);
pts[var] = point;
var++;
drag = 1;
if(var>1)
line(img1,pts[var-2], point, Scalar(0, 0, 255), 2, 8, 0);
imshow("Source", img1);
}
}
imshow("Source", img1);
}
}
if (event == EVENT_LBUTTONUP && drag)
{
imshow("Source", img1);
if (event == EVENT_LBUTTONUP && drag)
{
imshow("Source", img1);
drag = 0;
}
if (event == EVENT_RBUTTONDOWN)
{
flag1 = 1;
img1 = img0.clone();
for(int i = var; i < numpts ; i++)
pts[i] = point;
drag = 0;
}
if (event == EVENT_RBUTTONDOWN)
{
flag1 = 1;
img1 = img0.clone();
for(int i = var; i < numpts ; i++)
pts[i] = point;
if(var!=0)
{
const Point* pts3[1] = {&pts[0]};
polylines( img1, pts3, &numpts,1, 1, Scalar(0,0,0), 2, 8, 0);
}
if(var!=0)
{
const Point* pts3[1] = {&pts[0]};
polylines( img1, pts3, &numpts,1, 1, Scalar(0,0,0), 2, 8, 0);
}
for(int i=0;i<var;i++)
{
minx = min(minx,pts[i].x);
maxx = max(maxx,pts[i].x);
miny = min(miny,pts[i].y);
maxy = max(maxy,pts[i].y);
}
lenx = maxx - minx;
leny = maxy - miny;
for(int i=0;i<var;i++)
{
minx = min(minx,pts[i].x);
maxx = max(maxx,pts[i].x);
miny = min(miny,pts[i].y);
maxy = max(maxy,pts[i].y);
}
lenx = maxx - minx;
leny = maxy - miny;
imshow("Source", img1);
}
imshow("Source", img1);
}
if (event == EVENT_RBUTTONUP)
{
flag = var;
if (event == EVENT_RBUTTONUP)
{
flag = var;
final = Mat::zeros(img0.size(),CV_8UC3);
res1 = Mat::zeros(img0.size(),CV_8UC1);
const Point* pts4[1] = {&pts[0]};
final = Mat::zeros(img0.size(),CV_8UC3);
res1 = Mat::zeros(img0.size(),CV_8UC1);
const Point* pts4[1] = {&pts[0]};
fillPoly(res1, pts4,&numpts, 1, Scalar(255, 255, 255), 8, 0);
bitwise_and(img0, img0, final,res1);
fillPoly(res1, pts4,&numpts, 1, Scalar(255, 255, 255), 8, 0);
bitwise_and(img0, img0, final,res1);
imshow("mask",res1);
imwrite("mask.png",res1);
imshow("Source", img1);
imshow("Source", img1);
}
if (event == EVENT_MBUTTONDOWN)
{
for(int i = 0; i < numpts ; i++)
{
pts[i].x=0;
pts[i].y=0;
}
var = 0;
flag1 = 0;
minx = INT_MAX; miny = INT_MAX; maxx = INT_MIN; maxy = INT_MIN;
imshow("Source", img0);
drag = 0;
}
}
if (event == EVENT_MBUTTONDOWN)
{
for(int i = 0; i < numpts ; i++)
{
pts[i].x=0;
pts[i].y=0;
}
var = 0;
flag1 = 0;
minx = INT_MAX; miny = INT_MAX; maxx = INT_MIN; maxy = INT_MIN;
imshow("Source", img0);
drag = 0;
}
}
int main(int argc, char **argv)
@@ -134,21 +131,21 @@ int main(int argc, char **argv)
Mat src = imread(argv[1]);
minx = INT_MAX; miny = INT_MAX; maxx = INT_MIN; maxy = INT_MIN;
minx = INT_MAX; miny = INT_MAX; maxx = INT_MIN; maxy = INT_MIN;
img0 = src;
img0 = src;
channel = img0.channels();
channel = img0.channels();
res1 = Mat::zeros(img0.size(),CV_8UC1);
final = Mat::zeros(img0.size(),CV_8UC3);
//////////// source image ///////////////////
res1 = Mat::zeros(img0.size(),CV_8UC1);
final = Mat::zeros(img0.size(),CV_8UC3);
//////////// source image ///////////////////
namedWindow("Source", 1);
setMouseCallback("Source", mouseHandler, NULL);
imshow("Source", img0);
namedWindow("Source", 1);
setMouseCallback("Source", mouseHandler, NULL);
imshow("Source", img0);
waitKey(0);
img0.release();
img1.release();
img0.release();
img1.release();
}