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
1 parent
004d607
commit e1c541f
Showing
4 changed files
with
42 additions
and
2 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
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,31 @@ | ||
/* This program takes in 8 arguments, argv[1] and argv[2] are the images being blended. * | ||
* The ROI of argv[2] is blended into the ROI of argv[1]. argv[3] and argv[4] are the * | ||
* x and y coordinates respectively of the top left or bottom left corner of the ROI in * | ||
* the argv[1] image. argv[5] and argv[6] are the width and height of the ROI from the * | ||
* x,y coordinate. arg[7] is the weighted alph value of image argv[1], and argv[8] is * | ||
* the weighted beta value of the image argv[2] to be blended. */ | ||
|
||
# include <cv.h> | ||
# include <highgui.h> | ||
|
||
int main( int argc, char** argv ) { | ||
IplImage *src1, *src2; | ||
if( argc == 9 && ((src1=cvLoadImage(argv[1],1)) != 0 | ||
)&&((src2=cvLoadImage(argv[2],1)) != 0)) | ||
{ | ||
int x = atoi(argv[3]); | ||
int y = atoi(argv[4]); | ||
int width = atoi(argv[5]); | ||
int height = atoi(argv[6]); | ||
double alpha = (double)atof(argv[7]); | ||
double beta = (double)atof(argv[8]); | ||
cvSetImageROI(src1, cvRect(x,y,width,height)); | ||
cvSetImageROI(src2, cvRect(x,y,width,height)); | ||
cvAddWeighted(src1, alpha, src2, beta, 0.0, src1); | ||
cvResetImageROI(src1); | ||
cvNamedWindow( "Alpha_blend", 1 ); | ||
cvShowImage( "Alpha_blend", src1 ); | ||
cvWaitKey(); | ||
} | ||
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
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