|
|
Webcam DirectShow |
Code generation with Microsoft Visual Studio 2026 |
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
Take a picture with checkbox enabled "grayed"
To find the edge you can use the Prewitt or the Sobel operator
-1 0 +1
Gx = -1 0 +1
-1 0 +1
| |