How do I convert a race track image file into X,Y coordinates?
이전 댓글 표시
After importing a race track image into MATLAB, I need to convert the image into a set of X,Y coordinates for lap simulation.
답변 (2개)
Walter Roberson
2017년 1월 23일
0 개 추천
Probably: threshold and find(). Or perhaps threshold and one of the two boundary tracing routines.
Christoph Hahn
2017년 2월 14일
0 개 추천
Hi Nikhil,
please consider uploading an image to be able to provide better support.
Assuming that you are working with binary images (binary -> black-white; if not, please consider converting) that may be a quite straightforward task. I suggest you have a look into the function list of image processing toolbox. What about 'edge'- and 'bwboundaries'-function.
Again, please consider providing an actual image to allow for better support.
Cheers Christoph
댓글 수: 5
saud khan
2019년 12월 31일
What about this one? Please guide us to convert these type of images into X-Y coordinates.

david kardam
2022년 8월 14일
Please answer this question anyone
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/257733/monza-graphic.jpeg';
rgb = imread(filename);
Red = rgb(:,:,1); Green = rgb(:,:,2); Blue = rgb(:,:,3);
bw = Blue > 150 & Red < 128;
imshow(rgb)
B = bwboundaries(bw);
plot(B{1}(:,2), B{1}(:,1), B{2}(:,2), B{2}(:,1), B{3}(:,2), B{3}(:,1))
set(gca, 'YDir', 'reverse')
Now B{1} is the Y and X coordinates around the outside of the racetrack.
B{2} is the Y and X coordinates around the inside of the racetrack.
B{3} is the Y and X coordinates of the outer edge of the island near the checkered flag.
Demi Milet
2022년 9월 27일
Can u maybe explain this code? im trying to use this for an image of a track of my own, but i get an error.
Walter Roberson
2022년 9월 27일
What error do you get? You would get an error in the plot in trying to use B{3} if you do not have something equivalent to the small island at the bottom right where the checkered flag is.
카테고리
도움말 센터 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

