Applied all fixes related to translating C to C++ code
Also fixed some typos and code alignment Also adapted tutorial CPP samples Fixed some identation problems
This commit is contained in:
@@ -24,17 +24,14 @@ Mat image;
|
||||
*/
|
||||
static void on_trackbar( int, void* )
|
||||
{
|
||||
Mat new_image = Mat::zeros( image.size(), image.type() );
|
||||
Mat new_image = Mat::zeros( image.size(), image.type() );
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
imshow("New Image", new_image);
|
||||
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 );
|
||||
|
||||
imshow("New Image", new_image);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -31,14 +31,14 @@ int main( int, char** argv )
|
||||
}
|
||||
|
||||
/// Convert to grayscale
|
||||
cvtColor( src, src, CV_BGR2GRAY );
|
||||
cvtColor( src, src, COLOR_BGR2GRAY );
|
||||
|
||||
/// Apply Histogram Equalization
|
||||
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 );
|
||||
|
@@ -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";
|
||||
|
@@ -28,7 +28,7 @@ int main( int, char** argv )
|
||||
/// Read the image
|
||||
src = imread( argv[1], 1 );
|
||||
/// Transform it to HSV
|
||||
cvtColor( src, hsv, CV_BGR2HSV );
|
||||
cvtColor( src, hsv, COLOR_BGR2HSV );
|
||||
|
||||
/// Use only the Hue value
|
||||
hue.create( hsv.size(), hsv.depth() );
|
||||
@@ -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);
|
||||
|
||||
|
@@ -31,10 +31,10 @@ int main( int, char** argv )
|
||||
/// Read the image
|
||||
src = imread( argv[1], 1 );
|
||||
/// Transform it to HSV
|
||||
cvtColor( src, hsv, CV_BGR2HSV );
|
||||
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
|
||||
|
@@ -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);
|
||||
|
@@ -22,24 +22,25 @@ int main( int argc, char** argv )
|
||||
Mat src_test2, hsv_test2;
|
||||
Mat hsv_half_down;
|
||||
|
||||
/// Load three images with different environment settings
|
||||
if( argc < 4 )
|
||||
{ printf("** Error. Usage: ./compareHist_Demo <image_settings0> <image_setting1> <image_settings2>\n");
|
||||
return -1;
|
||||
}
|
||||
/// Load three images with different environment settings
|
||||
if( argc < 4 )
|
||||
{
|
||||
printf("** Error. Usage: ./compareHist_Demo <image_settings0> <image_setting1> <image_settings2>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
src_base = imread( argv[1], 1 );
|
||||
src_test1 = imread( argv[2], 1 );
|
||||
src_test2 = imread( argv[3], 1 );
|
||||
src_base = imread( argv[1], 1 );
|
||||
src_test1 = imread( argv[2], 1 );
|
||||
src_test2 = imread( argv[3], 1 );
|
||||
|
||||
/// Convert to HSV
|
||||
cvtColor( src_base, hsv_base, CV_BGR2HSV );
|
||||
cvtColor( src_test1, hsv_test1, CV_BGR2HSV );
|
||||
cvtColor( src_test2, hsv_test2, CV_BGR2HSV );
|
||||
/// Convert to HSV
|
||||
cvtColor( src_base, hsv_base, COLOR_BGR2HSV );
|
||||
cvtColor( src_test1, hsv_test1, COLOR_BGR2HSV );
|
||||
cvtColor( src_test2, hsv_test2, COLOR_BGR2HSV );
|
||||
|
||||
hsv_half_down = hsv_base( Range( hsv_base.rows/2, hsv_base.rows - 1 ), Range( 0, hsv_base.cols - 1 ) );
|
||||
hsv_half_down = hsv_base( Range( hsv_base.rows/2, hsv_base.rows - 1 ), Range( 0, hsv_base.cols - 1 ) );
|
||||
|
||||
/// Using 30 bins for hue and 32 for saturation
|
||||
/// Using 30 bins for hue and 32 for saturation
|
||||
int h_bins = 50; int s_bins = 60;
|
||||
int histSize[] = { h_bins, s_bins };
|
||||
|
||||
@@ -74,14 +75,15 @@ int main( int argc, char** argv )
|
||||
|
||||
/// Apply the histogram comparison methods
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{ int compare_method = i;
|
||||
double base_base = compareHist( hist_base, hist_base, compare_method );
|
||||
double base_half = compareHist( hist_base, hist_half_down, compare_method );
|
||||
double base_test1 = compareHist( hist_base, hist_test1, compare_method );
|
||||
double base_test2 = compareHist( hist_base, hist_test2, compare_method );
|
||||
{
|
||||
int compare_method = i;
|
||||
double base_base = compareHist( hist_base, hist_base, compare_method );
|
||||
double base_half = compareHist( hist_base, hist_half_down, compare_method );
|
||||
double base_test1 = compareHist( hist_base, hist_test1, compare_method );
|
||||
double base_test2 = compareHist( hist_base, hist_test2, compare_method );
|
||||
|
||||
printf( " Method [%d] Perfect, Base-Half, Base-Test(1), Base-Test(2) : %f, %f, %f, %f \n", i, base_base, base_half , base_test1, base_test2 );
|
||||
}
|
||||
printf( " Method [%d] Perfect, Base-Half, Base-Test(1), Base-Test(2) : %f, %f, %f, %f \n", i, base_base, base_half , base_test1, base_test2 );
|
||||
}
|
||||
|
||||
printf( "Done \n" );
|
||||
|
||||
|
@@ -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",
|
||||
|
@@ -39,20 +39,20 @@ 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 );
|
||||
|
||||
/// Create Trackbar to select kernel type
|
||||
createTrackbar( "Element:\n 0: Rect - 1: Cross - 2: Ellipse", window_name,
|
||||
&morph_elem, max_elem,
|
||||
Morphology_Operations );
|
||||
&morph_elem, max_elem,
|
||||
Morphology_Operations );
|
||||
|
||||
/// Create Trackbar to choose kernel size
|
||||
createTrackbar( "Kernel size:\n 2n +1", window_name,
|
||||
&morph_size, max_kernel_size,
|
||||
Morphology_Operations );
|
||||
&morph_size, max_kernel_size,
|
||||
Morphology_Operations );
|
||||
|
||||
/// Default start
|
||||
Morphology_Operations( 0, 0 );
|
||||
|
@@ -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
|
||||
|
@@ -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 );
|
||||
|
@@ -37,19 +37,19 @@ int main( int, char** argv )
|
||||
src = imread( argv[1], 1 );
|
||||
|
||||
/// Convert the image to Gray
|
||||
cvtColor( src, src_gray, CV_RGB2GRAY );
|
||||
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,
|
||||
window_name, &threshold_type,
|
||||
max_type, Threshold_Demo );
|
||||
window_name, &threshold_type,
|
||||
max_type, Threshold_Demo );
|
||||
|
||||
createTrackbar( trackbar_value,
|
||||
window_name, &threshold_value,
|
||||
max_value, Threshold_Demo );
|
||||
window_name, &threshold_value,
|
||||
max_value, Threshold_Demo );
|
||||
|
||||
/// Call the function to initialize
|
||||
Threshold_Demo( 0, 0 );
|
||||
|
@@ -58,10 +58,10 @@ int main( int, char** argv )
|
||||
dst.create( src.size(), src.type() );
|
||||
|
||||
/// Convert the image to grayscale
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
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 );
|
||||
|
@@ -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
|
||||
|
@@ -25,7 +25,7 @@ int main(int, char** argv)
|
||||
{ return -1; }
|
||||
|
||||
/// Convert it to gray
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
|
||||
/// Reduce the noise so we avoid false circle detection
|
||||
GaussianBlur( src_gray, src_gray, Size(9, 9), 2, 2 );
|
||||
@@ -47,7 +47,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);
|
||||
|
@@ -46,7 +46,7 @@ int main( int, char** argv )
|
||||
}
|
||||
|
||||
/// Pass the image to gray
|
||||
cvtColor( src, src_gray, CV_RGB2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_RGB2GRAY );
|
||||
|
||||
/// Apply Canny edge detector
|
||||
Canny( src_gray, edges, 50, 200, 3 );
|
||||
@@ -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
|
||||
|
@@ -34,10 +34,10 @@ int main( int, char** argv )
|
||||
GaussianBlur( src, src, Size(3,3), 0, 0, BORDER_DEFAULT );
|
||||
|
||||
/// Convert the image to grayscale
|
||||
cvtColor( src, src_gray, CV_RGB2GRAY );
|
||||
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;
|
||||
|
@@ -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(;;)
|
||||
|
@@ -33,10 +33,10 @@ int main( int, char** argv )
|
||||
GaussianBlur( src, src, Size(3,3), 0, 0, BORDER_DEFAULT );
|
||||
|
||||
/// Convert it to gray
|
||||
cvtColor( src, src_gray, CV_RGB2GRAY );
|
||||
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;
|
||||
|
@@ -43,7 +43,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);
|
||||
|
@@ -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 );
|
||||
|
@@ -30,12 +30,12 @@ int main( int, char** argv )
|
||||
src = imread( argv[1], 1 );
|
||||
|
||||
/// Convert image to gray and blur it
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
blur( src_gray, src_gray, Size(3,3) );
|
||||
|
||||
/// 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 );
|
||||
}
|
||||
|
@@ -30,12 +30,12 @@ int main( int, char** argv )
|
||||
src = imread( argv[1], 1 );
|
||||
|
||||
/// Convert image to gray and blur it
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
blur( src_gray, src_gray, Size(3,3) );
|
||||
|
||||
/// 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 );
|
||||
}
|
||||
|
@@ -30,12 +30,12 @@ int main( int, char** argv )
|
||||
src = imread( argv[1], 1 );
|
||||
|
||||
/// Convert image to gray and blur it
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
blur( src_gray, src_gray, Size(3,3) );
|
||||
|
||||
/// 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 );
|
||||
}
|
||||
|
@@ -30,12 +30,12 @@ int main( int, char** argv )
|
||||
src = imread( argv[1], 1 );
|
||||
|
||||
/// Convert image to gray and blur it
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
blur( src_gray, src_gray, Size(3,3) );
|
||||
|
||||
/// 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 );
|
||||
@@ -62,7 +62,7 @@ void thresh_callback(int, void* )
|
||||
findContours( threshold_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );
|
||||
|
||||
/// Find the convex hull object for each contour
|
||||
vector<vector<Point> >hull( contours.size() );
|
||||
vector<vector<Point> >hull( contours.size() );
|
||||
for( size_t i = 0; i < contours.size(); i++ )
|
||||
{ convexHull( Mat(contours[i]), hull[i], false ); }
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
@@ -30,12 +30,12 @@ int main( int, char** argv )
|
||||
src = imread( argv[1], 1 );
|
||||
|
||||
/// Convert image to gray and blur it
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
blur( src_gray, src_gray, Size(3,3) );
|
||||
|
||||
/// 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
|
||||
|
@@ -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);
|
||||
|
@@ -40,7 +40,7 @@ int main( int, char** argv )
|
||||
{
|
||||
/// Load source image and convert it to gray
|
||||
src = imread( argv[1], 1 );
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
|
||||
/// Set some parameters
|
||||
int blockSize = 3; int apertureSize = 3;
|
||||
@@ -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 );
|
||||
|
||||
|
@@ -31,10 +31,10 @@ int main( int, char** argv )
|
||||
{
|
||||
/// Load source image and convert it to gray
|
||||
src = imread( argv[1], 1 );
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
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 );
|
||||
}
|
||||
|
@@ -32,10 +32,10 @@ int main( int, char** argv )
|
||||
{
|
||||
/// Load source image and convert it to gray
|
||||
src = imread( argv[1], 1 );
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
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 );
|
||||
|
||||
/// Set the neeed parameters to find the refined corners
|
||||
|
@@ -32,10 +32,10 @@ int main( int, char** argv )
|
||||
{
|
||||
/// Load source image and convert it to gray
|
||||
src = imread( argv[1], 1 );
|
||||
cvtColor( src, src_gray, CV_BGR2GRAY );
|
||||
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,6 +87,6 @@ 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 );
|
||||
}
|
||||
|
@@ -294,7 +294,7 @@ int main(int argc, char* argv[])
|
||||
if( s.calibrationPattern == Settings::CHESSBOARD)
|
||||
{
|
||||
Mat viewGray;
|
||||
cvtColor(view, viewGray, CV_BGR2GRAY);
|
||||
cvtColor(view, viewGray, COLOR_BGR2GRAY);
|
||||
cornerSubPix( viewGray, pointBuf, Size(11,11),
|
||||
Size(-1,-1), TermCriteria( CV_TERMCRIT_EPS+CV_TERMCRIT_ITER, 30, 0.1 ));
|
||||
}
|
||||
|
@@ -56,7 +56,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
|
||||
|
@@ -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);
|
||||
|
@@ -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 );
|
||||
|
@@ -45,7 +45,7 @@ int main( int argc, char** argv )
|
||||
|
||||
// convert image to YUV color space. The output image will be created automatically.
|
||||
Mat I_YUV;
|
||||
cvtColor(I, I_YUV, CV_BGR2YCrCb);
|
||||
cvtColor(I, I_YUV, COLOR_BGR2YCrCb);
|
||||
|
||||
vector<Mat> planes; // Use the STL's vector structure to store multiple Mat objects
|
||||
split(I_YUV, planes); // split the image into separate color planes (Y U V)
|
||||
@@ -117,7 +117,7 @@ int main( int argc, char** argv )
|
||||
cvtColor(I_YUV, I, CV_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
|
||||
|
@@ -30,8 +30,8 @@ int main( int argc, char* argv[])
|
||||
else
|
||||
I = imread( filename, CV_LOAD_IMAGE_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();
|
||||
@@ -42,7 +42,7 @@ int main( int argc, char* argv[])
|
||||
cout << "Hand written function times passed in seconds: " << t << endl;
|
||||
|
||||
imshow("Output", J);
|
||||
cvWaitKey(0);
|
||||
waitKey(0);
|
||||
|
||||
Mat kern = (Mat_<char>(3,3) << 0, -1, 0,
|
||||
-1, 5, -1,
|
||||
@@ -54,7 +54,7 @@ int main( int argc, char* argv[])
|
||||
|
||||
imshow("Output", K);
|
||||
|
||||
cvWaitKey(0);
|
||||
waitKey(0);
|
||||
return 0;
|
||||
}
|
||||
void Sharpen(const Mat& myImage,Mat& Result)
|
||||
|
@@ -95,8 +95,8 @@ int main( int argc, char** argv )
|
||||
|
||||
//-- Get the corners from the image_1 ( the object to be "detected" )
|
||||
std::vector<Point2f> obj_corners(4);
|
||||
obj_corners[0] = cvPoint(0,0); obj_corners[1] = cvPoint( img_object.cols, 0 );
|
||||
obj_corners[2] = cvPoint( img_object.cols, img_object.rows ); obj_corners[3] = cvPoint( 0, img_object.rows );
|
||||
obj_corners[0] = Point(0,0); obj_corners[1] = Point( img_object.cols, 0 );
|
||||
obj_corners[2] = Point( img_object.cols, img_object.rows ); obj_corners[3] = Point( 0, img_object.rows );
|
||||
std::vector<Point2f> scene_corners(4);
|
||||
|
||||
perspectiveTransform( obj_corners, scene_corners, H);
|
||||
|
@@ -22,7 +22,7 @@ int main( int argc, char** argv )
|
||||
return -1;
|
||||
}
|
||||
|
||||
namedWindow( "Display window", CV_WINDOW_AUTOSIZE );// Create a window for display.
|
||||
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
|
||||
|
@@ -74,10 +74,10 @@ 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;
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -30,7 +30,7 @@ RNG rng(12345);
|
||||
*/
|
||||
int main( void )
|
||||
{
|
||||
CvCapture* capture;
|
||||
VideoCapture capture;
|
||||
Mat frame;
|
||||
|
||||
//-- 1. Load the cascades
|
||||
@@ -38,12 +38,12 @@ int main( void )
|
||||
if( !eyes_cascade.load( eyes_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; };
|
||||
|
||||
//-- 2. Read the video stream
|
||||
capture = cvCaptureFromCAM( -1 );
|
||||
if( capture )
|
||||
capture.open( -1 );
|
||||
if( capture.isOpened() )
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
frame = cvQueryFrame( capture );
|
||||
capture >> frame;
|
||||
|
||||
//-- 3. Apply the classifier to the frame
|
||||
if( !frame.empty() )
|
||||
@@ -67,7 +67,7 @@ void detectAndDisplay( Mat frame )
|
||||
std::vector<Rect> faces;
|
||||
Mat frame_gray;
|
||||
|
||||
cvtColor( frame, frame_gray, CV_BGR2GRAY );
|
||||
cvtColor( frame, frame_gray, COLOR_BGR2GRAY );
|
||||
equalizeHist( frame_gray, frame_gray );
|
||||
//-- Detect faces
|
||||
face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) );
|
||||
|
@@ -30,7 +30,7 @@ RNG rng(12345);
|
||||
*/
|
||||
int main( void )
|
||||
{
|
||||
CvCapture* capture;
|
||||
VideoCapture capture;
|
||||
Mat frame;
|
||||
|
||||
//-- 1. Load the cascade
|
||||
@@ -38,12 +38,12 @@ int main( void )
|
||||
if( !eyes_cascade.load( eyes_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; };
|
||||
|
||||
//-- 2. Read the video stream
|
||||
capture = cvCaptureFromCAM( -1 );
|
||||
if( capture )
|
||||
capture.open( -1 );
|
||||
if( capture.isOpened() )
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
frame = cvQueryFrame( capture );
|
||||
capture >> frame;
|
||||
|
||||
//-- 3. Apply the classifier to the frame
|
||||
if( !frame.empty() )
|
||||
@@ -67,7 +67,7 @@ void detectAndDisplay( Mat frame )
|
||||
std::vector<Rect> faces;
|
||||
Mat frame_gray;
|
||||
|
||||
cvtColor( frame, frame_gray, CV_BGR2GRAY );
|
||||
cvtColor( frame, frame_gray, COLOR_BGR2GRAY );
|
||||
equalizeHist( frame_gray, frame_gray );
|
||||
|
||||
//-- Detect faces
|
||||
|
Reference in New Issue
Block a user