Showing posts with label How to create webcam in MATLAB. Show all posts
Showing posts with label How to create webcam in MATLAB. Show all posts

Wednesday, October 17, 2018

How to create webcam in MATLAB

How to create webcam in MATLAB

matrix matlab,for loop,gaussian elimination,carl friedrich gauss (academic),computer,robot,object-oriented programming (programming language paradigm),matlab lectures,course,language,engineer,simulation,math,computer programming (professional field),robots,mechanics,matlab video lectures,matlab introduction,noamn 360 degree

classdef app2 < matlab.apps.AppBase

    % Properties that correspond to app components
    properties (Access = public)
        UIFigure                  matlab.ui.Figure
        UIAxes                    matlab.ui.control.UIAxes
        TabGroup                  matlab.ui.container.TabGroup
        ManualmodeTab             matlab.ui.container.Tab
        ClickimageButton          matlab.ui.control.Button
        BrustmodeTab              matlab.ui.container.Tab
        CameraInputDropDownLabel  matlab.ui.control.Label
        CameraInputDropDown       matlab.ui.control.DropDown
    end

https://amzn.to/2SotVlZ
 
    properties (Access = private)
        numOfPictures = 5;
        waitTime = 1;
        mode = 1;
        vidObj;
        videoInputNumber = 1;
    end
 

    methods (Access = private)

        % Code that executes after component creation
        function startupFcn(app)
        mkdir "Session Data"
       app.vidObj = videoinput ('winvideo', app.videoInputNumber);
        preview (app.vidObj);
        end

        % Button pushed function: ClickimageButton
        function ClickimageButtonPushed(app, event)
            img = clickSingleImage (app.vidObj);
            imshow (ycbcr2rgb (img), 'Parent' , app.UIAxes);
        end

        % Value changed function: CameraInputDropDown
        function CameraInputDropDownValueChanged(app, event)
            app.videoInputNumber = app.CameraInputDropDown.Value;
            delete(app.vidObj)
            app.vidObj = videoinput ('winvideo', app.videoInputNumber);
            preview (app.vidObj);
         
        end
    end

    % App initialization and construction
    methods (Access = private)

        % Create UIFigure and components
        function createComponents(app)

            % Create UIFigure
            app.UIFigure = uifigure;
            app.UIFigure.Position = [100 100 640 480];
            app.UIFigure.Name = 'UI Figure';

            % Create UIAxes
            app.UIAxes = uiaxes(app.UIFigure);
            title(app.UIAxes, 'Title')
            xlabel(app.UIAxes, 'X')
            ylabel(app.UIAxes, 'Y')
            app.UIAxes.Position = [206 153 168 146];

            % Create TabGroup
            app.TabGroup = uitabgroup(app.UIFigure);
            app.TabGroup.Position = [12 165 177 122];

            % Create ManualmodeTab
            app.ManualmodeTab = uitab(app.TabGroup);
            app.ManualmodeTab.Title = 'Manual mode';

            % Create ClickimageButton
            app.ClickimageButton = uibutton(app.ManualmodeTab, 'push');
            app.ClickimageButton.ButtonPushedFcn = createCallbackFcn(app, @ClickimageButtonPushed, true);
            app.ClickimageButton.Position = [1 50 100 22];
            app.ClickimageButton.Text = 'Click image';

            % Create BrustmodeTab
            app.BrustmodeTab = uitab(app.TabGroup);
            app.BrustmodeTab.Title = 'Brust mode';

            % Create CameraInputDropDownLabel
            app.CameraInputDropDownLabel = uilabel(app.UIFigure);
            app.CameraInputDropDownLabel.HorizontalAlignment = 'right';
            app.CameraInputDropDownLabel.Position = [-5 401 78 22];
            app.CameraInputDropDownLabel.Text = 'Camera Input';

            % Create CameraInputDropDown
            app.CameraInputDropDown = uidropdown(app.UIFigure);
            app.CameraInputDropDown.Items = {'1', '2'};
            app.CameraInputDropDown.ValueChangedFcn = createCallbackFcn(app, @CameraInputDropDownValueChanged, true);
            app.CameraInputDropDown.Position = [88 401 100 22];
            app.CameraInputDropDown.Value = '1';
        end
    end

    methods (Access = public)

        % Construct app
        function app = app2

            % Create and configure components
            createComponents(app)

            % Register the app with App Designer
            registerApp(app, app.UIFigure)

            % Execute the startup function
            runStartupFcn(app, @startupFcn)

            if nargout == 0
                clear app
            end
        end

        % Code that executes before app deletion
        function delete(app)

            % Delete UIFigure when app is deleted
            delete(app.UIFigure)
        end
    end
end

Black-Scholes formula-R

 Black-Scholes formula-R > BlackScholes <- function(TypeFlag = c("c", "p"), S, X, Time, r, b, sigma) { TypeFla...