how determine head light on car
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
hi my teacher ask me determind car's headlight in picture on matlab and draw circule on thoes and measure distance between thoes how can i do it ...please help me
thanks in advance.
3 comentarios
DGM
el 16 de Nov. de 2023
You might try a number of things. I can't think of anything that would be universal, though.
You might try sorting bright spots based on their y-position, but that would get fooled by streetlights, clearance lights, and other cars.
You might try some sort of clustering to associate bright spots with their own reflections and then sorting within those groups to exclude the reflections. That could probably be defeated by a little rain or fog.
inpict = imread('ahb27.jpg');
% create a mask somehow
% i'm going to use HSV only because there is some
% color information which might help subdue the penumbra
% but S information is extremely damaged due to the downsampled chroma
[~,S,V] = rgb2hsv(inpict);
mask = S < 0.05 & V > 0.98;
% get blob area and position
% include an index list, so that it gets transformed during sorting
PS = regionprops(mask,'area','centroid');
A = vertcat(PS.Area);
C = vertcat(PS.Centroid);
roiblobs = (1:numel(PS)).';
% discard small objects
% i'm just going to use the median
% but there's not universally appropriate
junkblobs = A<median(A);
C(junkblobs,:) = [];
roiblobs(junkblobs) = [];
% sort blobs by y-position
[~,idx] = sort(C(:,2));
C = C(idx(1:2),:);
roiblobs = roiblobs(idx(1:2));
% if we want to truncate PS or A, we can
% similarly, the excluded objects could be removed from mask
PS = PS(roiblobs);
A = A(roiblobs);
% plot it i guess
% i'm calculating R based on A
imshow(mask,'border','tight')
viscircles(C,2*sqrt(A/pi));
% distance between blob centroids in pixels
D = sqrt(sum(diff(C).^2))
Respuestas (1)
Ver también
Categorías
Más información sobre Camera Calibration 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!