Capturing Lossless Images with USB Webcam Package
Show older comments
Hi everyone,
I am using Matlab to capture images from a USB camera. I want to save in bitmap to avoid any compression but the images appear to have compression artefacts. Below is a simple version of the routine I am using to capture and save images:
aa=webcam('Camera_name_here');
aa.Resolution='1920x1080';
img=snapshot(aa);
img=imcrop(img,[1219 300 600 200]);
filename='test2.bmp';
imwrite(img,filename);
Might there be any hidden compression in these steps? The file size is large as expected from bitmap images but the image itself is not bitmap quality. Are there any settings that I can change to ensure that there is no compression during the capture? Is using the webcam package functions causing issues? Should I use functions from the Image Acquisition Toolbox? I know webcams do compress images but what I am using is a camera with USB connection, not a simple webcam.
6 Comments
Walter Roberson
on 13 Dec 2024
It is common for webcam with usb connection to make compressed images available.
Hakan Caldag
on 13 Dec 2024
Edited: Hakan Caldag
on 13 Dec 2024
Walter Roberson
on 13 Dec 2024
According to that page, the camera supports
- H.264 (which is lossy compression)
- MJPEG (which is lossy compression)
- YUY2 (which is a different kind of lossy compression)
Activating the YUY2 would probably require using the Image Acquisition Toolbox
Hakan Caldag
on 16 Dec 2024
Swastik Sarkar
on 18 Dec 2024
The following documentation can help configure the format for Image Acquisition toolbox:
Hakan Caldag
on 18 Dec 2024
Answers (0)
Categories
Find more on Image Acquisition Toolbox Supported Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!