Is it possible to show movie from raspberrypi webcamera using matlab guide.

1 visualización (últimos 30 días)
I want to know that Matlab guide (GUI) can show movie from raspberrypi USB webcamera.
I have challenged making program, but it doesn't work correctly.
If you know this solution , please tell me.
  2 comentarios
John D'Errico
John D'Errico el 24 de Sept. de 2017
Editada: John D'Errico el 24 de Sept. de 2017
Of course it is possible, if you know what you are doing. What you did wrong would require us to read your mind. Are you asking us to write detailed code that figures out exactly what you want to do, given a few vague words?
PROJECT SR
PROJECT SR el 27 de Sept. de 2017
Thank you John D'Errico
Actually, I tried to find out problem of my program code. But I couldn't do that.
To begin with, I don't know that it is possible to show movie from raspberrypi through USB webcam, so I wrote this question.
If you don't mind, could you tell me how to solve this problem. I'll send code and show error message.
function 'preview' (type'matlab.graphics.primitive.Image' Input arguments) is not defined.
error: webcamtest2>webcamtest2_OpeningFcn (line 62) preview(img1,hImage1);
error: gui_mainfcn (line 220) feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});
error: webcamtest2 (line 42) gui_mainfcn(gui_State, varargin{:});

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 27 de Sept. de 2017
Change
axes(handles.axes1);
hImage1=image(zeros(352,288,3),'Parent',handles.axes1);
preview(img1,hImage1);
to
imshow(img1, 'Parent', handles.axes1)
  5 comentarios
Walter Roberson
Walter Roberson el 30 de Sept. de 2017
Then you will need to keep looping and grabbing images and displaying them; it appears that preview is not supported for raspberry pi cameras.
PROJECT SR
PROJECT SR el 1 de Oct. de 2017
Thank you so much Walter Roberson.
I understand. I can display webcamera's video.

Iniciar sesión para comentar.

Más respuestas (1)

Niraj Gadakari
Niraj Gadakari el 27 de Sept. de 2017
You can use the snapshot function in a loop and display it in the GUI using Raspberry Pi webcam. Here is a link that discusses acquiring webcam images in a loop.
  1 comentario
PROJECT SR
PROJECT SR el 27 de Sept. de 2017
Editada: Walter Roberson el 27 de Sept. de 2017
Thank you Niraj Gadakari
But I want to show web cam movie using matlab guide(GUI). I tried my program code, but error was occured, and I can not find out reason.
If you don't mind, please tell the solution.
code
******************************************************************** function varargout = webcamtest2(varargin)
% WEBCAMTEST2 MATLAB code for webcamtest2.fig
% WEBCAMTEST2, by itself, creates a new WEBCAMTEST2 or raises the existing
% singleton*.
%
% H = WEBCAMTEST2 returns the handle to a new WEBCAMTEST2 or the handle to
% the existing singleton*.
%
% WEBCAMTEST2('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in WEBCAMTEST2.M with the given input arguments.
%
% WEBCAMTEST2('Property','Value',...) creates a new WEBCAMTEST2 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before webcamtest2_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to webcamtest2_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help webcamtest2
% Last Modified by GUIDE v2.5 28-Sep-2017 00:24:43
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @webcamtest2_OpeningFcn, ...
'gui_OutputFcn', @webcamtest2_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before webcamtest2 is made visible.
function webcamtest2_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 webcamtest2 (see VARARGIN)
% Choose default command line output for webcamtest2
handles.output = hObject;
mypi=raspi;
wcam1 = webcam(mypi,'USB 2.0 Camera (usb-3f980000.usb-1.4):')
img1 = snapshot(wcam1);
axes(handles.axes1);
hImage1=image(zeros(352,288,3),'Parent',handles.axes1);
preview(img1,hImage1);
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes webcamtest2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = webcamtest2_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;

Iniciar sesión para comentar.

Categorías

Más información sobre GUIDE アプリの移行 en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!