Some weeks ago I had the idea to combine Matlab and DirectShow, and here's the result ...

... a DirectShow filter that will use Matlab to transform a video stream.
The filter will accept the path to a M-File and the Variable Names of the Input and Output Frame.
When the DirectShow Filter Graph starts the "Matlab Video Filter" starts the Matlab Command Shell automatically in the background. For each frame the "Matlab Video Filter" load the Input Frame to a Matlab matrix, put the matrix to the Matlab Command Shell, execute the M-File, get the transformed matrix back from the Matlab Command Shell and copy it to the Output Frame.
The M-File used in the screenshot uses the "Canny Edge Filter" to extract the edges of the video stream and plot the histogram of the Input Frame:
FrameOut = im2uint8(edge(FrameIn, 'canny'));
imhist(FrameIn); |
There are two versions of the "Matlab Video Filter", one for 8 Bit Grayscale video streams and one for RGB 24 video streams.
Both Microsoft Visual Studio 2005 projects of the filters can be found here: