【问题标题】:Extraction of a part from an image从图像中提取一部分
【发布时间】:2011-07-08 14:58:10
【问题描述】:

我想从图像中提取小矩形,然后将小矩形转换/滚动成圆柱体。不需要动画。我只想将圆柱体作为图像。

我使用Perlmagick 作为ImagemagicK 的API。

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

【问题讨论】:

    标签: image imagemagick image-manipulation perlmagick


    【解决方案1】:

    假设您知道要提取的矩形的 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() 函数调用它们)。

    【讨论】:

      猜你喜欢
      • 2020-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-15
      • 1970-01-01
      • 2014-04-22
      相关资源
      最近更新 更多