thomasfermi / Algorithms-for-Automated-Driving

Each chapter of this (mini-)book guides you in programming one important software component for automated driving.
https://thomasfermi.github.io/Algorithms-for-Automated-Driving/Introduction/intro.html
Other
352 stars 78 forks source link

r0 represents a point in road frame? #26

Closed Amazingmum closed 2 years ago

Amazingmum commented 2 years ago

The remaining missing piece is some point 𝐫0 on the plane. In the camera reference frame, the camera is at position (0,0,0)𝑇 . If we denote the height of the camera above the road by ℎ , then we can construct a point on the road by moving from (0,0,0)𝑇 in the direction of the road normal vector 𝐧𝐜 by a distance of ℎ ,Hence, we pick 𝐫0=ℎ𝐧𝐜 , and our equation for the plane becomes 0=𝐧𝐜𝑇(𝐫−𝐫0)=𝐧𝐜𝑇𝐫−ℎ or ℎ=𝐧𝐜𝑇𝐫 .

𝐧𝐜𝑇 represents the normal vector of camera frame ,so the r0 represents the point in camera frame?

thomasfermi commented 2 years ago

Hi @liukr001 ! Yes, in the equation n_c^T(r-r_0)=0 all the quantities (n_c, r, and r_0) are in the camera reference frame.

I added some blue cross to the figure to indicate where r_0 is located, maybe that helps:

image

Amazingmum commented 2 years ago

Hi @liukr001 ! Yes, in the equation n_c^T(r-r_0)=0 all the quantities (n_c, r, and r_0) are in the camera reference frame.

I added some blue cross to the figure to indicate where r_0 is located, maybe that helps:

image

Sorry, I still don't get it.

In my opinion, n_c is the normal vector of the XZ plane in the camera coordinate system. If the camera optical axis is not parallel to the road surface, n_c will not be the normal vector of the road surface. In order to solve the XZ plane equation in the camera coordinate system, it is necessary to find a point r_0 in the plane using the h(height of camera) , so r_0 should not be on the road surface.

thomasfermi commented 2 years ago

No problem, let me explain a bit more:

There is a vector that is perpendicular to the road. In the road reference frame I call it n, and in the camera reference frame I call it n_c. In any case it is the same vector. The reason I gave different names is that in different reference frames it will have different coordinates.

So your statement: n_c will not be the normal vector of the road surface is a misunderstanding. By my definition n_c is indeed the normal vector of the road.

I didn't quite get your last sentence, but let me comment on this part: so r_0 should not be on the road surface. We do want r_0 to be on the road surface. We want to write the equation for the road surface and that equation can be written using then normal vector n_c and one (arbitrary) point r_0 on the road surface (explained in the book). The reason that we want the surface equation of the road is that we already have the equation for the ray r(lambda). Substituting that r(lambda) into the surface equation will give us the point on the ray that hits the road surface (green point in the image I posted)

Amazingmum commented 2 years ago

my statement: "n_c will not be the normal vector of the road surface" ,because i refer to the following words, In the road reference frame the normal vector is just n=(0,1,0)T. Since the optical axis of the camera is not parallel to the road, the normal vector in the camera reference frame is nc=Rcr(0,1,0)T, where the rotation matrix Rcr describes how the camera is oriented with respect to the road: It rotates vectors from the road frame into the camera frame. So, n_c is not equal to n. My understanding is that: our aim is to find the equation of the XZ plane in the camera coordinate system,also,the equation for the ray r(lambda) is defined in the camera coordinate system,now ,we have normal vector n_c of XZ plane in the camera coordinate system,and we need to find one (arbitrary) point r_0 on the XZ plane. so r_0 should not be on the road surface

jamesmcfarland1 commented 2 years ago

Hello, thanks so much for your work! I had a bit of a followup question regarding this same section. I'm confused about the road reference frame as well as the camera reference frame. from figure 17 it looks as though the normal vector n is in the z direction which leads to me believe the Z axis is pointing upwards, but immediately below the n vector is defined as (0,1,0)^T

thomasfermi commented 2 years ago

Hi @liukr001.

my statement: "n_c will not be the normal vector of the road surface" ,because i refer to the following words, In the road reference frame the normal vector is just n=(0,1,0)T. Since the optical axis of the camera is not parallel to the road, the normal vector in the camera reference frame is nc=Rcr(0,1,0)T, where the rotation matrix Rcr describes how the camera is oriented with respect to the road: It rotates vectors from the road frame into the camera frame. So, n_c is not equal to n.

Let me explain in more detail why I am saying that n and nc represent the same vector. Let me copy this from [wikipedia](https://en.wikipedia.org/wiki/Basis(linear_algebra)): image Let us say v represents the normal vector of the road. This vector v exists independently of a basis! We can specify the coordinates of v in the basis B or in some other basis B_2. In any case it is the same vector. And this is what is happening in the book. The coordinates of v (the road normal vector) in the road reference frame is what I call n. And the coordinates in the camera reference frame are n_c. Hence n and n_c are different in the sense that they have different numbers (coordinates), but they represent the same geometrical object. You might also want to watch this great youtube video explaining "change of basis", a concept from linear algebra that is essential here.

My understanding is that: our aim is to find the equation of the XZ plane in the camera coordinate system,also,the equation for the ray r(lambda) is defined in the camera coordinate system,now ,we have normal vector n_c of XZ plane in the camera coordinate system,and we need to find one (arbitrary) point r_0 on the XZ plane. so r_0 should not be on the road surface

The XZ plane of the camera reference system is not interesting, since it is not representing anything interesting in the real world. image The X_r - Z_r plane however is interesting, since it corresponds to the road. So what we do in the book is writing the equation of the road plane in general terms: image

Note that this specification is indepent of a basis again! But since we want to do computations we later use coordinate representations of the vectors n, r and r_0

thomasfermi commented 2 years ago

Hello, thanks so much for your work! I had a bit of a followup question regarding this same section. I'm confused about the road reference frame as well as the camera reference frame. from figure 17 it looks as though the normal vector n is in the z direction which leads to me believe the Z axis is pointing upwards, but immediately below the n vector is defined as (0,1,0)^T

Hi @jamesmcfarland1 ! Yeah, sorry Fig. 17 might be confusing here. The idea of Fig. 17 was to show how you would generally define the equation of a plane. So this is a general consideration and the direction of n in that figure is random. Figure 12 has the coordinate systems that are relevant for the specific case at hand: image So the Y_r-axis is pointing downwards and this is why the normal vector in the road frame is (0,1,0)