前一段时间我问了一个关于方形检测的问题,karlphillip提出了一个不错的结果.
现在我想更进一步,找到边缘不完全可见的方块.看看这个例子:
有任何想法吗?我正在使用karlphillips代码:
void find_squares(Mat& image, vector<vector<Point> >& squares)
{
// blur will enhance edge detection
Mat blurred(image);
medianBlur(image, blurred, 9);
Mat gray0(blurred.size(), CV_8U), gray;
vector<vector<Point> > contours;
// find squares in every color plane of the image
for (int c = 0; c < 3; c++)
{
int ch[] = {c, 0};
mixChannels(&blurred, 1, &gray0, 1, ch, 1);
// try several threshold levels
const int threshold_level = 2;
for (int l = 0; …Run Code Online (Sandbox Code Playgroud) 我在HSV图像上使用直方图反投影来检测皮肤.
作为用于皮肤检测的最佳图像类型,您会建议什么?(为了获得最佳和最准确的检测)HSV,RGB或YCbCr?
每种图像的优点和缺点是什么?您认为哪种图像最适合这种特定情况?
PS:由于我的程序是如何制作的,照明并不重要
我正在做一项工作,我必须找到感兴趣的区域(ROI),然后对图像执行阈值:

因为我不是来自计算领域,所以我遇到了一些困难.
我开始尝试通过以下代码找到ROI:
// code
string filename = "2011-06-11-09%3A12%3A15.387932.bmp";
Mat img = imread(filename)
if (!img.data)
{
std::cout << "!!! imread não conseguiu abrir imagem: " << filename << std::endl;
return -1;
}
cv::Rect roi;
roi.x = 0
roi.y = 90
roi.width = 400;
roi.height = 90;
cv::Mat crop = original_image(roi);
cv::imwrite("2011-06-11-09%3A12%3A15.387932.bmp", crop);
Run Code Online (Sandbox Code Playgroud)
非常感谢你.