Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 如何在人脸识别代码中使用从边界框提取的人脸。?_Matlab_Image Processing_Image Segmentation_Matlab Cvst - Fatal编程技术网

Matlab 如何在人脸识别代码中使用从边界框提取的人脸。?

Matlab 如何在人脸识别代码中使用从边界框提取的人脸。?,matlab,image-processing,image-segmentation,matlab-cvst,Matlab,Image Processing,Image Segmentation,Matlab Cvst,我有三个人在摄像机前,使用FaceDetect=vision.CascadeObjectDetector;我在所有三个面周围都有一个边界框。我想跟踪保存在我的人脸识别代码数据库中的特定人脸。为此,我使用下面的代码,但出现错误: temp = getdata(vid,1); index1 = bbox(1,:); face1 = temp(index1(2):index1(2)+index1(4),index1(1):index1(1)+index1(3),:); R = imagesc(fac

我有三个人在摄像机前,使用FaceDetect=vision.CascadeObjectDetector;我在所有三个面周围都有一个边界框。我想跟踪保存在我的人脸识别代码数据库中的特定人脸。为此,我使用下面的代码,但出现错误:

temp = getdata(vid,1);
index1 = bbox(1,:);
face1 = temp(index1(2):index1(2)+index1(4),index1(1):index1(1)+index1(3),:);

R = imagesc(face1);
name1 = recognize(R);            %.....my face recognition function
我得到的错误如下所示:

Error using rgb2gray>parse_inputs (line 81) MAP must be a m x 3 array.

Error in rgb2gray (line 35) X = parse_inputs(varargin{:});

Error in get_face (line 11) img=rgb2gray(img);

如何修复此问题?

在调用rgb2gray之前,您应该检查img是否确实是rgb图像,即。E大小为M-by-N-by-3。

MAP必须是一个mx3数组。@cheema-基本上是罗伯特·哈维说的。您发布的错误与您在此处编写的代码无关。当您在输入图像上调用rgb2gray时,会发生错误,但该输入图像的结构不符合rgb2gray的预期。你能帮我贴上脸的密码吗?非常感谢你的回答。这里我有get_face函数img=get_faceimg%的代码使用vision.CascadeObjectDetector FaceDetect=vision.CascadeObjectDetector;%自动人脸检测bb=步进人脸检测,img;img=imcropimg,bb;img=rgb2灰度img;结束,然后在人脸识别函数中使用,函数名=recognizeimg img=get_faceimg;img=imresizeimg[100];img=双img:;