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

조회 수: 1 (최근 30일)
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
John D'Errico
John D'Errico 2017년 9월 24일
편집: John D'Errico 2017년 9월 24일
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 2017년 9월 27일
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{:});

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2017년 9월 27일
Change
axes(handles.axes1);
hImage1=image(zeros(352,288,3),'Parent',handles.axes1);
preview(img1,hImage1);
to
imshow(img1, 'Parent', handles.axes1)
  댓글 수: 5
Walter Roberson
Walter Roberson 2017년 9월 30일
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 2017년 10월 1일
Thank you so much Walter Roberson.
I understand. I can display webcamera's video.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Niraj Gadakari
Niraj Gadakari 2017년 9월 27일
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
PROJECT SR
PROJECT SR 2017년 9월 27일
편집: Walter Roberson 2017년 9월 27일
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;

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 GUIDE アプリの移行에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!