voidshowLidarTopview(){std::vector<LidarPoint> lidarPoints;readLidarPts("./dat/C51_LidarPts_0000.dat",lidarpoints);cv::Size worldSize(10.0,20.0);//width and height of sensor field in mcv::Size ImageSize(1000,2000);//Corresponding top view in pixel//create topview imagecv::Mat topviewImg(ImageSize, CV_8UC3, cv::Scalar(0,0,0));//plot Lidar points into imagefor(auto it=lidarPoints.begin();it!=lidarPoints.end();++it){float xw=(*it).x;//world position in m with x facing forward from sensorfloat yw=(*it).y;//world position in m with y facing left from sensorint y=(-xw*imageSize.height/worldSize.height)+imageSize.height;int x=(-yw*imageSize.width/worldSize.width)+imageSize.width/2;float zw=(*it).z;//height above road surfacedouble minZ=-1.40;if(zw>minZ){float val=it->x;//distance in driving directionfloat maxVal=worldSize.height;int red=min(255,(int)(255*abs((val-maxVal)/maxVal)));int green=min(255,(int)(255*(1-abs((val-maxVal)/maxVal))));cv::circle(topviewImg, cv::Point(x,y),5,cv::Scalar(0,green,red),-1);}}//plot distance markersfloat lineSpacing =2.0;//gap between distance markersint nMarkers =floor(worldSize.height/lineSpacing);for(size_t i=0; i<nMarkers;++i){int y=(-(i*lineSpacing)*imageSize.height/wordSize.height)+imageSize.height;cv::line(topeviewImg,cv::Point(0,y),cv::Point(imageSize.width,y),cv::Scalar(255,0,0));}//display imagestring windowName="Top-View Perpestive of LiDAR data";cv::namedWindow(windowName,2);cv::imshow(windowName,topViewImg);cv::waitKey(0);//wait for key to be pressed}