Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7173321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:48:01+00:00 2026-05-28T15:48:01+00:00

the getsnapshot function takes a lot of time executing since (I guess) initializes the

  • 0

the getsnapshot function takes a lot of time executing since (I guess) initializes the webcam every time is called. This is a problem if you want to acquire images with a high framerate.

I trick I casually discovered is to call the preview function, which keeps the webcam handler open making getsnapshot almost instantaneous, but it keeps a small preview window open:

% dummy example
cam = videoinput(...);
preview(cam);

while(1)
    img = getsnapshot(cam);
    % do stuff
end

Is there a “cleaner” way to speedup getsnapshot? (without preview window opened)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:48:01+00:00Added an answer on May 28, 2026 at 3:48 pm

    You could use the new “machine vision” toolbox which is specially built for vision applications. See code below:

    vid = videoinput('winvideo', 1, 'RGB24_320x240'); %select input device
    
    hvpc = vision.VideoPlayer;   %create video player object
    
    src = getselectedsource(vid);
    vid.FramesPerTrigger =1;
    vid.TriggerRepeat = Inf;
    vid.ReturnedColorspace = 'rgb';
    src.FrameRate = '30';
    start(vid)
    
    %start main loop for image acquisition
    for t=1:500
      imgO=getdata(vid,1,'uint8');    %get image from camera
      hvpc.step(imgO);    %see current image in player
    end
    

    As you can see, you can acquire the image with getdata. The bottleneck in video applications in Matlab was the preview window, which delayed to code substantially. The new vision.VideoPlayer is a lot faster (i have used this code in real time vision applications in Matlab. When i had written the first version without the vision toolbox, achieving frame rates at about 18 fps and using the new toolbox got to around 70!).

    Note: I you need speed in image apps using Matlab, you should really consider using OpenCV libs through mex to get a decent performance in image manipulation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this piece of code: byte[] snap = ((VideoControl) player).getSnapshot(encoding=jpeg); , which gets
I run this code in MATLAB but it returns a Cyan frame obj =
Ohey, I have a central function that runs AJAX requests throughout my order form.
Say I have this code: private void CreateSnapshots(IEnumerable<StreamHead> streams) { foreach (StreamHead head in
I have a virtual machine, which on VM_Create passes the address of a function
my following code returns null , byte[] image1 = _videoControl.getSnapshot(null); any suggestion please
Is there a way using Subversion to get snapshot of the files for a
I'm trying to ascertain wither there is a limitation on the camera access in
I have the following classes and fluent mappings: public class A { public virtual
Is there any documentation about how Revision.Description is populated and under what condition? I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.