-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
64 changed files
with
5,228 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "opencv2/highgui/highgui.hpp" | ||
#include <iostream> | ||
#include <opencv2/imgproc/imgproc.hpp> | ||
using namespace std; | ||
using namespace cv; | ||
|
||
Mat src; Mat dst; | ||
char window_name1[] = "Unprocessed Image"; | ||
char window_name2[] = "Processed Image"; | ||
|
||
double alpha; /* Simple contrast control */ | ||
int beta; /* Simple brightness control */ | ||
|
||
|
||
int main( int argc, char** argv ) | ||
{ | ||
/// Load the source image | ||
Mat dst, dst2; | ||
Mat f0 = imread( argv[1], 1 ); | ||
Mat f1 = imread(argv[2],1); | ||
Size size(f0.cols,f0.rows); | ||
resize(f1,dst2,size); | ||
alpha = 0.5; double beta; double input; | ||
cout << "Simple Linear Blender" << endl; | ||
cout << "Enter alpha [0-1]: "; | ||
cin >> input; | ||
alpha = input; | ||
|
||
namedWindow("LinearBlend",1); | ||
beta = 1.0-alpha; | ||
addWeighted(f0, alpha,dst2,beta,0.0, dst); | ||
|
||
imshow("Linear Blend", dst); | ||
waitKey(0); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include <cv.h> | ||
#include "opencv2/imgproc/imgproc.hpp" | ||
#include "opencv2/highgui/highgui.hpp" | ||
#include <iostream> | ||
|
||
using namespace std; | ||
using namespace cv; | ||
|
||
Mat src; Mat dst; | ||
char window_name1[] = "Unprocessed Image"; | ||
char window_name2[] = "Processed Image"; | ||
|
||
double alpha; /* Simple contrast control */ | ||
int beta; /* Simple brightness control */ | ||
|
||
|
||
int main( int argc, char** argv ) | ||
{ | ||
/// Load the source image | ||
Mat image = imread( argv[1], 1 ); | ||
Mat new_image = Mat::zeros(image.size(), image.type()); | ||
|
||
std::cout << "Basic Linear Transforms " << std::endl; | ||
std::cout << "------------------------" << std::endl; | ||
std::cout << "* Enter the alpha value [1.0-3.0]: "; | ||
std::cin >> alpha; | ||
std::cout << "* Enter the beta value [0-100]: "; | ||
std::cin >> beta; | ||
for (int y = 0; y < image.rows; y++){ | ||
for(int x = 0; x < image.cols; x++){ | ||
for(int c = 0; c < 3; c++){ | ||
new_image.at<Vec3b>(y,x)[c] = saturate_cast<uchar>(alpha *(image.at<Vec3b>(y,x)[c]) + beta); | ||
} | ||
} | ||
} | ||
new_image = new_image.t(); | ||
namedWindow("Original Image", 1); | ||
namedWindow("New Image", 1); | ||
|
||
imshow("Original Image", image); | ||
imshow("New Image", new_image); | ||
|
||
waitKey(); | ||
return 0; | ||
} |
Oops, something went wrong.