A really simple example is as follows:
vid = videoinput('winvideo', 1);
set(vid, 'ReturnedColorSpace', 'RGB');
img = getsnapshot(vid);
labelMachine(img,net,classifier)
function label = labelMachine(img,net,classifier)
featureLayer = 'fc7';
img = imresize(img, [227 227]);
imageFeatures = activations(net, img, featureLayer);
label = char(predict(classifier, imageFeatures));
end
I did a project that used a webcam and alex net transfer learning which can be found here if you need further referances.
Best Answer