필터 지우기
필터 지우기

Problem when converte image to binary

조회 수: 2 (최근 30일)
Dekel Mashiach
Dekel Mashiach 2022년 6월 3일
답변: Ganapathi Subramanian 2023년 8월 30일
I designed a code in image processing for an autonomous vehicle that needs to track between two white stripes. I designed the code so that I actually searched the matrix of the image from the camera for the highest values (white color) and anything that is not white , I turned אם black (= 0). The problem is that sometimes it recognizes other things in the image in white so it is difficult for it to create the trajectory. How can I fix this?
grayImage = rgb2gray(rgbImage);
figure
imshow(grayImage)
grayImage(grayImage<170)=0;
if ndims(grayImage) == 3
grayImage = grayImage(:, :, 1);
end
figure
imshow(grayImage, []);
impixelinfo;
mask = logical(grayImage > 140 & grayImage < 255);
mask = bwareafilt(mask, 2);
mask = bwskel(mask);
figure
imshow(mask);
mask2 = imopen(mask, strel('line', 3, 0));
mask(mask2) = 0;
mask = logical(mask);
figure
imshow(mask);

답변 (1개)

Ganapathi Subramanian
Ganapathi Subramanian 2023년 8월 30일
Hi Dekel,
It is my understanding that you are working on an image processing application and require guidance to resolve the problem of filtering out white images. The problem you are facing will not be relevant to MATLAB and might be something else. The effectiveness of your code may vary depending on the image characteristics. You may need to adjust the threshold values, morphological operations and other parameters to achieve optimum results.

카테고리

Help CenterFile Exchange에서 Vehicle Scenarios에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by