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

1 visualizzazione (ultimi 30 giorni)
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 Commenti
John D'Errico
John D'Errico il 24 Set 2017
Modificato: John D'Errico il 24 Set 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 il 27 Set 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{:});

Accedi per commentare.

Risposta accettata

Walter Roberson
Walter Roberson il 27 Set 2017
Change
axes(handles.axes1);
hImage1=image(zeros(352,288,3),'Parent',handles.axes1);
preview(img1,hImage1);
to
imshow(img1, 'Parent', handles.axes1)
  5 Commenti
Walter Roberson
Walter Roberson il 30 Set 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 il 1 Ott 2017
Thank you so much Walter Roberson.
I understand. I can display webcamera's video.

Accedi per commentare.

Più risposte (1)

Niraj Gadakari
Niraj Gadakari il 27 Set 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 Commento
PROJECT SR
PROJECT SR il 27 Set 2017
Modificato: Walter Roberson il 27 Set 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;

Accedi per commentare.

Categorie

Scopri di più su GUIDE アプリの移行 in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!