0

我是matlab的新手!我正在尝试从帧序列中检测瞳孔...我需要使用这种方法来检测眼睛是否睁开。

当我不使用 erode 和 dilate 时 imfindcircles 正在工作,但是 erode 和 dilate 的步骤给我带来了一个非常酷的图像,它是一个非常干净的白色背景上的黑色圆圈,Hough 会像一个魅力一样工作,但它没有我真的找不到出路。它不依赖于半径范围,因为如果我评论侵蚀和扩张它会起作用。正如我刚才所说,侵蚀和扩张会产生完美的图像。

有小费吗?

rightEye = imcrop(videoFrame, rightEyeBox);
leftEye = imcrop(videoFrame, leftEyeBox);

% to grayscale
grayRightEye = rgb2gray(rightEye);
grayLeftEye = rgb2gray(leftEye);

% binarize
grayRightEye = im2bw(grayRightEye, 0.45);

% erode and dilate
finalRight = imdilate(grayRightEye, strel('disk', 7));
finalRight = imerode(finalRight, strel('disk', 11));

imshow(grayRightEye);

rightCircle = max(rightRows, rightCols);
[centers, radii] = imfindcircles(grayRightEye,[5 25])
4

1 回答 1

0

我已经通过将 finalRight 类型转换为加倍解决了!

于 2013-04-03T12:17:00.097 回答