Possible use as a web based teaching example.
let src = cv.imread('canvasInput'); let dst = new cv.Mat(); let dsize = new cv.Size(src.rows, src.cols); let x_cut_left = Math.round(src.cols*0.01) //distance in from the left where the near road starts let x_cut_right = 0//Math.round(src.cols*0.01) //what to cut off the right let road_center = 0.74 //percentage of center position of the road let x_center = Math.round((src.cols - x_cut_left - x_cut_right)*road_center) let x_road_far = Math.round(src.cols * 0.2) //width of the road in the distance let y_road_far = Math.round(src.rows*.45) //cut off the skyline let y_road_near = Math.round(src.rows *0.65) //cut off the car hood and dash let srcTri = cv.matFromArray(4, 1, cv.CV_32FC2, [ //upperleft, upperright, lowerleft, lowerright x_cut_left+x_center-x_road_far, y_road_far, x_center+x_road_far-x_cut_right, y_road_far, x_cut_left, y_road_near, src.cols-x_cut_right, y_road_near ]); let dstTri = cv.matFromArray(4, 1, cv.CV_32FC2, [0, 0, src.cols, 0, 0, src.rows, src.cols, src.rows]); let M = cv.getPerspectiveTransform(srcTri, dstTri); // You can try more different parameters cv.warpPerspective(src, dst, M, dsize, cv.INTER_LINEAR, cv.BORDER_CONSTANT, new cv.Scalar()); cv.imshow('canvasOutput', dst); src.delete(); dst.delete(); M.delete(); srcTri.delete(); dstTri.delete();
See also:
file: /Techref/robot/ralph.htm, 2KB, , updated: 2024/5/26 22:10, local time: 2024/8/14 21:47,
owner: JMN-EFP-786,
3.15.223.72:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://ecomorder.com/Techref/robot/ralph.htm"> The RALPH self driving Navlab 5</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to ecomorder.com! |
.