Shades of ash (gray scale) live
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Grayscale. I need a code that will convert what the USB camera transmits live into gray scale. For shades of gray where 0 = white and 255 = Black. My program should have the option to play with the values and choose which value I want the camera to bounce an alert on my screen. For example, as soon as the camera detects a hue of 15 or higher, it will pop up an on-screen alert.
0 Kommentare
Antworten (1)
Image Analyst
am 29 Mai 2022
Try something like this (untested)
% Get alert gray level from GUI
alertGrayLevel = app.edtAlert.Value;
% Make up colormap to show red pixels if image is above the alert gray level.
cmap = gray(256);
cmap(alertGrayLevel:end, :) = repmat([1,0,0], alertGrayLevel:end, 1);
% Get the current image.
thisFrame = getdata(videoObject)
if ndims == 3
% It's color so convert to gray scale.
thisFrame = rgb2gray(thisFrame);
end
if app.chkInvertGrayScale
% If they have checked the checkbox to invert the gray scale, do that.
thisFrame = 255 - thisFrame;
end
imshow(thisFrame, 'ColorMap', cmap);
% Display the colormap next to the image.
colormap(cmap);
colorbar;
0 Kommentare
Siehe auch
Kategorien
Mehr zu Red 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!