190 likes | 315 Views
Web Cam System Development Kit. Drew Demerath http://compsci.snc.edu/cs460/demedm. Project Description. Develop a packaged system development kit that provides easy access to common web cam services Requirements: Able to work in C++ and Visual BASIC Used across the curriculum
E N D
Web Cam System Development Kit Drew Demerath http://compsci.snc.edu/cs460/demedm
Project Description • Develop a packaged system development kit that provides easy access to common web cam services • Requirements: • Able to work in C++ and Visual BASIC • Used across the curriculum • Add new and exciting features
Project Description Cont. • First I received the Logitech QuickCam Pro 3000 • Went off of previously written code • Dove into the project…(BIG MISTAKE) • Started over, but first understood the process of the camera • Developed a laundry list of features for the camera
Project Description Cont. • Issues I did not solve: • Adjusting gain and camera zoom • Save image as .jpg • Capturing frame and showing it before saving the image • Allow for multiple cameras
How The Camera Functions • Process of developing camera image: 1) Camera driver calls framecallback code 2) Framecallback either manipulates the data or leaves it alone 3) Image is then put back into memory 4) User sees the image on the screen
Sends Image Framecallback B & W Set Pixel Get Frame User Call Back Sends Manipulated Image
A Further Look Into Framecallback… • Framecallback is the function that the camera driver calls. This can be set to a designated function, such as a user function • It can manipulate the data of the image or just leave the image alone • First it builds a global array of raw bytes, called VideoData. • Each pixel is composed of Red, Green, Blue
Blue Green Red Blue Green VideoData
What Now?? • Global variable called ddcamcmd • Represented by a string of 0’s: 00000000 • Manipulation may begin now by setting “flags” or 0’s within ddcamcmd • Black and white 00000001 • Setting a pixel 00000010 • Getting a single frame 00000100 • Calling a user-defined callback 00001000
Multi-Processing • Another way to access the data?? • There are functions that do not depend upon the framecallback. • So in an essence, I have multi- processing occurring. • One is processing the framecallback and the other is processing the “non-framecallback” functions.
For Example… • To open and close the camera, does not deal with the framecallback. • Setting the preview rate • Resizing the camera • Saving an image • Interesting problem and solution here • Setting a pixel and getting a pixel
How “Non-Framecallback” Works • Open, Close, Preview Rate, and Resize • Calls pre-defined Macros • Save, Set and Get Pixel • Uses global variable VideoData
How Did I Do This? • Best learning technique • Experimentation • Previous classes…especially CS225: Machine Organization and Assembly Language • CS370: Operating Systems • CS professors • Windows programming
Extensions • Save image as .jpg • Allow user to see the frame they want to save, before saving it • Allow for multiple cameras • Audio with images?? • Streaming video
Advice • Start early • Get help when stuck, “No question is a dumb question” • If one professor is busy, try another one • Know what you are doing first • Did I mention… START EARLY?!!?