从图像中提取零件

从图像中提取零件

问题描述:

我想从图像中提取小矩形,然后想要将小直方块转换/滚动成圆柱体。不需要动画。我只是想把气瓶当成图像。从图像中提取零件

我使用Perlmagick作为ImagemagicK的API。

任何帮助/建议,将不胜感激。

假设您知道要提取的矩形的x,y坐标和几何图形;

use Image::Magick; 
... 
my $image = Image::Magick->new(); 
my $x = $image->Read($filename); 
    die "$x" if "$x"; 

# 100x100 is the size of the cropped image, the +40+40 are giving the x and y 
# offsets (i.e. the upper-left coordinate of the cropped image) 
$image->Crop(geometry=>"100x100+40+40"); 

你必须要更具体的了解缸,但如果它是什么,我认为这是再检查Fred's Cylinderize script。给出的例子是ImageMagick命令行参数,所以有一些工作可以将它转换成perl等价物(或者你可以使用Perl的exec()函数来调用它们)。