.

Thursday, October 10, 2019

Contoh Script Octave untuk ambil snapshot photo dari webcam

%% In file 'imageViewer.m'
function imageViewer ()
  MainFrm = figure ( ...
    'position', [100, 100, 250, 350]); 

  TitleFrm = axes ( ... 
    'position', [0, 0.8, 1, 0.2], ... 
    'color',    [0.9, 0.95, 1], ...
    'xtick',    [], ... 
    'ytick',    [], ...  
    'xlim',     [0, 1], ... 
    'ylim',     [0, 1] );

  Title = text (0.05, 0.5, 'Computer Vision', 'fontsize', 30);

  ImgFrm = axes ( ...
    'position', [0, 0.2, 1, 0.6], ... 
    'xtick',    [], ... 
    'ytick',    [], ...
    'xlim',     [0, 1], ... 
    'ylim',     [0, 1]);

  ButtonFrm = uicontrol (MainFrm, ...
    'style',    'pushbutton', ... 
    'string',   'GET IMAGE', ...
    'units',    'normalized', ...
    'position', [0, 0, 1, 0.2], ...
    'callback', { @previewImage, ImgFrm });
end

%% callback subfunction (in same file)
function previewImage (hObject, eventdata, ImageFrame)
  pkg load image-acquisition;
  cam=videoinput("v4l2", "/dev/video0");
  set(cam, "VideoFormat", "RGB3");
  set(cam, "VideoResolution", [320 240]);
  start(cam,2);
  preview(cam);
  stop(cam);
  start(cam,2);
  img = getsnapshot(cam);  
  %Img = imread (fullfile(fpath, fname));
  axes(ImageFrame);
  imshow(img, []);
  axis image off
  stop(cam);
end





ref:
http://wiki.octave.org/Uicontrols
https://wiki.octave.org/Image_acquisition_package


1 comment:

Marsya said...

Izin promo ya Admin^^

Bosan gak tau mau ngapain, ayo buruan gabung dengan kami
minimal deposit dan withdraw nya hanya 15 ribu rupiah ya :D
Kami Juga Menerima Deposit Via Pulsa
- Telkomsel
- XL axiata
- OVO
- DANA
segera DAFTAR di WWW.AJOKARTU.COMPANY ....:)

Setting DeepCool AK400 Digital CPU fan di Manjaro Linux

  Baru rakit PC dan pakai AK400 Digital untuk CPU fannya, setelah install linux ternyata tulisan digitalnya gak tampil, cari-cari di interne...