开发者

detect triangle in bitmap

Working on an android app, I have a bitmap obtained by applying edge detection on some image. Black background bitmap with white lines as edges.

I开发者_运维技巧 need to identify the first closed boundary moving outward from the centre and check if it is a triangle.

How do I do that? Even a methodology if not code sample would be of much help.


This is modified Hough transform, a little optimized for this problem.
Assuming that you applied edge detection and edge is white pixel.

  1. Find boundary. Move from center to outside and find first white pixel. Repeat for as many direction as you want.
  2. Find lines. Route line through pixels that are neighbours (take two pixels or find equation to route line through more than two pixels) and check how many white pixels are under the line. The more pixel under line, the better line it is. Take into account intersection with another lines and count white pixels till the intersection.
  3. Identify triangle. If boundary is builded from 3 good lines then it is a triangle.

It's only idea, I'll hope that help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜