http://blog.csdn.net/yang_xian521/article/details/6894716
- IplImage* —— Mat
IplImage* img = cvLoadImage("greatwave.png", 1);
Mat mtx(img);
- Mat ——IplImage*
Mat I;
IplImage* pI = &I.operator IplImage();
另一种更好的调用方式
Mat I;
Ptr<IplImage> piI = &I.operator IplImage();
- Mat——CvMat*
Mat I;
CvMat* mI = &I.operator CvMat();
在将Mat显示到MFC的imageBox 的时候,用到了Mat转化为IplImage*的转化
另外,初始化,利用指针,将其他相机的格式直接转化为Mat,如
camera.StartGrabbing(GrabStrategy_LatestImageOnly, GrabLoop_ProvidedByUser);
CGrabResultPtr ptrGrabResult;
camera.RetrieveResult(3000, ptrGrabResult, TimeoutHandling_ThrowException);
uint32_t width = ptrGrabResult->GetWidth();
uint32_t height = ptrGrabResult->GetHeight();
if (ptrGrabResult->GrabSucceeded())
{
uint8_t *pImageBuffer = (uint8_t *)ptrGrabResult->GetBuffer();
mat.create(height, width, CV_8UC1);
Mat PYLON2CVimg(height, width, CV_8UC1, pImageBuffer, 0); // AUTO_STEP = 0
}
http://blog.csdn.net/yang_xian521/article/details/7107786
===================================================================
#include <pylon/PylonIncludes.h>
#include <pylon/PylonGUI.h>
using namespace Pylon;
using namespace GenApi;
PylonInitialize();
CPylonImage pylonImage;
pylonImage.Load("Pylon_20-55-33.bmp");
cv::Mat openCvImage = cv::Mat(pylonImage.GetHeight(), pylonImage.GetWidth(), CV_8UC1, (uint8_t *)pylonImage.GetBuffer());
.
.
.
PylonTerminate();