Skip to content

Commit

Permalink
More updates for the website
Browse files Browse the repository at this point in the history
  • Loading branch information
mathnathan committed Jul 27, 2010
1 parent 004d607 commit e1c541f
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
8 changes: 8 additions & 0 deletions examples/CMakeLists.txt
Expand Up @@ -8,10 +8,18 @@ add_executable(example1 example2-1.cpp)
add_executable(example2 example2-2.cpp)
add_executable(example3 example2-3.cpp)
add_executable(example4 example2-4.cpp)
add_executable(example5 example2-5.cpp)
add_executable(example6 example2-6.cpp)
add_executable(example6debug example2-6debug.cpp)
add_executable(alphablend alphablend.cpp)

target_link_libraries(example1 ${OpenCV_LIBS})
target_link_libraries(example2 ${OpenCV_LIBS})
target_link_libraries(example3 ${OpenCV_LIBS})
target_link_libraries(example4 ${OpenCV_LIBS})
target_link_libraries(example5 ${OpenCV_LIBS})
target_link_libraries(example6 ${OpenCV_LIBS})
target_link_libraries(example6debug ${OpenCV_LIBS})
target_link_libraries(alphablend ${OpenCV_LIBS})


31 changes: 31 additions & 0 deletions examples/alphablend.cpp
@@ -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;
}
3 changes: 2 additions & 1 deletion examples/example2-2.cpp
Expand Up @@ -13,11 +13,12 @@ int main( int argc, char** argv ) {
cvMoveWindow( "Example2", 100, 100);
CvCapture* capture = cvCreateFileCapture( argv[1] );

double fps = cvGetCaptureProperty( capture, CV_CAP_PROP_FPS );
while(1) {
frame = cvQueryFrame( capture );
if( !frame) break;
cvShowImage( "Example2", frame );
char c = cvWaitKey(73);
char c = cvWaitKey( 33 );
if( c == 27 ) break;
}

Expand Down
2 changes: 1 addition & 1 deletion examples/example2-5.cpp
Expand Up @@ -21,7 +21,7 @@ int main( int argc, char** argv ) {
frame = cvQueryFrame( capture );
if( !frame) break;
augframe = cvCreateImage( cvGetSize( frame ), IPL_DEPTH_8U, 3 );
cvSmooth( frame, augframe, CV_BLUR, 3, 3 );
cvSmooth( frame, augframe, CV_BILATERAL, 3, 3 );
cvShowImage( "Example2", frame );
cvShowImage( "output", augframe );
char c = cvWaitKey(73);
Expand Down

0 comments on commit e1c541f

Please sign in to comment.