|
|
Webcam DirectShow |
Code generation with Microsoft Visual Studio 2026 |
|
Note: Your browser may be blocking ZIP files
containing EXE files. However, the source code allows you to create the EXE file yourself. 1 take a video-stream from a webcam download source download exe 2 take a picture into a second window download source download exe 3 high pass and low pass filter download source download exe 4 edge detection download source download exe any suggestion? orgler@tin.it last change 2026-04 |
MFC Project with DirectShow functions 1)EnumerateAllDevices(): The programm first lists all video devices. If there is only one webcam source start it otherwise chose the source and click on the "select source" button 2) StartThisDevice(ii): 3) InitCapFilters(): 4) BuildPreviewGraph(): 5) StartPreview(): The webcam is now connected with the actual dialog window The source was compiled with "Visual Studio Community 2026" Create a MFC project with a dialog window Insert the files: CaptureGraph.cpp CaptureGraph.h smartptr.h
With the button "take a picture" it is possible to copy the windows content in an array.
calculate image about 3x3 matrix
High pass filter
sharpening 0 -1 0
-1 4 -1 iDiv=4
0 -1 0
Low pass filter
gauss 1 2 1
2 4 2 iDiv=16
1 2 1
Low pass filter
median extract the median pixel-value from 3x3 pixel-matrix
replace the centered pixel with this value
The image is reversed and converted to shades of gray
Sharpening is equivalent to a high-pass filter. This can be repeated two or three times.
Edges with Prewitt Gx operator
-1 0 +1
Gx = -1 0 +1 divisor = 1
-1 0 +1
Edges with Prewitt Gy operator
+1 +1 +1
Gy = 0 0 0 divisor = 1
-1 -1 -1
Addition of both Prewitt operators GxGy = Gx + Gy
-1 0 +1 +1 +1 +1
Gx = -1 0 +1 Gy = 0 0 0
-1 0 +1 -1 -1 -1
The Sobel operator:
-1 0 +1 -1 -2 -1
Gx = -2 0 +2 Gy = 0 0 0
-1 0 +1 +1 +2 +1
|