[ Download Pattern.pdf ]
2/29/2012
Pattern Image for Camera Calibration
To convert from MyVisionUSB to OpenCV and Display (source code)
This is sample source to convert MyVision USB to OpenCV.
You need MyVision USB library to handle image buffer.
This link is included "MVULib.lib, MVULib.dll, MyVision.h".
Lib Download
And you can download driver file on the http://withrobot.com/157.
The below source is sample code to convert MyVision USB to OpenCV.
This code don't use memcpy. so it is little bit slow. The code needs upgrade to speed up.
#include < stdio.h > #include < cv.h > #include < cxcore.h > #include < highgui.h > #include < cvaux.h > #include "MyVision.h" using namespace std; void main() { ////////////////////////////////////////////////// //MyVisionUSB Setting HBUF m_hBuf; HDIG m_hDig; char* ver = sysGetLibVer(); if(strcmp(ver, MV_LIB_VER) != 0) printf("incorrect library version\n"); m_hBuf = bufAlloc(640,480, MV_RGB32 | MV_DOUBLE); if(!m_hBuf) printf("Cann't Alloc Buffer\n"); m_hDig = digAlloc(MV_DEV0); if(!m_hDig) printf("Cann't Alloc Digitizer"); digGrabContinuous(m_hDig, m_hBuf); RGB32_T** pixel = (RGB32_T**)bufGetPtr2D(m_hBuf); //////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// //OpenCV Setting cvNamedWindow("MyVisionUSBtoOpenCV",CV_WINDOW_AUTOSIZE); IplImage * img = cvCreateImage(cvSize(640,480), 8, 3); int color, R, G, B, c; while(1) { digGrabWait(m_hDig, MV_FIELD_EVEN); for(int i=0; i<480 color="color" for="for" i="i" int="int" j="j" r="RGB32_TO_R(color);" xff0000="xff0000">>16); G = RGB32_TO_G(color); // (((color)&0x00ff00)>>8); B = RGB32_TO_B(color); // (((color)&0x0000ff)); img->imageData[i*img->widthStep+j*3+0] = B; img->imageData[i*img->widthStep+j*3+1] = G; img->imageData[i*img->widthStep+j*3+2] = R; } } cvShowImage("MyVisionUSBtoOpenCV",img); if( cvWaitKey(10) > 0 ) break; } ////////////////////////////////////////////////////////////////////////// //release memory cvReleaseImage(&img); cvDestroyAllWindows(); // digHalt(m_hDig); digFree(m_hDig); bufFree(m_hBuf); } 480>
2/24/2012
Open Cv with Ip Camera (AXIS)
If your Ip camera production is AXIS, download Axis media control sdk on the this web page
http://www.axis.com/techsup/cam_servers/dev/activex.htm
And Install.
Add the axis control on you dlg box.
You can make the AxisMediaControl icon by choose items(right button click on the toolbox menu)->com components tap.
And add the AxisMediaControl on you dlg.
Plase refer to below video clip description of the rest steps. It is very useful video clip.
http://www.youtube.com/watch?v=g6lYJBABWRs&feature=player_detailpage
I am writing left article...
http://www.axis.com/techsup/cam_servers/dev/activex.htm
And Install.
Add the axis control on you dlg box.
You can make the AxisMediaControl icon by choose items(right button click on the toolbox menu)->com components tap.
And add the AxisMediaControl on you dlg.
Plase refer to below video clip description of the rest steps. It is very useful video clip.
http://www.youtube.com/watch?v=g6lYJBABWRs&feature=player_detailpage
I am writing left article...
2/23/2012
(TIP) afxcontrolbars.h - No such file or directory Error!
If you meet this error message "afxcontrolbars.h - No such file or directory...", while complie on the VS C++.
You can solve this problem easily by installing Visual Studio Serviece Pack 1.0.
Download appropriate language version and install.
[vs90 sp1 English]
[vs90 sp1 Korea]
You can solve this problem easily by installing Visual Studio Serviece Pack 1.0.
Download appropriate language version and install.
[vs90 sp1 English]
[vs90 sp1 Korea]
2/15/2012
(TIP) To get Color Information of specific pixel coordinate in the OpenGL
The method is simple to to get Color Information of specific pixel coordinate in the OpenGL is simple.
glReadPixels function enables these task.
The example source code is as follows.
struct{ GLubyte red, green, blue; } pixelColor;
glReadPixels(int(i), int(j), 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &pixelColor);
But the drawback is too slow and we can get exact color information after view rendering.
Thanks.
glReadPixels function enables these task.
The example source code is as follows.
struct{ GLubyte red, green, blue; } pixelColor;
glReadPixels(int(i), int(j), 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &pixelColor);
But the drawback is too slow and we can get exact color information after view rendering.
Thanks.
2/09/2012
To Save OpenGL ViewPort to Image File (glReadPixels, OpenGL->OpenCV)
You can save the Viewport of OpenGL to Image file using glReadPixels function.
And this code is example for saving image file using openCV.
Thank you.
void CaptureViewPort() { GLubyte * bits; //RGB bits GLint viewport[4]; //current viewport //get current viewport glGetIntegerv(GL_VIEWPORT, viewport); int w = viewport[2]; int h = viewport[3]; bits = new GLubyte[w*3*h]; //read pixel from frame buffer glFinish(); //finish all commands of OpenGL glPixelStorei(GL_PACK_ALIGNMENT,1); //or glPixelStorei(GL_PACK_ALIGNMENT,4); glPixelStorei(GL_PACK_ROW_LENGTH, 0); glPixelStorei(GL_PACK_SKIP_ROWS, 0); glPixelStorei(GL_PACK_SKIP_PIXELS, 0); glReadPixels(0, 0, w, h, GL_BGR_EXT, GL_UNSIGNED_BYTE, bits); IplImage * capImg = cvCreateImage( cvSize(w,h), IPL_DEPTH_8U, 3); for(int i=0; i < h; ++i) { for(int j=0; j < w; ++j) { capImg->imageData[i*capImg->widthStep + j*3+0] = (unsigned char)(bits[(h-i-1)*3*w + j*3+0]); capImg->imageData[i*capImg->widthStep + j*3+1] = (unsigned char)(bits[(h-i-1)*3*w + j*3+1]); capImg->imageData[i*capImg->widthStep + j*3+2] = (unsigned char)(bits[(h-i-1)*3*w + j*3+2]); } } cvSaveImage("result.jpg",capImg); cvReleaseImage(&capImg); delete[] bits; }
2/07/2012
(TIP) Check the radio button control / MFC or API
[mfc case]
((CButton*)GetDlgItem(IDC_RADIO))->SetCheck(true);
[api case]
HWND hWnd;
hWnd = ::GetDlgItem(GetSafeHwnd(), IDC_RADIO_NOTIFY_ALL);
::CheckRadioButton(hWnd, IDC_RADIO_NOTIFY_ALL, IDC_RADIO_NOTIFY_CONTENTS, IDC_RADIO_NOTIFY_ALL);
::SendMessage(hWnd, BM_SETCHECK, (WPARAM)BST_CHECKED, NULL);
((CButton*)GetDlgItem(IDC_RADIO))->SetCheck(true);
[api case]
HWND hWnd;
hWnd = ::GetDlgItem(GetSafeHwnd(), IDC_RADIO_NOTIFY_ALL);
::CheckRadioButton(hWnd, IDC_RADIO_NOTIFY_ALL, IDC_RADIO_NOTIFY_CONTENTS, IDC_RADIO_NOTIFY_ALL);
::SendMessage(hWnd, BM_SETCHECK, (WPARAM)BST_CHECKED, NULL);
Subscribe to:
Posts (Atom)
-
The MNIST dataset is a dataset of handwritten digits, comprising 60 000 training examples and 10 000 test examples. The dataset can be downl...
-
Embeded camera R&D for Real-Time fire detection surveillance in tunnel environment - 2008.07.01~2009.06.30 - High Computing Power E...
-
This post is about how to copy Mat data to vector and copy vector data to Mat. Reference this example source code. printf ( "/////...
-
My Environment : MS VS 2008 & MFC(Dialog Based) Joy Stick : Logitech Extreme 3D pro (XBox Type) Cteated Date : 2012. 03 [source code]...
-
RTSP(Real Time Streaming Protocol) is video streaming, it usually sent from network camera. VideoCapture function in opencv also can get r...
-
This is data acquisition source code of LMS511(SICK co.) Source code is made by MFC(vs 2008). The sensor is communicated by TCP/IP. ...
-
I use MOG2 algorithm to background subtraction. The process is resize to small for more fast processing to blur for avoid noise affectio...
-
The latent SVM tells the learning method used in this paper -> "Discriminatively trained deformable part models". The authors s...
-
simply check below code and example result. . def image_grid ( imgs , rows , cols ): assert len ( imgs ) == rows * cols w , h...
-
As you can see in the following video, I created a class that stitching n cameras in real time. https://www.youtube.com/user/feelmare/sear...