Linux OpenCV错误:图像步骤错误

Linux OpenCV错误:图像步骤错误,linux,opencv,Linux,Opencv,我将学习本教程: 一切进展顺利,但运行人脸识别脚本会出现以下错误: OpenCV Error: Image step is wrong (The matrix is not continuous, thus its number of rows can not be changed) 我正在使用Ubuntu,所以我不确定如何实现这里的解决方案: 我在调试模式下重建,但没有效果。最近,我在这个人脸识别示例中遇到了相同的错误。我通过给出相同比例(1:1)的图像消除了这个错误 使用此脚本裁剪图像(也

我将学习本教程:

一切进展顺利,但运行人脸识别脚本会出现以下错误:

OpenCV Error: Image step is wrong (The matrix is not continuous, thus its number of rows can not be changed)
我正在使用Ubuntu,所以我不确定如何实现这里的解决方案:


我在调试模式下重建,但没有效果。

最近,我在这个人脸识别示例中遇到了相同的错误。我通过给出相同比例(1:1)的图像消除了这个错误

使用此脚本裁剪图像(也请参见此)

这将裁剪文件夹中的图像,因此您需要将此脚本放在图像所在的同一目录中

您还应该给出csv文件内的绝对路径

#!/bin/bash
width=92;
height=92;
x_offset=0;
y_offset=10;
filelist=`ls | grep '.pgm'`
for image_file in $filelist
do
  convert -crop ${width}x${height}+${x_offset}+${y_offset} \
    $image_file $image_file
done