Direct Sun Detector code
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sameh Salman
el 29 de Mzo. de 2020
Comentada: Image Analyst
el 30 de Mzo. de 2020
Dear All;
I have camera fixed in my office which capture image every 5 minute and the captured image sent to MATLAB, what is the best code to detect sun rays that passes through window?
if there is sun rays in office display ('direct sun') else display ('no direct sun')
0 comentarios
Respuesta aceptada
Image Analyst
el 29 de Mzo. de 2020
Editada: Image Analyst
el 29 de Mzo. de 2020
I'd take an image with the sun in view and then find out how bright it is and it's size. Then threshold the image and look for items roughly that bright and that size.
grayImage = rgb2gray(rgbImage);
binaryImage = grayImage > someValue; % someValue is some value that the sun is ALWAYS brighter than.
[labeledImage, numBlobs] = bwlabel(binaryImage);
props = regionprops(binaryImage, 'Area');
allAreas = [props.Area]
sunBlobs = allAreas >= minAreaForSun & allAreas <= maxAreaForSun;
if sum(sunBlobs) >= 1
% There is a sun in the image.
fprintf('Direct Sun at %s\n', datestr(now));
else
% There is no sun in the image.
fprintf('No Direct Sun at %s\n', datestr(now));
end
Attach photos of "with sun" and "without sun" if you need more help.
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!