Image outline points generator? [closed]

一世执手 提交于 2019-12-08 13:44:29

问题


Is there any code(specifically Java or C++) or software in which we import any image and it gives the outline of that image in points, which we can use again to draw image outline by joining those points in JOGL or OPenGL ..


回答1:


There's an outline tracer in Inkscape (which is open source c++).

http://inkscape.org/doc/tracing/tutorial-tracing.html

This will convert to vector format - so you could get some points out this way.

EDIT: this actually uses http://potrace.sourceforge.net/ for the tracing..




回答2:


Here is an example code in MATLAB:

%# read image
I = imread('coins.png');

%# Convert to a binary image
BW = im2bw(I, graythresh(I));

%# get object boundaries
BW = imfill(BW,'holes');
B = bwboundaries(BW,'noholes');

%# plot boundaries overlayed on top of image
imshow(I), hold on
for i=1:numel(B)
    plot(B{i}(:,2), B{i}(:,1), 'Color','g', 'LineWidth',2)
end
hold off



来源:https://stackoverflow.com/questions/7011801/image-outline-points-generator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!