Acquire 16-bit image from usb webcam using support package

1 view (last 30 days)
I have a USB camera that supports 16-bit image acquisition. The code below creates a 512x640x3 uint8 where all of the layers are identical (as I expect for a gray scale image)
clear
close
webcamlist
cam = webcam(2)
img = snapshot(cam);
figure
imshow(img)
  4 Comments
Cris LaPierre
Cris LaPierre on 11 Mar 2025
The snapshot function only returns output as a uint8 (see output data types here).
To acquire other data types, you likely need to use the Image Acquistion Toolbox. I also had to install the Image Acquisition Toolbox Support Package for OS Generic Video Interface in order capture images. Unfortunatly, my camera does not provide the data at uint16, so I can't test that.
Here's the code I used.
% determine what type of video input I have
obj = imaqhwinfo
% Capture a single frame.
vidobj = videoinput('winvideo',2)
frame = getsnapshot(vidobj);
DGM
DGM on 11 Mar 2025
I had been looking for things earlier, and I did see this:
I don't have IAT or a webcam, so I'm gonna have to tap out.
Er, well now you've got me wondering if I can access my analog capture card in anything other than uint8. I'm just going to assume the answer is no.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!