gpt4 book ai didi

linux - OpenCV错误: Image step is wrong

转载 作者:太空宇宙 更新时间:2023-11-04 04:20:00 25 4
gpt4 key购买 nike

我正在学习本教程:http://docs.opencv.org/trunk/modules/contrib/doc/facerec/tutorial/facerec_video_recognition.html#creating-the-csv-file

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

OpenCV Error: Image step is wrong (The matrix is not continuous, thus its number of rows can not be changed)

我正在使用 Ubuntu,所以我不太确定如何实现此处找到的解决方案:Getting OpenCV Error "Image step is wrong" in Fisherfaces.train() method

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

最佳答案

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

使用此脚本裁剪图像(另请参阅 Command line batch image cropping tool )

#!/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

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

此外,您还应该给出 csv 文件内的绝对路径。

关于linux - OpenCV错误: Image step is wrong,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14096157/

25 4 0
文章推荐: python - Shell 命令在 python 3 上卡住,但在 python 2 上工作
文章推荐: linux - 使用 linux-arm-gnueabi-g++ 编译适用于 ARM 的 QT 时出现 XLib 错误
文章推荐: html - 用文本和 <input> 填充
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com