Borrar filtros
Borrar filtros

hough transform to small

1 visualización (últimos 30 días)
James Robinson
James Robinson el 8 de Dic. de 2022
Respondida: Kush el 11 de Jul. de 2023
i am running a program that cand find and plot lines. after masking the image with color thresholder and using canny edge detect, when i run the hough transform, the image comes out to small.
  1 comentario
Varun
Varun el 23 de Mzo. de 2023
Hello!
Can you please elaborate on exactly what's going wrong with your code and what you are trying to achieve?

Iniciar sesión para comentar.

Respuestas (1)

Kush
Kush el 11 de Jul. de 2023
According to your given picture and question, I assume you're trying to do lane detection using canny edge detection and hough transform to overlay lines on that lane. Try altering your threshold values for color thresholding, Here is a result that I tried to get using some thresholding techniques and hough transform via this code.
image = imread('out1.jpeg');
hls = rgb2hsv(image);
s_channel = hls(:,:,2)*255;
s_binary = zeros(size(s_channel));
s_binary((s_channel > 130) & (s_channel <= 255)) = 1;
hsv = rgb2hsv(image);
v_channel = hsv(:,:,3)*255;
v_binary = zeros(size(v_channel));
v_binary((v_channel > 220) & (v_channel <= 250)) = 1;
output = zeros(size(s_channel));
output((s_binary == 1) | (v_binary == 1)) = 1;
output = logical(output);
convolvedImage = imboxfilt(double(output), [7,7]); %Choose a window size for blurring
% Perform Hough transform
[H,theta,rho] = hough(convolvedImage);
% Find peaks in the Hough transform
peaks = houghpeaks(H, 10); % Adjust the number of peaks as needed
% Retrieve the lines from the Hough transform
lines = houghlines(convolvedImage, theta, rho, peaks);
% Display the original image
figure;
subplot(1, 2, 1);
imshow(image);
title('Original Image');
% Display the Canny edges
subplot(1, 2, 2);
imshow(convolvedImage);
hold on;
% Plot the detected lines on the Canny edges
for k = 1:length(lines)
xy = [lines(k).point1; lines(k).point2];
plot(xy(:, 1), xy(:, 2), 'LineWidth', 2, 'Color', 'r');
end
%imwrite(convolvedImage,"edgeDetectionImage.jpg","jpg");
%saveas(gcf, 'plot.png');

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by