+++ /dev/null
-/************************************************************************************\r
-*\r
-*\r
-* This program is demonstration for functions cvFloodFill() and cvFloodFill8()\r
-*\r
-*\r
-* Trackbar specify maximal difference of the values of appurtenant to \r
-* repainted area pixel and one of its neighbors.\r
-*\r
-* Autor: Denis Burenkov\r
-*\r
-*\r
-************************************************************************************/\r
-\r
-char file_name[] = "EXPO0002.bmp";\r
-\r
-char wndname01[] = "Source image";\r
-char wndname02[] = "Result image for cvFloodFill";\r
-char wndname03[] = "Result image for cvFloodFill8";\r
-char barname01[] = "Maximal difference";\r
-int slider_pos[1] = {5};\r
-\r
-CvPoint seed;\r
-CvConnectedComp comp;\r
-\r
-\r
-// Load the source image. HighGUI use.\r
-IPLIMAGE image01 = load_iplimage( file_name );\r
-\r
-if(image01==NULL)\r
-{\r
- printf("File '%s' not found.\n", file_name);\r
- \r
-}\r
-\r
-\r
-// Create the destination images. HighGUI use.\r
-IPLIMAGE image02 = cvCreateImage( cvSize(image01->width,image01->height),\r
- IPL_DEPTH_8U,\r
- 1);\r
-\r
-IPLIMAGE image03 = cvCreateImage( cvSize(image01->width,image01->height),\r
- IPL_DEPTH_8U,\r
- 1);\r
-\r
-\r
-// Make onechannel image. IPL use.\r
-cvCvtColor(image01,image02,CV_BGR2GRAY);\r
-\r
-\r
-// Create windows. HighGUI use.\r
-named_window( wndname01, 0 );\r
-named_window( wndname02, 0 );\r
-\r
-\r
-\r
-// Specify coordinates of the seed point inside the image ROI.\r
-seed.x=200;\r
-seed.y=20;\r
-\r
-\r
-// Define trackbar callback functons. This function make a\r
-// flood filling of connected area of the image.\r
-void on_trackbar_FloodFill( int h )\r
-{\r
-\r
- cvCopyImage(image02 , image03);\r
- \r
- // Flood filling\r
- cvFloodFill( image03, seed, 0, slider_pos[0], slider_pos[0], &comp,4);\r
-\r
- // Show the result image. HighGUI use.\r
- show_iplimage( wndname02, image03 );\r
-\r
-}\r
-\r
-\r
-\r
-\r
-// Create toolbars. HighGUI use.\r
-create_trackbar( barname01, wndname02, &slider_pos[0], 30, on_trackbar_FloodFill );\r
-\r
-\r
-\r
-on_trackbar_FloodFill(0);\r
-\r
-\r
-\r
-// Show the source image. HighGUI use.\r
-show_iplimage( wndname01, image02 );\r
-\r
-\r
-// Wait for a key stroke; the same function arranges events processing \r
-wait_key(0);\r
-cvReleaseImage(&image01);\r
-cvReleaseImage(&image02);\r
-cvReleaseImage(&image03);\r
-\r
-\r
-destroy_window(wndname01);\r
-destroy_window(wndname02);\r