Image outline points generator? [closed]

2019-06-08 18:21发布

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 ..

2条回答
地球回转人心会变
2楼-- · 2019-06-08 19:09

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

enter image description here

查看更多
再贱就再见
3楼-- · 2019-06-08 19:11

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..

查看更多
登录 后发表回答