[ 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)
-
Logistic Classifier The logistic classifier is similar to equation of the plane. W is weight vector, X is input vector and y is output...
-
Mounting Remote Data for GPU Training This guide explains how to access data from Computer A (data server) on Computer B (GPU machine) for...
-
line, circle, rectangle, ellipse, polyline, fillConvexPoly, putText, drawContours example source code!!. ... //http://study....
-
I once wrote the following article. http://study.marearts.com/2014/04/opencv-study-mat-point-access-method.html This article is a sample c...
-
In past, I wrote an articel about YUV 444, 422, 411 introduction and yuv rgb converting example code. refer to this page -> http://feel...
-
refer to this code: . # If you want to combine a Vision Transformer (ViT) as an encoder with a Transformer-based decoder, # you can follow t...
-
EMD(earth mover distance) method is very good method to compare image similarity. But processing time is slow. For using the EMD compare, ...
-
dp parameter is about resolution of voting space. dp is larger, voting resolution is small compare to image size. so dp is larger, circle...
-
fig 1. Left: set 4 points (Left Top, Right Top, Right Bottom, Left Bottom), right:warped image to (0,0) (300,0), (300,300), (0,300) Fi...
-
Complete Tutorial: LabelMe with Login System and Dataset Management This guide provides step-by-step instructions for setting up LabelMe wit...