How to detect the limits of the road?

I did a project for detecting the street and want to know how to detect the limits of asphalt, left and right, from the midpoint.
Original Photo
Binary Photo

3 comentarios

John D'Errico
John D'Errico el 6 de Jun. de 2016
But this is your project after all. You need to do the work. If your question is to be given a general scheme to follow for your project, then your question is off-topic on answers, as it is then not about MATLAB.
bogdan bogdan
bogdan bogdan el 6 de Jun. de 2016
I need an answer to my question that I do not know how to respond. After all what's your problem?
Ayushman
Ayushman el 14 de Nov. de 2018
Fight Fight Fight!

Iniciar sesión para comentar.

 Respuesta aceptada

John BG
John BG el 6 de Jun. de 2016
Hi Bogdan
just answered a similar question
A(find(A>125))=255; A(find(A<=125))=0; % basic image clean-up converting to binary map
A(:,:,2)=and(A(:,:,2),A(:,:,3));A(:,:,3)=[];
A=and(A(:,:,1),A(:,:,2));
A=logical(~A);
% figure(1);imshow(A)
A2=del2(A)
figure(3);imshow(A2)
If you find this answer of any help solving your question,
please click on the thumbs-up vote link, or mark it as accepted answer
thanks in advance
John

8 comentarios

bogdan bogdan
bogdan bogdan el 6 de Jun. de 2016
That I did, but I do not know how to go N spaces above the bottom, from the middle, then go left and right, until the end where the streets and show them in a line
Image Analyst
Image Analyst el 6 de Jun. de 2016
Editada: Image Analyst el 6 de Jun. de 2016
To get a line N rows up from the bottom do
lineN = binaryImage(end-N+1, :);
Get the midpoint
[rows, columns] = size(binaryImage);
midPoint = round(columns/2)
Find the first one after the middle
rightIndex = find(lineN(midPoint:end), 1, 'first') + midPoint;
% Now find it on the right side
leftIndex = find(lineN(1:midPoint), 1, 'last');
Be sure to check if the indexes are empty indicating that no white pixel was found on that half!!!
John BG
John BG el 6 de Jun. de 2016
do you mean you just want to catch left and right points where road lines hit the image frame?
John BG
John BG el 6 de Jun. de 2016
would you like to rotate the image to align the points where road lines hit image frame?
John BG
John BG el 16 de Jun. de 2016
Bogdan
Here Image Analyst deserves and accepted answer, or tell what is left or wrong.
Jan
Jan el 24 de Feb. de 2017
Editada: Jan el 24 de Feb. de 2017
And after this comment, John BG has accepted his own answer now, but it is not clear, if it is useful for the Bogdan.
Anas Al-Shaghouri
Anas Al-Shaghouri el 16 de Dic. de 2019
Hello
Can you help me in this.
This command is not running:
A2=del2(A);
And giving me this error:
"Error using zeros
CLASSNAME input must be a valid numeric class name.
Error in del2 (line 43)
v = zeros(size(f),class(f));"
Image Analyst
Image Analyst el 17 de Dic. de 2019
Anas, I think you posted this in the wrong place. It doesn't seem to have anything to do with anything on this page. But the line of code seems to be saying that f is not one of the standard MATLAB classes. It's probably some special variable that you defined, like a class or something.

Iniciar sesión para comentar.

Preguntada:

el 5 de Jun. de 2016

Comentada:

el 17 de Dic. de 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by