Open arcpuree opened 3 years ago
@arcpuree is the question still valid?
yes, i can not solve the problem. ð
On Fri, Oct 1, 2021 at 10:41 PM Dmitry Yunitsky @.***> wrote:
@arcpuree https://github.com/arcpuree is the question still valid?
â You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mapbox/mapbox-vision-android-teaser/issues/229#issuecomment-932339623, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBZ4FMURREUPXWR26MRVE3UEXJCNANCNFSM5DAJ6KOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
-- āļāļāđāļŠāļāļāļāļ§āļēāļĄāļāļąāļ, Best regards,
āļ āļđāļĢāļĩ āļāļīāļĄāļāđāļāļāļāļāļēāļĄ Puree Pimtongngam
089-902-9022 @.***
@arcpuree we don't expose API to customize lane render, actually. However, you could draw it yourself using simple Canvas rendering. You'll need to receive RoadDescription object, that contains detected lanes array, for each of them there is two LaneEdges. Each LaneEdge contains Bezier that can be drawn on canvas, e.g.
...
fun drawLane(lane: Lane?) {
fillPath.reset()
lane?.let {
val leftP1 = VisionManager.worldToPixel(lane.leftEdge.curve.p1)
val leftP2 = VisionManager.worldToPixel(lane.leftEdge.curve.p2)
val leftP3 = VisionManager.worldToPixel(lane.leftEdge.curve.p3)
val leftP4 = VisionManager.worldToPixel(lane.leftEdge.curve.p4)
val rightP1 = VisionManager.worldToPixel(lane.rightEdge.curve.p1)
val rightP2 = VisionManager.worldToPixel(lane.rightEdge.curve.p2)
val rightP3 = VisionManager.worldToPixel(lane.rightEdge.curve.p3)
val rightP4 = VisionManager.worldToPixel(lane.rightEdge.curve.p4)
fillPath.apply {
moveTo(
leftP1.x.toFloat(),
leftP1.y.toFloat()
)
cubicTo(
leftP2.x.toFloat(),
leftP2.y.toFloat(),
leftP3.x.toFloat(),
leftP3.y.toFloat(),
leftP4.x.toFloat(),
leftP4.y.toFloat()
)
lineTo(
rightP4.x.toFloat(),
rightP4.y.toFloat()
)
cubicTo(
rightP3.x.toFloat(),
rightP3.y.toFloat(),
rightP2.x.toFloat(),
rightP2.y.toFloat(),
rightP1.x.toFloat(),
rightP1.y.toFloat()
)
close()
}
}
invalidate()
}
override fun onDraw(canvas: Canvas) {
canvas.drawPath(fillPath, fillPaint)
super.onDraw(canvas)
}
...
thank yout, i'll try it. ð
On Tue, Oct 5, 2021 at 11:29 PM Dmitry Yunitsky @.***> wrote:
@arcpuree https://github.com/arcpuree we don't expose API to customize lane render, actually. However, you could draw it yourself using simple Canvas rendering. You'll need to receive RoadDescription https://docs.mapbox.com/android/vision/api/vision/0.13.0/com/mapbox/vision/mobile/core/models/road/RoadDescription.html object, that contains detected lanes array https://docs.mapbox.com/android/vision/api/vision/0.13.0/com/mapbox/vision/mobile/core/models/road/Lane.html, for each of them there is two LaneEdges https://docs.mapbox.com/android/vision/api/vision/0.13.0/com/mapbox/vision/mobile/core/models/road/LaneEdge.html. Each LaneEdge contains Bezier https://docs.mapbox.com/android/vision/api/vision/0.13.0/com/mapbox/vision/mobile/core/models/BezierCubic3D.html that can be drawn on canvas, e.g.
... fun drawLane(lane: Lane?) { fillPath.reset()
lane?.let { val leftP1 = VisionManager.worldToPixel(lane.leftEdge.curve.p1) val leftP2 = VisionManager.worldToPixel(lane.leftEdge.curve.p2) val leftP3 = VisionManager.worldToPixel(lane.leftEdge.curve.p3) val leftP4 = VisionManager.worldToPixel(lane.leftEdge.curve.p4) val rightP1 = VisionManager.worldToPixel(lane.rightEdge.curve.p1) val rightP2 = VisionManager.worldToPixel(lane.rightEdge.curve.p2) val rightP3 = VisionManager.worldToPixel(lane.rightEdge.curve.p3) val rightP4 = VisionManager.worldToPixel(lane.rightEdge.curve.p4) fillPath.apply { moveTo( leftP1.x.toFloat(), leftP1.y.toFloat() ) cubicTo( leftP2.x.toFloat(), leftP2.y.toFloat(), leftP3.x.toFloat(), leftP3.y.toFloat(), leftP4.x.toFloat(), leftP4.y.toFloat() ) lineTo( rightP4.x.toFloat(), rightP4.y.toFloat() ) cubicTo( rightP3.x.toFloat(), rightP3.y.toFloat(), rightP2.x.toFloat(), rightP2.y.toFloat(), rightP1.x.toFloat(), rightP1.y.toFloat() ) close() } } invalidate() } override fun onDraw(canvas: Canvas) { canvas.drawPath(fillPath, fillPaint) super.onDraw(canvas) }
...
â You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mapbox/mapbox-vision-android-teaser/issues/229#issuecomment-934567935, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEBZ4FMYCZOGK7K56PD4KFLUFMRWLANCNFSM5DAJ6KOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
-- āļāļāđāļŠāļāļāļāļ§āļēāļĄāļāļąāļ, Best regards,
āļ āļđāļĢāļĩ āļāļīāļĄāļāđāļāļāļāļāļēāļĄ Puree Pimtongngam
089-902-9022 @.***
I want to change the blue area from the image to three colors.