static int resize_test()
{
    IplImage* src = load_iplimage( "d:/user/vp/archive/art/greatwave.jpg" );
    IplImage* image = cvCreateImage( cvGetSize( src ), 8, 1 );

    cvCvtColor( src, image, CV_BGR2GRAY );

    named_window( "image", 1 );
    show_iplimage( "image", image );
    wait_key( 0 );

    named_window( "result", 1 );

    for( int i = 0; i < 30; i++ )
    {
        IplImage* dst = cvCreateImage(
            cvSize( (rand() % 1000) + 1, (rand() % 1000) + 1),
            8, image->nChannels );

        cvResize( image, dst, CV_INTER_LINEAR );
        show_iplimage( "result", dst );

        wait_key_ex( 0, 1000 );
        cvReleaseImage( &dst );
    }

    cvReleaseImage( &image );
    destroy_window( "image" );
    destroy_window( "result" );

    return  CV_OK;
}
Beispiel #2
0
************************************************************************************/

char file_name[] = "EXPO0002.bmp";

char wndname01[] = "Source image";
char wndname02[] = "Result image for cvFloodFill";
char wndname03[] = "Result image for cvFloodFill8";
char barname01[] = "Maximal difference";
int slider_pos[1] = {5};

CvPoint seed;
CvConnectedComp comp;


// Load the source image. HighGUI use.
IPLIMAGE image01 = load_iplimage( file_name );

if(image01==NULL)
{
    printf("File '%s' not found.\n", file_name);

}


// Create the destination images. HighGUI use.
IPLIMAGE image02 = cvCreateImage( cvSize(image01->width,image01->height),
                                  IPL_DEPTH_8U,
                                  1);

IPLIMAGE image03 = cvCreateImage( cvSize(image01->width,image01->height),
                                  IPL_DEPTH_8U,
Beispiel #3
0
#define NUMBER 50
char wndname[] = "Primitives";
int i;

// Load the source image
IPLIMAGE image = load_iplimage("headband.bmp");


// Create a window
named_window(wndname, 0);
show_iplimage(wndname,image);

srand(11111);
CvPoint pt1,pt2;

for (i = 0; i< NUMBER; i++)
{
pt1.x=rand()/80;
pt1.y=rand()/80;
pt2.x=rand()/80;
pt2.y=rand()/80;

cvLine( image,pt1, pt2,
CV_RGB(rand()/100,rand()/100,rand()/100), rand()/3000, 8 );
show_iplimage(wndname,image);
}

for (i = 0; i< NUMBER; i++)
{
pt1.x=rand()/80;
pt1.y=rand()/80;
Beispiel #4
0
char wndname[] = "Distance transform";
char tbarname[] = "Threshold";
int edge_thresh = 1;

// Load the source image
IPLIMAGE image = load_iplimage( "y2k.bmp" );

// Create the output image
IPLIMAGE dist = cvCreateImage( cvSize( image -> width, image -> height ), IPL_DEPTH_32F, 1 );
IPLIMAGE dist8u1 = cvCreateImage( cvSize( image -> width, image -> height ), IPL_DEPTH_8U, 1 );
IPLIMAGE dist8u2 = cvCreateImage( cvSize( image -> width, image -> height ), IPL_DEPTH_8U, 1 );
IPLIMAGE dist8u = cvCreateImage( cvSize( image -> width, image -> height ), IPL_DEPTH_8U, 3 ); // Converted depth32f to depth8u
IPLIMAGE dist32s = cvCreateImage( cvSize( image -> width, image -> height ), IPL_DEPTH_32S, 1 );

// Convert to grayscale
IPLIMAGE gray = cvCreateImage( cvSize(image->width, image->height), IPL_DEPTH_8U, 1 );
IPLIMAGE edge = cvCreateImage( cvSize(image->width, image->height), IPL_DEPTH_8U, 1 ); // After Threshold
cvCvtColor( image, gray, CV_BGR2GRAY );

// define a trackbar callback
void on_trackbar( int h )
{
    int j;
    int distStep = dist -> widthStep / 4;
    float* currPointer;
    
    cvThreshold( gray, edge,
                 ( float )( edge_thresh ),
                 ( float )( edge_thresh ),
                  CV_THRESH_BINARY );
    //Distance transform