#include <stdio.h>
#include <cv.h>
#include <highgui.h>
CvFont font;
IplImage* src = 0;
void main(int argc, char** argv)
{
if( argc == 2 && (src=cvLoadImage(argv[1], 1))!= 0)
{// Create a named window with a the name of the file.
cvNamedWindow( "1.jpg", 1 );
cvNamedWindow( "1", 1 );
// Load the image from the given file name.
// cvLoadImage( "2.jpg" );
//IplImage* dst =0;
// int x= *(src->imageData+280*src->widthStep+30);
// printf("%d",x);
// cvInitFont(&font,CV_FONT_HERSHEY_PLAIN,1.0,1.0,0,2,8);
// cvPutText(src,"H!",cvPoint(380, 30),&font,cvScalar(255,0,0,1));
cvShowImage( "1", src );
// Truncate values above 100.
cvThreshold( src, src,230, 255, CV_THRESH_BINARY);
// Show the image in the named window
cvShowImage( "1.jpg", src );
cvWaitKey(0);
// Idle until the user hits the "Esc" key.
// Clean up and don’t be piggies
cvDestroyWindow( "1.jpg" );
cvReleaseImage( &src );
// cvReleaseImage( &dst );
}
}
评论1
最新资源