Problem when converte image to binary
3 vues (au cours des 30 derniers jours)
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);
if ndims(grayImage) == 3
grayImage = grayImage(:, :, 1);
mask = logical(grayImage > 140 & grayImage < 255);
mask = bwareafilt(mask, 2);
mask = bwskel(mask);
mask2 = imopen(mask, strel('line', 3, 0));
mask(mask2) = 0;
mask = logical(mask);
Ganapathi Subramanian le 30 Août 2023
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.