How to display the webcam through the correct axes?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to display the webcam via axes by using this code,
Function c11_OpeningFcn (hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% HObject handle to figure
% Eventdata reserved - to be defined in a future version of MATLAB
% Handles structure with handles and user data (see GUIDATA)
% Varargin command line arguments to c11 (see VARARGIN)
% Choose default command line output for c11
Handles.output = hObject;
Axes (handles.axes1);
Vid = webcam (1);
HImage = image (zeros (720,1280,3), 'Parent', handles.axes1);
Preview (vid, hImage);
%%Update handles structure
Guidata (hObject, handles);
But after I run it looks can not be closed. How to display the webcam through the correct axes?
0 commentaires
Réponses (1)
Cam Salzberger
le 21 Août 2017
Hello Muammar,
Capitalization matters in MATLAB. There is no variable "Handles", but there is "handles". Similarly, there is no function "Axes" or "Guidata", but there is "axes" and "guidata". You define "Vid" and "HImage", but then use "vid" and "hImage". So I'm surprised you weren't getting some more basic errors.
I don't think "image" allows for the 'Parent'-style axes specification. The documentation indicates that you should just have the axes as the first input argument:
hImage = image(handles.axes1, zeros(720,1280,3));
Hope that helps.
-Cam
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!