Make highgui.hpp independent from C API

This commit is contained in:
Andrey Kamaev
2013-04-07 22:45:38 +04:00
parent 288a0634c2
commit 0738ea7d0f
152 changed files with 899 additions and 594 deletions

View File

@@ -60,10 +60,10 @@ int main(int argc, char *argv[])
return -1;
}
Size refS = Size((int) captRefrnc.get(CV_CAP_PROP_FRAME_WIDTH),
(int) captRefrnc.get(CV_CAP_PROP_FRAME_HEIGHT)),
uTSi = Size((int) captUndTst.get(CV_CAP_PROP_FRAME_WIDTH),
(int) captUndTst.get(CV_CAP_PROP_FRAME_HEIGHT));
Size refS = Size((int) captRefrnc.get(CAP_PROP_FRAME_WIDTH),
(int) captRefrnc.get(CAP_PROP_FRAME_HEIGHT)),
uTSi = Size((int) captUndTst.get(CAP_PROP_FRAME_WIDTH),
(int) captUndTst.get(CAP_PROP_FRAME_HEIGHT));
if (refS != uTSi)
{
@@ -75,13 +75,13 @@ int main(int argc, char *argv[])
const char* WIN_RF = "Reference";
// Windows
namedWindow(WIN_RF, CV_WINDOW_AUTOSIZE);
namedWindow(WIN_UT, CV_WINDOW_AUTOSIZE);
cvMoveWindow(WIN_RF, 400 , 0); //750, 2 (bernat =0)
cvMoveWindow(WIN_UT, refS.width, 0); //1500, 2
namedWindow(WIN_RF, WINDOW_AUTOSIZE);
namedWindow(WIN_UT, WINDOW_AUTOSIZE);
moveWindow(WIN_RF, 400 , 0); //750, 2 (bernat =0)
moveWindow(WIN_UT, refS.width, 0); //1500, 2
cout << "Reference frame resolution: Width=" << refS.width << " Height=" << refS.height
<< " of nr#: " << captRefrnc.get(CV_CAP_PROP_FRAME_COUNT) << endl;
<< " of nr#: " << captRefrnc.get(CAP_PROP_FRAME_COUNT) << endl;
cout << "PSNR trigger value " << setiosflags(ios::fixed) << setprecision(3)
<< psnrTriggerValue << endl;
@@ -125,7 +125,7 @@ int main(int argc, char *argv[])
imshow(WIN_RF, frameReference);
imshow(WIN_UT, frameUnderTest);
c = (char)cvWaitKey(delay);
c = (char)waitKey(delay);
if (c == 27) break;
}

View File

@@ -41,19 +41,19 @@ int main(int argc, char *argv[])
string::size_type pAt = source.find_last_of('.'); // Find extension point
const string NAME = source.substr(0, pAt) + argv[2][0] + ".avi"; // Form the new name with container
int ex = static_cast<int>(inputVideo.get(CV_CAP_PROP_FOURCC)); // Get Codec Type- Int form
int ex = static_cast<int>(inputVideo.get(CAP_PROP_FOURCC)); // Get Codec Type- Int form
// Transform from int to char via Bitwise operators
char EXT[] = {(char)(ex & 0XFF) , (char)((ex & 0XFF00) >> 8),(char)((ex & 0XFF0000) >> 16),(char)((ex & 0XFF000000) >> 24), 0};
Size S = Size((int) inputVideo.get(CV_CAP_PROP_FRAME_WIDTH), // Acquire input size
(int) inputVideo.get(CV_CAP_PROP_FRAME_HEIGHT));
Size S = Size((int) inputVideo.get(CAP_PROP_FRAME_WIDTH), // Acquire input size
(int) inputVideo.get(CAP_PROP_FRAME_HEIGHT));
VideoWriter outputVideo; // Open the output
if (askOutputType)
outputVideo.open(NAME, ex=-1, inputVideo.get(CV_CAP_PROP_FPS), S, true);
outputVideo.open(NAME, ex=-1, inputVideo.get(CAP_PROP_FPS), S, true);
else
outputVideo.open(NAME, ex, inputVideo.get(CV_CAP_PROP_FPS), S, true);
outputVideo.open(NAME, ex, inputVideo.get(CAP_PROP_FPS), S, true);
if (!outputVideo.isOpened())
{
@@ -62,7 +62,7 @@ int main(int argc, char *argv[])
}
cout << "Input frame resolution: Width=" << S.width << " Height=" << S.height
<< " of nr#: " << inputVideo.get(CV_CAP_PROP_FRAME_COUNT) << endl;
<< " of nr#: " << inputVideo.get(CAP_PROP_FRAME_COUNT) << endl;
cout << "Input codec type: " << EXT << endl;
int channel = 2; // Select the channel to save

View File

@@ -37,8 +37,8 @@ int main( int, char** argv )
equalizeHist( src, dst );
/// Display results
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
namedWindow( equalized_window, CV_WINDOW_AUTOSIZE );
namedWindow( source_window, WINDOW_AUTOSIZE );
namedWindow( equalized_window, WINDOW_AUTOSIZE );
imshow( source_window, src );
imshow( equalized_window, dst );

View File

@@ -33,8 +33,8 @@ int main( int, char** argv )
templ = imread( argv[2], 1 );
/// Create windows
namedWindow( image_window, CV_WINDOW_AUTOSIZE );
namedWindow( result_window, CV_WINDOW_AUTOSIZE );
namedWindow( image_window, WINDOW_AUTOSIZE );
namedWindow( result_window, WINDOW_AUTOSIZE );
/// Create Trackbar
const char* trackbar_label = "Method: \n 0: SQDIFF \n 1: SQDIFF NORMED \n 2: TM CCORR \n 3: TM CCORR NORMED \n 4: TM COEFF \n 5: TM COEFF NORMED";

View File

@@ -37,7 +37,7 @@ int main( int, char** argv )
/// Create Trackbar to enter the number of bins
const char* window_image = "Source image";
namedWindow( window_image, CV_WINDOW_AUTOSIZE );
namedWindow( window_image, WINDOW_AUTOSIZE );
createTrackbar("* Hue bins: ", window_image, &bins, 180, Hist_and_Backproj );
Hist_and_Backproj(0, 0);

View File

@@ -34,7 +34,7 @@ int main( int, char** argv )
cvtColor( src, hsv, COLOR_BGR2HSV );
/// Show the image
namedWindow( window_image, CV_WINDOW_AUTOSIZE );
namedWindow( window_image, WINDOW_AUTOSIZE );
imshow( window_image, src );
/// Set Trackbars for floodfill thresholds
@@ -52,7 +52,7 @@ int main( int, char** argv )
*/
void pickPoint (int event, int x, int y, int, void* )
{
if( event != CV_EVENT_LBUTTONDOWN )
if( event != EVENT_LBUTTONDOWN )
{ return; }
// Fill and get the mask

View File

@@ -71,7 +71,7 @@ int main( int, char** argv )
}
/// Display
namedWindow("calcHist Demo", CV_WINDOW_AUTOSIZE );
namedWindow("calcHist Demo", WINDOW_AUTOSIZE );
imshow("calcHist Demo", histImage );
waitKey(0);

View File

@@ -37,9 +37,9 @@ int main( int, char** argv )
{ return -1; }
/// Create windows
namedWindow( "Erosion Demo", CV_WINDOW_AUTOSIZE );
namedWindow( "Dilation Demo", CV_WINDOW_AUTOSIZE );
cvMoveWindow( "Dilation Demo", src.cols, 0 );
namedWindow( "Erosion Demo", WINDOW_AUTOSIZE );
namedWindow( "Dilation Demo", WINDOW_AUTOSIZE );
moveWindow( "Dilation Demo", src.cols, 0 );
/// Create Erosion Trackbar
createTrackbar( "Element:\n 0: Rect \n 1: Cross \n 2: Ellipse", "Erosion Demo",

View File

@@ -39,7 +39,7 @@ int main( int, char** argv )
{ return -1; }
/// Create window
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
namedWindow( window_name, WINDOW_AUTOSIZE );
/// Create Trackbar to select Morphology operation
createTrackbar("Operator:\n 0: Opening - 1: Closing \n 2: Gradient - 3: Top Hat \n 4: Black Hat", window_name, &morph_operator, max_operator, Morphology_Operations );

View File

@@ -40,7 +40,7 @@ int main( void )
dst = tmp;
/// Create window
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
namedWindow( window_name, WINDOW_AUTOSIZE );
imshow( window_name, dst );
/// Loop

View File

@@ -31,7 +31,7 @@ int display_dst( int delay );
*/
int main( void )
{
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
namedWindow( window_name, WINDOW_AUTOSIZE );
/// Load the source image
src = imread( "../images/lena.png", 1 );
@@ -89,7 +89,7 @@ int display_caption( const char* caption )
dst = Mat::zeros( src.size(), src.type() );
putText( dst, caption,
Point( src.cols/4, src.rows/2),
CV_FONT_HERSHEY_COMPLEX, 1, Scalar(255, 255, 255) );
FONT_HERSHEY_COMPLEX, 1, Scalar(255, 255, 255) );
imshow( window_name, dst );
int c = waitKey( DELAY_CAPTION );

View File

@@ -40,7 +40,7 @@ int main( int, char** argv )
cvtColor( src, src_gray, COLOR_RGB2GRAY );
/// Create a window to display results
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
namedWindow( window_name, WINDOW_AUTOSIZE );
/// Create Trackbar to choose type of Threshold
createTrackbar( trackbar_type,

View File

@@ -61,7 +61,7 @@ int main( int, char** argv )
cvtColor( src, src_gray, COLOR_BGR2GRAY );
/// Create a window
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
namedWindow( window_name, WINDOW_AUTOSIZE );
/// Create a Trackbar for user to enter threshold
createTrackbar( "Min Threshold:", window_name, &lowThreshold, max_lowThreshold, CannyThreshold );

View File

@@ -65,13 +65,13 @@ int main( int, char** argv )
/// Show what you got
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
namedWindow( source_window, WINDOW_AUTOSIZE );
imshow( source_window, src );
namedWindow( warp_window, CV_WINDOW_AUTOSIZE );
namedWindow( warp_window, WINDOW_AUTOSIZE );
imshow( warp_window, warp_dst );
namedWindow( warp_rotate_window, CV_WINDOW_AUTOSIZE );
namedWindow( warp_rotate_window, WINDOW_AUTOSIZE );
imshow( warp_rotate_window, warp_rotate_dst );
/// Wait until user exits the program

View File

@@ -48,7 +48,7 @@ int main(int, char** argv)
}
/// Show your results
namedWindow( "Hough Circle Transform Demo", CV_WINDOW_AUTOSIZE );
namedWindow( "Hough Circle Transform Demo", WINDOW_AUTOSIZE );
imshow( "Hough Circle Transform Demo", src );
waitKey(0);

View File

@@ -55,10 +55,10 @@ int main( int, char** argv )
char thresh_label[50];
sprintf( thresh_label, "Thres: %d + input", min_threshold );
namedWindow( standard_name, CV_WINDOW_AUTOSIZE );
namedWindow( standard_name, WINDOW_AUTOSIZE );
createTrackbar( thresh_label, standard_name, &s_trackbar, max_trackbar, Standard_Hough);
namedWindow( probabilistic_name, CV_WINDOW_AUTOSIZE );
namedWindow( probabilistic_name, WINDOW_AUTOSIZE );
createTrackbar( thresh_label, probabilistic_name, &p_trackbar, max_trackbar, Probabilistic_Hough);
/// Initialize
@@ -100,7 +100,7 @@ void Standard_Hough( int, void* )
Point pt1( cvRound(x0 + alpha*(-sin_t)), cvRound(y0 + alpha*cos_t) );
Point pt2( cvRound(x0 - alpha*(-sin_t)), cvRound(y0 - alpha*cos_t) );
line( standard_hough, pt1, pt2, Scalar(255,0,0), 3, CV_AA);
line( standard_hough, pt1, pt2, Scalar(255,0,0), 3, LINE_AA);
}
imshow( standard_name, standard_hough );
@@ -121,7 +121,7 @@ void Probabilistic_Hough( int, void* )
for( size_t i = 0; i < p_lines.size(); i++ )
{
Vec4i l = p_lines[i];
line( probabilistic_hough, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(255,0,0), 3, CV_AA);
line( probabilistic_hough, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(255,0,0), 3, LINE_AA);
}
imshow( probabilistic_name, probabilistic_hough );

View File

@@ -37,7 +37,7 @@ int main( int, char** argv )
cvtColor( src, src_gray, COLOR_RGB2GRAY );
/// Create window
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
namedWindow( window_name, WINDOW_AUTOSIZE );
/// Apply Laplace function
Mat abs_dst;

View File

@@ -34,7 +34,7 @@ int main( int, char** argv )
map_y.create( src.size(), CV_32FC1 );
/// Create window
namedWindow( remap_window, CV_WINDOW_AUTOSIZE );
namedWindow( remap_window, WINDOW_AUTOSIZE );
/// Loop
for(;;)

View File

@@ -36,7 +36,7 @@ int main( int, char** argv )
cvtColor( src, src_gray, COLOR_RGB2GRAY );
/// Create window
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
namedWindow( window_name, WINDOW_AUTOSIZE );
/// Generate grad_x and grad_y
Mat grad_x, grad_y;

View File

@@ -44,7 +44,7 @@ int main( int, char** argv )
printf( " ** Press 'ESC' to exit the program \n");
/// Create window
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
namedWindow( window_name, WINDOW_AUTOSIZE );
/// Initialize arguments for the filter
top = (int) (0.05*src.rows); bottom = (int) (0.05*src.rows);

View File

@@ -35,7 +35,7 @@ int main ( int, char** argv )
{ return -1; }
/// Create window
namedWindow( window_name, CV_WINDOW_AUTOSIZE );
namedWindow( window_name, WINDOW_AUTOSIZE );
/// Initialize arguments for the filter
anchor = Point( -1, -1 );

View File

@@ -35,7 +35,7 @@ int main( int, char** argv )
/// Create Window
const char* source_window = "Source";
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
namedWindow( source_window, WINDOW_AUTOSIZE );
imshow( source_window, src );
createTrackbar( " Canny thresh:", "Source", &thresh, max_thresh, thresh_callback );
@@ -68,6 +68,6 @@ void thresh_callback(int, void* )
}
/// Show in a window
namedWindow( "Contours", CV_WINDOW_AUTOSIZE );
namedWindow( "Contours", WINDOW_AUTOSIZE );
imshow( "Contours", drawing );
}

View File

@@ -35,7 +35,7 @@ int main( int, char** argv )
/// Create Window
const char* source_window = "Source";
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
namedWindow( source_window, WINDOW_AUTOSIZE );
imshow( source_window, src );
createTrackbar( " Threshold:", "Source", &thresh, max_thresh, thresh_callback );
@@ -83,6 +83,6 @@ void thresh_callback(int, void* )
}
/// Show in a window
namedWindow( "Contours", CV_WINDOW_AUTOSIZE );
namedWindow( "Contours", WINDOW_AUTOSIZE );
imshow( "Contours", drawing );
}

View File

@@ -35,7 +35,7 @@ int main( int, char** argv )
/// Create Window
const char* source_window = "Source";
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
namedWindow( source_window, WINDOW_AUTOSIZE );
imshow( source_window, src );
createTrackbar( " Threshold:", "Source", &thresh, max_thresh, thresh_callback );
@@ -85,6 +85,6 @@ void thresh_callback(int, void* )
}
/// Show in a window
namedWindow( "Contours", CV_WINDOW_AUTOSIZE );
namedWindow( "Contours", WINDOW_AUTOSIZE );
imshow( "Contours", drawing );
}

View File

@@ -35,7 +35,7 @@ int main( int, char** argv )
/// Create Window
const char* source_window = "Source";
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
namedWindow( source_window, WINDOW_AUTOSIZE );
imshow( source_window, src );
createTrackbar( " Threshold:", "Source", &thresh, max_thresh, thresh_callback );
@@ -76,6 +76,6 @@ void thresh_callback(int, void* )
}
/// Show in a window
namedWindow( "Hull demo", CV_WINDOW_AUTOSIZE );
namedWindow( "Hull demo", WINDOW_AUTOSIZE );
imshow( "Hull demo", drawing );
}

View File

@@ -35,7 +35,7 @@ int main( int, char** argv )
/// Create Window
const char* source_window = "Source";
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
namedWindow( source_window, WINDOW_AUTOSIZE );
imshow( source_window, src );
createTrackbar( " Canny thresh:", "Source", &thresh, max_thresh, thresh_callback );
@@ -79,7 +79,7 @@ void thresh_callback(int, void* )
}
/// Show in a window
namedWindow( "Contours", CV_WINDOW_AUTOSIZE );
namedWindow( "Contours", WINDOW_AUTOSIZE );
imshow( "Contours", drawing );
/// Calculate the area with the moments 00 and compare with the result of the OpenCV function

View File

@@ -71,9 +71,9 @@ int main( void )
/// Create Window and show your results
const char* source_window = "Source";
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
namedWindow( source_window, WINDOW_AUTOSIZE );
imshow( source_window, src );
namedWindow( "Distance", CV_WINDOW_AUTOSIZE );
namedWindow( "Distance", WINDOW_AUTOSIZE );
imshow( "Distance", drawing );
waitKey(0);

View File

@@ -64,7 +64,7 @@ int main( int, char** argv )
minMaxLoc( Mc, &myHarris_minVal, &myHarris_maxVal, 0, 0, Mat() );
/* Create Window and Trackbar */
namedWindow( myHarris_window, CV_WINDOW_AUTOSIZE );
namedWindow( myHarris_window, WINDOW_AUTOSIZE );
createTrackbar( " Quality Level:", myHarris_window, &myHarris_qualityLevel, max_qualityLevel, myHarris_function );
myHarris_function( 0, 0 );
@@ -75,7 +75,7 @@ int main( int, char** argv )
minMaxLoc( myShiTomasi_dst, &myShiTomasi_minVal, &myShiTomasi_maxVal, 0, 0, Mat() );
/* Create Window and Trackbar */
namedWindow( myShiTomasi_window, CV_WINDOW_AUTOSIZE );
namedWindow( myShiTomasi_window, WINDOW_AUTOSIZE );
createTrackbar( " Quality Level:", myShiTomasi_window, &myShiTomasi_qualityLevel, max_qualityLevel, myShiTomasi_function );
myShiTomasi_function( 0, 0 );

View File

@@ -34,7 +34,7 @@ int main( int, char** argv )
cvtColor( src, src_gray, COLOR_BGR2GRAY );
/// Create a window and a trackbar
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
namedWindow( source_window, WINDOW_AUTOSIZE );
createTrackbar( "Threshold: ", source_window, &thresh, max_thresh, cornerHarris_demo );
imshow( source_window, src );
@@ -77,6 +77,6 @@ void cornerHarris_demo( int, void* )
}
}
/// Showing the result
namedWindow( corners_window, CV_WINDOW_AUTOSIZE );
namedWindow( corners_window, WINDOW_AUTOSIZE );
imshow( corners_window, dst_norm_scaled );
}

View File

@@ -35,7 +35,7 @@ int main( int, char** argv )
cvtColor( src, src_gray, COLOR_BGR2GRAY );
/// Create Window
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
namedWindow( source_window, WINDOW_AUTOSIZE );
/// Create Trackbar to set the number of corners
createTrackbar( "Max corners:", source_window, &maxCorners, maxTrackbar, goodFeaturesToTrack_Demo );
@@ -87,13 +87,13 @@ void goodFeaturesToTrack_Demo( int, void* )
{ circle( copy, corners[i], r, Scalar(rng.uniform(0,255), rng.uniform(0,255), rng.uniform(0,255)), -1, 8, 0 ); }
/// Show what you got
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
namedWindow( source_window, WINDOW_AUTOSIZE );
imshow( source_window, copy );
/// Set the neeed parameters to find the refined corners
Size winSize = Size( 5, 5 );
Size zeroZone = Size( -1, -1 );
TermCriteria criteria = TermCriteria( CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 40, 0.001 );
TermCriteria criteria = TermCriteria( TermCriteria::EPS + TermCriteria::COUNT, 40, 0.001 );
/// Calculate the refined corner locations
cornerSubPix( src_gray, corners, winSize, zeroZone, criteria );

View File

@@ -35,7 +35,7 @@ int main( int, char** argv )
cvtColor( src, src_gray, COLOR_BGR2GRAY );
/// Create Window
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
namedWindow( source_window, WINDOW_AUTOSIZE );
/// Create Trackbar to set the number of corners
createTrackbar( "Max corners:", source_window, &maxCorners, maxTrackbar, goodFeaturesToTrack_Demo );
@@ -87,7 +87,7 @@ void goodFeaturesToTrack_Demo( int, void* )
{ circle( copy, corners[i], r, Scalar(rng.uniform(0,255), rng.uniform(0,255), rng.uniform(0,255)), -1, 8, 0 ); }
/// Show what you got
namedWindow( source_window, CV_WINDOW_AUTOSIZE );
namedWindow( source_window, WINDOW_AUTOSIZE );
imshow( source_window, copy );
}

View File

@@ -147,7 +147,7 @@ public:
view0.copyTo(result);
}
else if( atImageList < (int)imageList.size() )
result = imread(imageList[atImageList++], CV_LOAD_IMAGE_COLOR);
result = imread(imageList[atImageList++], IMREAD_COLOR);
return result;
}

View File

@@ -26,8 +26,8 @@ int main( int argc, char** argv )
{ readme(); return -1; }
//-- 1. Read the images
Mat imgLeft = imread( argv[1], CV_LOAD_IMAGE_GRAYSCALE );
Mat imgRight = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );
Mat imgLeft = imread( argv[1], IMREAD_GRAYSCALE );
Mat imgRight = imread( argv[2], IMREAD_GRAYSCALE );
//-- And create the image in which we will save our disparities
Mat imgDisparity16S = Mat( imgLeft.rows, imgLeft.cols, CV_16S );
Mat imgDisparity8U = Mat( imgLeft.rows, imgLeft.cols, CV_8UC1 );
@@ -54,7 +54,7 @@ int main( int argc, char** argv )
//-- 4. Display it as a CV_8UC1 image
imgDisparity16S.convertTo( imgDisparity8U, CV_8UC1, 255/(maxVal - minVal));
namedWindow( windowDisparity, CV_WINDOW_NORMAL );
namedWindow( windowDisparity, WINDOW_NORMAL );
imshow( windowDisparity, imgDisparity8U );
//-- 5. Save the image

View File

@@ -64,9 +64,9 @@ int main( void ){
/// 3. Display your stuff!
imshow( atom_window, atom_image );
cvMoveWindow( atom_window, 0, 200 );
moveWindow( atom_window, 0, 200 );
imshow( rook_window, rook_image );
cvMoveWindow( rook_window, w, 200 );
moveWindow( rook_window, w, 200 );
waitKey( 0 );
return(0);

View File

@@ -304,7 +304,7 @@ int Displaying_Random_Text( Mat image, char* window_name, RNG rng )
*/
int Displaying_Big_End( Mat image, char* window_name, RNG )
{
Size textsize = getTextSize("OpenCV forever!", CV_FONT_HERSHEY_COMPLEX, 3, 5, 0);
Size textsize = getTextSize("OpenCV forever!", FONT_HERSHEY_COMPLEX, 3, 5, 0);
Point org((window_width - textsize.width)/2, (window_height - textsize.height)/2);
int lineType = 8;
@@ -313,7 +313,7 @@ int Displaying_Big_End( Mat image, char* window_name, RNG )
for( int i = 0; i < 255; i += 2 )
{
image2 = image - Scalar::all(i);
putText( image2, "OpenCV forever!", org, CV_FONT_HERSHEY_COMPLEX, 3,
putText( image2, "OpenCV forever!", org, FONT_HERSHEY_COMPLEX, 3,
Scalar(i, i, 255), 5, lineType );
imshow( window_name, image2 );

View File

@@ -22,7 +22,7 @@ int main(int argc, char ** argv)
const char* filename = argc >=2 ? argv[1] : "lena.jpg";
Mat I = imread(filename, CV_LOAD_IMAGE_GRAYSCALE);
Mat I = imread(filename, IMREAD_GRAYSCALE);
if( I.empty())
return -1;
@@ -67,7 +67,7 @@ int main(int argc, char ** argv)
q2.copyTo(q1);
tmp.copyTo(q2);
normalize(magI, magI, 0, 1, CV_MINMAX); // Transform the matrix with float values into a
normalize(magI, magI, 0, 1, NORM_MINMAX); // Transform the matrix with float values into a
// viewable image form (float between values 0 and 1).
imshow("Input Image" , I ); // Show the result

View File

@@ -36,9 +36,9 @@ int main( int argc, char* argv[])
Mat I, J;
if( argc == 4 && !strcmp(argv[3],"G") )
I = imread(argv[1], CV_LOAD_IMAGE_GRAYSCALE);
I = imread(argv[1], IMREAD_GRAYSCALE);
else
I = imread(argv[1], CV_LOAD_IMAGE_COLOR);
I = imread(argv[1], IMREAD_COLOR);
if (!I.data)
{

View File

@@ -22,6 +22,10 @@ static void help( char* progName)
// comment out the define to use only the latest C++ API
#define DEMO_MIXED_API_USE
#ifdef DEMO_MIXED_API_USE
# include <opencv2/highgui/highgui_c.h>
#endif
int main( int argc, char** argv )
{
help(argv[0]);
@@ -118,7 +122,7 @@ int main( int argc, char** argv )
cvtColor(I_YUV, I, COLOR_YCrCb2BGR); // and produce the output RGB image
namedWindow("image with grain", CV_WINDOW_AUTOSIZE); // use this to create images
namedWindow("image with grain", WINDOW_AUTOSIZE); // use this to create images
#ifdef DEMO_MIXED_API_USE
// this is to demonstrate that I and IplI really share the data - the result of the above

View File

@@ -27,12 +27,12 @@ int main( int argc, char* argv[])
Mat I, J, K;
if (argc >= 3 && !strcmp("G", argv[2]))
I = imread( filename, CV_LOAD_IMAGE_GRAYSCALE);
I = imread( filename, IMREAD_GRAYSCALE);
else
I = imread( filename, CV_LOAD_IMAGE_COLOR);
I = imread( filename, IMREAD_COLOR);
namedWindow("Input", CV_WINDOW_AUTOSIZE);
namedWindow("Output", CV_WINDOW_AUTOSIZE);
namedWindow("Input", WINDOW_AUTOSIZE);
namedWindow("Output", WINDOW_AUTOSIZE);
imshow("Input", I);
double t = (double)getTickCount();
@@ -43,7 +43,7 @@ int main( int argc, char* argv[])
cout << "Hand written function times passed in seconds: " << t << endl;
imshow("Output", J);
cvWaitKey(0);
waitKey();
Mat kern = (Mat_<char>(3,3) << 0, -1, 0,
-1, 5, -1,
@@ -55,7 +55,7 @@ int main( int argc, char* argv[])
imshow("Output", K);
cvWaitKey(0);
waitKey();
return 0;
}
void Sharpen(const Mat& myImage,Mat& Result)

View File

@@ -25,8 +25,8 @@ int main( int argc, char** argv )
if( argc != 3 )
{ readme(); return -1; }
Mat img_1 = imread( argv[1], CV_LOAD_IMAGE_GRAYSCALE );
Mat img_2 = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );
Mat img_1 = imread( argv[1], IMREAD_GRAYSCALE );
Mat img_2 = imread( argv[2], IMREAD_GRAYSCALE );
if( !img_1.data || !img_2.data )
{ std::cout<< " --(!) Error reading images " << std::endl; return -1; }

View File

@@ -26,8 +26,8 @@ int main( int argc, char** argv )
if( argc != 3 )
{ readme(); return -1; }
Mat img_object = imread( argv[1], CV_LOAD_IMAGE_GRAYSCALE );
Mat img_scene = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );
Mat img_object = imread( argv[1], IMREAD_GRAYSCALE );
Mat img_scene = imread( argv[2], IMREAD_GRAYSCALE );
if( !img_object.data || !img_scene.data )
{ std::cout<< " --(!) Error reading images " << std::endl; return -1; }

View File

@@ -24,8 +24,8 @@ int main( int argc, char** argv )
if( argc != 3 )
{ return -1; }
Mat img_1 = imread( argv[1], CV_LOAD_IMAGE_GRAYSCALE );
Mat img_2 = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );
Mat img_1 = imread( argv[1], IMREAD_GRAYSCALE );
Mat img_2 = imread( argv[2], IMREAD_GRAYSCALE );
if( !img_1.data || !img_2.data )
{ return -1; }

View File

@@ -24,8 +24,8 @@ int main( int argc, char** argv )
if( argc != 3 )
{ readme(); return -1; }
Mat img_1 = imread( argv[1], CV_LOAD_IMAGE_GRAYSCALE );
Mat img_2 = imread( argv[2], CV_LOAD_IMAGE_GRAYSCALE );
Mat img_1 = imread( argv[1], IMREAD_GRAYSCALE );
Mat img_2 = imread( argv[2], IMREAD_GRAYSCALE );
if( !img_1.data || !img_2.data )
{ std::cout<< " --(!) Error reading images " << std::endl; return -1; }

View File

@@ -14,17 +14,17 @@ int main( int argc, char** argv )
}
Mat image;
image = imread(argv[1], CV_LOAD_IMAGE_COLOR); // Read the file
image = imread(argv[1], IMREAD_COLOR); // Read the file
if(! image.data ) // Check for invalid input
if(! image.data ) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl ;
return -1;
}
namedWindow( "Display window", CV_WINDOW_AUTOSIZE );// Create a window for display.
imshow( "Display window", image ); // Show our image inside it.
namedWindow( "Display window", WINDOW_AUTOSIZE ); // Create a window for display.
imshow( "Display window", image ); // Show our image inside it.
waitKey(0); // Wait for a keystroke in the window
waitKey(0); // Wait for a keystroke in the window
return 0;
}

View File

@@ -59,10 +59,10 @@ int main(int argc, char *argv[])
return -1;
}
Size refS = Size((int) captRefrnc.get(CV_CAP_PROP_FRAME_WIDTH),
(int) captRefrnc.get(CV_CAP_PROP_FRAME_HEIGHT)),
uTSi = Size((int) captUndTst.get(CV_CAP_PROP_FRAME_WIDTH),
(int) captUndTst.get(CV_CAP_PROP_FRAME_HEIGHT));
Size refS = Size((int) captRefrnc.get(CAP_PROP_FRAME_WIDTH),
(int) captRefrnc.get(CAP_PROP_FRAME_HEIGHT)),
uTSi = Size((int) captUndTst.get(CAP_PROP_FRAME_WIDTH),
(int) captUndTst.get(CAP_PROP_FRAME_HEIGHT));
if (refS != uTSi)
{
@@ -74,13 +74,13 @@ int main(int argc, char *argv[])
const char* WIN_RF = "Reference";
// Windows
namedWindow(WIN_RF, CV_WINDOW_AUTOSIZE );
namedWindow(WIN_UT, CV_WINDOW_AUTOSIZE );
cvMoveWindow(WIN_RF, 400 , 0); //750, 2 (bernat =0)
cvMoveWindow(WIN_UT, refS.width, 0); //1500, 2
namedWindow(WIN_RF, WINDOW_AUTOSIZE );
namedWindow(WIN_UT, WINDOW_AUTOSIZE );
moveWindow(WIN_RF, 400 , 0); //750, 2 (bernat =0)
moveWindow(WIN_UT, refS.width, 0); //1500, 2
cout << "Frame resolution: Width=" << refS.width << " Height=" << refS.height
<< " of nr#: " << captRefrnc.get(CV_CAP_PROP_FRAME_COUNT) << endl;
<< " of nr#: " << captRefrnc.get(CAP_PROP_FRAME_COUNT) << endl;
cout << "PSNR trigger value " <<
setiosflags(ios::fixed) << setprecision(3) << psnrTriggerValue << endl;
@@ -124,7 +124,7 @@ int main(int argc, char *argv[])
imshow( WIN_RF, frameReference);
imshow( WIN_UT, frameUnderTest);
c = (char)cvWaitKey(delay);
c = (char)waitKey(delay);
if (c == 27) break;
}

View File

@@ -8,6 +8,8 @@
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core/utility.hpp"
#include "opencv2/highgui/highgui_c.h"
#include <iostream>
#include <stdio.h>

View File

@@ -8,6 +8,8 @@
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core/utility.hpp"
#include "opencv2/highgui/highgui_c.h"
#include <iostream>
#include <stdio.h>