Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* HISTOGRAM GENERATOR FOR 16BIT 1 CHANNEL GRAYSCALE PNG IMAGE */
- #include "cv.h"
- #include "highgui.h"
- #include <stdio.h>
- void main(void)
- {
- /* creates a window */
- cvNamedWindow( "WINDOW", CV_WINDOW_AUTOSIZE );
- /* load the image */
- IplImage *frame = cvLoadImage( "patternfile16bit.png", CV_LOAD_IMAGE_ANYDEPTH );
- /* print some properties */
- printf( "# channels: %d\n", frame->nChannels );
- printf( "Pixel depth: %d bits\n", frame->depth );
- printf( "width: %d pixels\n", frame->width );
- printf( "height: %d pixels\n", frame->height );
- printf( "Image size: %d bytes\n", frame->imageSize );
- printf( "Width step: %d bytes\n", frame->widthStep );
- /* infinite loop */
- while(1)
- {
- /* new image derived from the old one */
- IplImage *frame2 = cvCreateImage(cvGetSize(frame),IPL_DEPTH_16U,1);
- /* show the old image */
- cvShowImage( "WINDOW", frame );
- /* show the derived one */
- cvShowImage( "WINDOW", frame2 );
- cvReleaseImage(&frame);
- cvReleaseImage(&frame2);
- /*exit if ESC pressed */
- if ( (cvWaitKey(10) & 255) == 27 ) break;
- }
- return(0);
- }
- ///// CONSOLE OUTPUT //////////////////////////////////////////////////////////////
- # channels: 1
- Pixel depth: 16 bits
- width: 512 pixels
- height: 512 pixels
- Image size: 524288 bytes
- Width step: 1024 bytes
- OpenCV Error: Bad argument (Array should be CvMat or IplImage) in unknown functi
- on, file ..\..\..\..\ocv\opencv\src\cxcore\cxarray.cpp, line 1233
- Process returned -529697949 (0xE06D7363) execution time : 2.422 s
- Press any key to continue.
- ////// END OF CONSOLE OUTPUT ///////////////////////////////////////////////////////
Add Comment
Please, Sign In to add comment