I am using win32 api in vc 6 and trying to get an image from my webcam but once i get this image, i want to be able to manipulate the data to convert it and use it for other purposes.
so far my google'ing has come up with a few programs that got images from a webcam but other than that, these do a whole lot more than what i need.
I am using vfw.h (video for windows header) and can start my camera and get an image going without a problem but am not sure where to go to get the actual picture data.
I used the capEditCopy(camhwnd); call to send one frame to the clipboard wher i know i can paste it into programs like paint or word but it has header info and all and i could care less about the header info i just need the image data for analyzing.
I have used teh ddcam dll to get images but like before it has more than what i need.
if anyone can lead me into the right direction then that would be awsome.
thanks in advance.
here is my code so far:
then some normal win32 stuff to create teh window,Code:#include <windows.h> #include <vfw.h> #include "my cam test.h" #pragma comment(lib, "winmm.lib") #pragma comment(lib, "vfw32.lib")
then:
Code:LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HINSTANCE hInstance = GetModuleHandle(NULL); HWND hButtStartCam; HWND hButtStopCam; HWND hButtGetFrame; switch (message) /* handle the messages */ { case WM_CREATE: { hButtStartCam = CreateWindowEx(0,"BUTTON","Start Camera",WS_CHILD | WS_VISIBLE, 0,0,100,20,hwnd,(HMENU)HBUTTSTART,hInstance, 0); hButtStopCam = CreateWindowEx(0,"BUTTON","Stop Camera",WS_CHILD | WS_VISIBLE, 0,50,100,20,hwnd,(HMENU)HBUTTSTOP,hInstance, 0); hButtGetFrame = CreateWindowEx(0,"BUTTON","Get Frame",WS_CHILD | WS_VISIBLE, 0,25,100,20,hwnd,(HMENU)HBUTTFRAME,hInstance, 0); break; } case WM_COMMAND: { switch(LOWORD(wParam)) { case HBUTTSTART: { camhwnd = capCreateCaptureWindow ("camera window", WS_CHILD | WS_VISIBLE, 110, 0, 640, 480, hwnd, 0); capDriverConnect(camhwnd,0); capPreviewRate(camhwnd,300); capPreview(camhwnd,TRUE); break; } case HBUTTSTOP: { capDriverDisconnect(camhwnd); DestroyWindow (camhwnd); break; } case HBUTTFRAME: { //capGrabFrame(camhwnd);//this pauses the video feed in teh current camera hwnd //capEditCopy(camhwnd);///this copies one frame to the clipboard where you can paste it in a image editor //ddcamsaveimage("rawdata.bmp"); break; } } break; } case WM_DESTROY: { PostQuitMessage(0); /* send a WM_QUIT to the message queue */ break; } default: /* for messages that we don't deal with */ return DefWindowProc(hwnd, message, wParam, lParam); } return 0; }



LinkBack URL
About LinkBacks


