cv::mat in mfc
how can u display cv::mat in mfc? i tried finding the answer in google but was unsucessful i'll apperciate any help also is there a opencv gui making prog other than qt and mfc
how can u display cv::mat in mfc? i tried finding the answer in google but was unsucessful i'll apperciate any help also is there a opencv gui making prog other than qt and mfc
try list:
int ShowMat( cv::Mat img, HWND hWndDisplay )
{
if (img.channels()<3 )
{
return -1;
}
RECT rect;
GetClientRect(hWndDisplay, &rect);
cv::Mat imgShow( abs(rect.top - rect.bottom), abs(rect.right - rect.left), CV_8UC3 );
resize( img, imgShow, imgShow.size() );
ATL::CImage CI;
int w=imgShow.cols;//宽
int h=imgShow.rows;//高
int channels=imgShow.channels();//通道数
CI.Create( w, h, 8*channels);
uchar *pS;
uchar *pImg=(uchar *)CI.GetBits();//得到CImage数据区地址
int step=CI.GetPitch();
for(int i=0;i<h;i++)
{
pS=imgShow.ptr<uchar>(i);
for(int j=0;j<w;j++)
{
for(int k=0;k<3;k++)
*(pImg+i*step+j*3+k)=pS[j*3+k];
//注意到这里的step不用乘以3
}
}
HDC dc ;
dc = GetDC( hWndDisplay );
CI.Draw( dc, 0, 0 );
ReleaseDC( hWndDisplay, dc);
CI.Destroy();
return 0;
}
Asked: 2013-05-11 06:48:21 -0600
Seen: 2,046 times
Last updated: Jun 10 '19
Opencv java - Load image to GUI
Error OpenCV with Windows Application - Urgent Please [closed]
How to do OpenCV in Windows Application?
Advice to create GUI for OpenCV app
new to opencv python and clarification on certain things
Qt backend GUI - Qt5, VS2012, Windows7/8
Is it possible to get function and method documentation programmatically?
GUI for OpenCV in Linux [closed]
linux QT cvFindContour + opengl screen too much light freeze the gui