Shades of ash (gray scale) live
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Image Analyst
el 29 de Mayo de 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 comentarios
Ver también
Categorías
Más información sobre Red en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!