Webcam Captures 7 color (rainbow) display not RGB image

1 view (last 30 days)
Hi Everyone, I have to use webcam in a video processing project but webcam code that is given below is not working properly on my PC. while it is working on someone others PC. Both of us using MATLAB 2013. I have search a lot but not beneficial. Please help if someone have solution.
Code:
close all
clear all
clc
imaqhwinfo('winvideo',1);
vid = videoinput('winvideo',1,'RGB24_320x240');
% set(vid, 'SelectedSourceName', 'input1');
% src_obj = getselectedsource(vid);
% get(src_obj);
preview(vid);
start(vid);
frame = getsnapshot(vid);
image(frame);
%set(vid,'ReturnedColorSpace','RGB');
Output:
Captured image is attached. Please find it.
Thanks in Advance,
Regards,
Ahmer Malik
  2 Comments
Image Analyst
Image Analyst on 7 Mar 2015
Captured image is NOT attached. It looks like it should work. Are you sure you're using an RGB adapter and not a YUV or YCbCr adapter?
Ahmer Malik
Ahmer Malik on 7 Mar 2015
Yes,as you can see in the code
vid = videoinput('winvideo',1,'RGB24_320x240');
Its working on my friend's laptop not on mine.

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 7 Mar 2015
It looks like your camera is programmed to be outputting some kind of test pattern. I'd consult the manual or manufacturer to turn that off. The manufacturer will provide some kind of software to run the camera. Make sure you can get a live image of something other than that test pattern in the manufacturer's software first before you try it in MATLAB.
  2 Comments
Ahmer Malik
Ahmer Malik on 7 Mar 2015
My cam is working everywhere except Matlab (Skype, Face Recognizer etc). Cam is also working in MATLAB for YUV adapter.
Image Analyst
Image Analyst on 7 Mar 2015
Maybe your RGB24_320x240 adapter is corrupted for some reason. Try a different adapter, like RGB24_640x480 or RGB32_320x240 or something.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!