【发布时间】:2018-02-06 03:49:16
【问题描述】:
我的问题:如何识别下图中每块石头的边界?尺寸计算将是一件容易的事。
首先我要告诉你,我是图像识别领域的新手,我会感谢任何人:
- 命题
- 有用的链接
- 书名和章节
- 算法
- 框架(尤其是 C++)
- 等
所以..
我有一张带有小石头的图片。而且我必须测量它们的大小(以像素为单位)。
我已经玩过任何像素的 RGB 值,并且突出显示的像素和 RGB 值介于我定义的常量之间。我不喜欢有些石头是粘的,有些边框比它应该的宽。
for (y=0; y<height; y++,pixelIndex = width*y<<2)
for (x=0; x<width; x++,pixelIndex+=4)
if (pixelsData[pixelIndex ]>self.minRedSlider.integerValue && pixelsData[pixelIndex ]<self.maxRedSlider.integerValue &&
pixelsData[pixelIndex+1]>self.minGreenSlider.integerValue && pixelsData[pixelIndex+1]<self.maxGreenSlider.integerValue &&
pixelsData[pixelIndex+2]>self.minBlueSlider.integerValue && pixelsData[pixelIndex+2]<self.maxBlueSlider.integerValue) {
resultData[pixelIndex] = 255;
resultData[pixelIndex+1] = 255;
resultData[pixelIndex+2] = 255;
} else {
resultData[pixelIndex] = 0;
resultData[pixelIndex+1] = 0;
resultData[pixelIndex+2] = 0;
}
这是我的测试应用目前的样子:
PS: 我知道我的问题很模糊,但是我必须开始并且无法找到或猜测合适的方向。无论如何,感谢您花在这上面的时间。
【问题讨论】:
标签: c++ image-processing image-recognition