资源描述:
《opencv 实现的椭圆检测的源代码》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、1.// readbmp.cpp : Defines the entry point for the console application. 2.// 3. 4.#include "stdafx.h" 5.#include 6. 7.#include "ipl.h" 8.#include "cv.h" 9.//#include "_cv.h" 10.//#include "vlgrfmts.h" 11. 12.//------------------------
2、----- 13.////////UTILITY FUNCTIONS 14.// 15.// Read in a BMP and convert it into an IPL 16.// fin The file name of the BMP with path 17.// plannar If set, convert the image to plannar 18.// flip If set, mirror the image around the horizontal axis, set 19.
3、// IPL_ORIGIN_BL) 20.IplImage * readBMP2IPL(char *fin, int plannar = 0, int flip = 0) 21.{ 22. int filter; 23. int width=0,height=0,color=55,hdr_ret=0,close_ret = 0,rd_ret = 0; 24. IplImage *I; 25. filter = gr_fmt_find_filter(fin ); //Get file t
4、ype 26. hdr_ret = gr_fmt_read_header( filter, &width, &height, &color );//image params 27. I = cvCreateImageHeader( cvSize(width, height), IPL_DEPTH_8U, 3); //create image header 28. I->align = IPL_ALIGN_QWORD; //fix the problem that cvCreateImage uses a
5、lign 4 29. I->depth != IPL_DEPTH_32F ? iplAllocateImage( I, 0, 0 ) :iplAllocateImageFP( I, 0, 0 ); 30. rd_ret = gr_fmt_read_data(filter, I->imageData, I->widthStep, color); //read in the data, origin TL 31. close_ret = gr_fmt_close_filter( filter ); 32
6、. if(plannar) //If plannar order desired, turn it into plannar order 33. { 34. IplImage *Ip = iplCreateImageHeader(3, 0, IPL_DEPTH_8U, "RGB","BGR", IPL_DATA_ORDER_PLANE, I->origin, IPL_ALIGN_QWORD, width, height, NULL,NULL,NULL,NULL); 35. iplA
7、llocateImage(Ip, 0,0); 36. iplConvert(I,Ip); 37. cvReleaseImage( &I ); otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrga
8、nization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStat