MATLAB Answers

How to turn a camera webcam into a video.

3 ビュー (過去 30 日間)
bo hyeoun lee
bo hyeoun lee 2019 年 12 月 7 日
Commented: bo hyeoun lee 2019 年 12 月 7 日
I want to get the value printed on video instead of webcam.
clear
camera = webcame; % Connect to the camera
==> camera = VideoWriter('slow.avi')
nnet = alexnet; % Load the neural net
while true
picture = camera.snapshot; % Take a picture
picture = imresize(picture,[227,227]); % Resize the picture
label = classify(nnet, picture); % Classify the picture
image(picture); % Show the picture
title(int(label)); % Show the label
drawnow;
end
I've changed it, but it doesn't work. What should I change?

  2 件のコメント

Walter Roberson
Walter Roberson 2019 年 12 月 7 日
I do not understand what you are trying to do?
It looks like you have code designed for webcam . Are you trying to adapt the code to read from a video instead? Or are you trying to write the titled image out to video?
bo hyeoun lee
bo hyeoun lee 2019 年 12 月 7 日
I want to make it possible to read the code by video instead of webcam.
Thank u

サインイン to comment.

採用された回答

Walter Roberson
Walter Roberson 2019 年 12 月 7 日
camera = VideoReader('slow.avi')
nnet = alexnet; % Load the neural net
pic = image([]);
while hasFrame(camera)
picture = readFrame(camera); % Take a picture
picture = imresize(picture,[227,227]); % Resize the picture
label = classify(nnet, picture); % Classify the picture
pic.CData = picture; % Show the picture
title(round(label)); % Show the label
drawnow ratelimit;
end

  5 件のコメント

表示 2 件の古いコメント
bo hyeoun lee
bo hyeoun lee 2019 年 12 月 7 日
I'm using the 2019 version.
Walter Roberson
Walter Roberson 2019 年 12 月 7 日
I tested with the following code.
camera = VideoReader('rhinos.avi');
nnet = alexnet; % Load the neural net
pic = image([]);
while hasFrame(camera)
picture = readFrame(camera); % Take a picture
picture = imresize(picture,[227,227]); % Resize the picture
label = classify(nnet, picture); % Classify the picture
pic.CData = picture; % Show the picture
title(char(label)); % Show the label
drawnow limitrate;
end
delete(camera);
bo hyeoun lee
bo hyeoun lee 2019 年 12 月 7 日
You are a genius.
It's working!!!!!
Thank you. I will study hard and be a good programmer!
٩(^ᴗ^)۶٩(^ᴗ^)۶

サインイン to comment.

More Answers (1)

bo hyeoun lee
bo hyeoun lee 2019 年 12 月 7 日
編集済み: bo hyeoun lee 2019 年 12 月 7 日
Or we're looking for a new code to match.

  0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。


Translated by