Calculate the midpoint of two lines on a track

2 ビュー (過去 30 日間)
Nitesh Ramdin
Nitesh Ramdin 2020 年 11 月 16 日
Hi ,
I am busing building a project for my university and need some direction. I am busying trying to build an autonmous car with the use of Mathlab and Raspberry Pi4B + Pi camera. Thh Pi camera will visualize the the front of the car as it navigates through a track. I want the car to maintain a centre position as it navigates through the track. I have used black tape to mark this.
My question is how do i calculate/design the midpoint and maintain this as the car navigates through the track.
Any assistance would be helpful.
  4 件のコメント
Nitesh Ramdin
Nitesh Ramdin 2020 年 11 月 24 日
Here is a sample image. To be honest i have not attempted the code for this as yet . I just go the neural netwrok to work this week. I haver a draft report due early next week which is wehn i will focus on this. Any pionters or direction would be helpful.
I basically want ot calculate the midpiont of these two lines. The car would move every one second so this would need to continuely update.
Rik
Rik 2020 年 11 月 24 日
When you get to work on this: I would suggest simple thresholding to find where in your image the two lines are. The car should stay in the same position in the frame, so you can easily remove it.
I would try to find the intersection point of the two lines.
If the bends are not too sharp you could even process each half of the image separately to fit a straight trend line.

サインインしてコメントする。

回答 (1 件)

Matt J
Matt J 2020 年 11 月 24 日
編集済み: Matt J 2020 年 11 月 24 日
The effectiveness of any solution we give will depend on whether the illumination levels of every frame will be similar to your example frame. This might be a good starting point:
A=imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/426118/image.jpeg');
Ag=rgb2gray(A);
bw=bwareafilt( bwareafilt(Ag<120,3) ,2,'smallest');
[I,J]=find(bw);
[xmid,ymid]=deal( mean(J),size(A,1)-mean(I));
imshow(bw);
h=drawpoint('Position',[xmid,ymid],'Color','m','Label','Midpoint');
h.MarkerSize=15;
  1 件のコメント
Sharatkumar Kondikoppa
Sharatkumar Kondikoppa 2022 年 1 月 5 日
Can get code to midline instead of midpoint ..

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMATLAB Support Package for Raspberry Pi Hardware についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by