提取图像的一部分进行识别

Extract part of an image to identify

我试图获取有关图像的一部分的详细信息。我阅读了 imageMagick 的文档,据我了解,应该可以使用 -extract 选项调用识别。但是,当我调用它时,我收到一条错误消息: 'unrecognized option: -extract'.

这是我的命令行调用identify -verbose -extract 20x20+0+20 ./mosaicTemplate.jpg

有谁知道我的命令行调用有什么问题或有方便的解决方法吗?

提前致谢! 西蒙

像这样创建一个测试图像:

convert -size 500x500 gradient:red-blue image.png

现在检查左上角的细节,那里的图像很红:

convert image.png -crop 20x20+0+0 -verbose info:

Image: image.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 20x20+0+0
  Units: Undefined
  Type: Palette
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 16-bit
  Channel depth:
    red: 16-bit
    green: 1-bit
    blue: 16-bit
  Channel statistics:
    Pixels: 400
    Red:
      min: 63040 (0.961929)
      max: 65535 (1)
      mean: 64287.3 (0.980962)                    <--- very red
      standard deviation: 757.295 (0.0115556)
      kurtosis: -1.20609
      skewness: 0.000125086
      entropy: 1
    Green:
      min: 0 (0)
      max: 0 (0)
      mean: 0 (0)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
      entropy: nan
    Blue:
      min: 0 (0)
      max: 2495 (0.0380713)
      mean: 1247.65 (0.0190379)              <--- not very blue
      standard deviation: 757.295 (0.0115556)
      kurtosis: -1.20609
      skewness: -0.000125086
      entropy: 1

现在查看左下角更蓝的细节:

convert image.png -crop 20x20+0+480 -verbose info:

Image: image.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 20x20+0+0
  Units: Undefined
  Type: Palette
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 16-bit
  Channel depth:
    red: 16-bit
    green: 1-bit
    blue: 16-bit
  Channel statistics:
    Pixels: 400
    Red:
      min: 0 (0)
      max: 2495 (0.0380713)
      mean: 1247.65 (0.0190379)                  <--- not very red
      standard deviation: 757.295 (0.0115556)
      kurtosis: -1.20609
      skewness: -0.000125086
      entropy: 1
    Green:
      min: 0 (0)
      max: 0 (0)
      mean: 0 (0)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
      entropy: nan
    Blue:
      min: 63040 (0.961929)
      max: 65535 (1)
      mean: 64287.3 (0.980962)                     <--- very blue
      standard deviation: 757.295 (0.0115556)
      kurtosis: -1.20609
      skewness: 0.000125086
      entropy: 1