Ask Your Question

Dean Feng's profile - activity

2019-11-15 07:38:25 -0500 received badge  Notable Question (source)
2019-01-07 08:46:51 -0500 received badge  Famous Question (source)
2018-06-06 03:42:28 -0500 received badge  Popular Question (source)
2018-05-22 10:08:34 -0500 received badge  Notable Question (source)
2018-05-22 10:08:34 -0500 received badge  Popular Question (source)
2016-11-28 01:01:38 -0500 commented question I am not able to download the opencv software for windows. How can I download it? It is very urgent for me.

Maybe close your security software.

2016-11-23 18:54:25 -0500 commented answer no module named cv2 in Pycharm

No,I have python 2.7 installed only.

2016-11-23 00:04:00 -0500 received badge  Editor (source)
2016-11-22 22:39:39 -0500 asked a question no module named cv2 in Pycharm

image description

I have put the cv2.pyd into C:\Python27\Lib\site-packages,but Pycharm can not find this module. And can use opencv normally.

Maybe It's did't install by pip.

How can I solve this problem?

OpenCV Version: 3.0.0
Pycharm Version: Conmunity Edition 2016.2.3
OS : Windows 7 64bit

2016-07-19 23:20:53 -0500 commented answer Problem: draw a image using OpenCV 2.3.1 in MFC application

@Andy why it does not work?

2016-07-19 23:20:08 -0500 received badge  Critic (source)
2016-07-18 19:40:25 -0500 commented question How can I show a OpenCV image in a dialog of MFC.

@kbarni thanks for your reply,I will check the forum for this quesition.

2016-07-17 21:35:20 -0500 commented question Opencv 3.1 build error

opencv_cudaobjdetect310d.lib is just for debug.

2016-07-17 21:29:01 -0500 received badge  Autobiographer
2016-07-17 20:43:35 -0500 asked a question How can I show a OpenCV image in a dialog of MFC.

The type of cv image is cv::mat. And there is a PictureControl in dialog, or any other control, (just for show image). There picture is a BMP file (512 *1024). I load it by "Mat img=imread("path")" , then do some processing by Opencv. And I want a good method to show it, it should not spend a lot of time (Should be less than 1ms). I have tried some methods as follows.

Method 1:

IplImage simg = src;
cvNamedWindow("IDC_STATIC_OUTPUT", 0);
cvResizeWindow("IDC_STATIC_OUTPUT", rect.Width, rect.Height);
HWND hWnd = (HWND)cvGetWindowHandle("IDC_STATIC_OUTPUT");
HWND hParent = ::GetParent(hWnd);
::SetParent(hWnd, GetDlgItem(IDC_PictureBox)->m_hWnd);
::ShowWindow(hParent, SW_HIDE);
cvShowImage("IDC_STATIC_OUTPUT", &simg);

Problem of this method: There is a flashing window out of dialog, and the running speed is slow.

Method 2: Use a function,

int Mat2CImage(Mat *mat, CImage &img){
if (!mat || mat->empty())
    return -1;
int nBPP = mat->channels() * 8;
img.Create(mat->cols, mat->rows, nBPP);
if (nBPP == 8)
    static RGBQUAD pRGB[256];
    for (int i = 0; i < 256; i++)
        pRGB[i].rgbBlue = pRGB[i].rgbGreen = pRGB[i].rgbRed = i;
    img.SetColorTable(0, 256, pRGB);
uchar* psrc = mat->data;
uchar* pdst = (uchar*)img.GetBits();
int imgPitch = img.GetPitch();
for (int y = 0; y < mat->rows; y++)
    memcpy(pdst, psrc, mat->cols*mat->channels());//mat->step is incorrect for those images created by roi (sub-images!)
    psrc += mat->step;
    pdst += imgPitch;

return 0;


Problem: The speed of update is slow (Perhaps I used it in a wrong way).And running speed also slow (maybe because piex by piex).

Method 3: Also a function. link text

Problem: I can not use that function normally.Cannot display pictures.

2016-07-17 08:59:16 -0500 received badge  Enthusiast
2016-07-06 02:10:03 -0500 commented question How can I detect a Cable in a iamge or video?

@pklab Hi,the iamge is a sample. it may be inclined.

2016-07-01 02:05:35 -0500 commented question How can I detect a Cable in a iamge or video?

This is original image (taken from camera). and thanks for your comments.@pklab @LarryR You helped me a lot,thank you very much.

2016-06-29 04:14:17 -0500 received badge  Supporter (source)
2016-06-28 23:59:27 -0500 asked a question How can I detect a Cable in a iamge or video?

Photos taken from the camera. It maybe a gray iamge. And I want detect the object in green rectangle. I want a fast and accurate algorithms.I mean that I will detect it Real-time. Can you help me?image description