Masking 3 dead pixels on a camera
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Villanova
am 19 Feb. 2014
Kommentiert: Image Analyst
am 24 Feb. 2014
Hello. I am working on a robotic project with a camera to capture images of blue,red,green LEDs. Apparently, the camera has 3 dead pixels. When there is no LED present, using the code below, camera detects three pixels (one red one blue one green) which are the dead pixels on the camera. I was wondering how I could mask these 3 pixels. Here is the output: [rrpts crpts rgpts_t cgpts_t rbpts cbpts] = [367 537 616 888 582 350] in which each consecutive pair is a x-y location of each dead pixel (they are the pairs I want to mask). My code is also shown below. Thank you.
Clear all
Close all;
Global rthr gthr bthr
rthr = 60;
bthr = 60;
gthr = 60;
delete(imaqfind);
vid = videoinput('dcam');
vid.ReturnedColorSpace ='bayer';
vid.BayerSensorAlignment ='rggb';
vid.ROIPosition = [60 40 960 720];
vid.FramesPerTrigger = 1;
%triggerconfig(vid,'manual')
% vid.TriggerRepeat = Inf;
src = getselectedsource(vid);
src.Gain = 500;
start(vid)
%preview(vid)
[img time] = getdata(vid);
[rrpts crpts rgpts_t cgpts_t rbpts cbpts] = gsearch_rgb(img)
figure (1)
imshow(img)
%imshow(rgbImage)
stop(vid);
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 19 Feb. 2014
I'd take those locations and get the mean in a 3x3 window around them and replace them with the mean. Like
subImage = redChannel(crpts-1: crpts+1, rrpts -1 : rrpts + 1);
meanRed = mean2(subImage);
redChannel(crpts, rrpts) = uint8(meanRed);
Same for the other color channels. And make sure they're x-y locations, because that's what I assumed because that's what you said, and not row-column locations in which case you'll need to swap the indexes.
0 Kommentare
Weitere Antworten (2)
Villanova
am 24 Feb. 2014
Bearbeitet: Villanova
am 24 Feb. 2014
1 Kommentar
Image Analyst
am 24 Feb. 2014
I have several demos for detecting colors in my File Exchange. They all do basically the same thing but in different ways, different color spaces. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 You should examine your 3D color gamut first to decide which color space is best. You can use the 3D Color Inspector plugin for ImageJ because MATLAB does not have this capability (yet). http://rsb.info.nih.gov/ij/plugins/color-inspector.html
Siehe auch
Kategorien
Mehr zu MATLAB Support Package for USB Webcams finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!