【发布时间】:2011-08-10 13:44:46
【问题描述】:
是否有任何代码(特别是 Java 或 C++)或软件可以在其中导入任何图像,并以点为单位给出该图像的轮廓,我们可以通过在 JOGL 或 OPenGL 中加入这些点再次使用它来绘制图像轮廓。 .
【问题讨论】:
-
@amro 如果我能在 MATLAB 中获得代码,它也会有所帮助:-)
标签: java c++ matlab opengl jogl
是否有任何代码(特别是 Java 或 C++)或软件可以在其中导入任何图像,并以点为单位给出该图像的轮廓,我们可以通过在 JOGL 或 OPenGL 中加入这些点再次使用它来绘制图像轮廓。 .
【问题讨论】:
标签: java c++ matlab opengl jogl
Inkscape(开源 c++)中有一个轮廓跟踪器。
http://inkscape.org/doc/tracing/tutorial-tracing.html
这将转换为矢量格式 - 因此您可以通过这种方式获得一些要点。
编辑:这实际上使用http://potrace.sourceforge.net/ 进行跟踪..
【讨论】:
这是 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
【讨论】: