图像处理之分离大米与道路检测
图像处理之otsu
用原图减去处理后的图像,用otsu算出该图像的分割阈值,进行二值化即可
查表法进行图像相减的代码如下:
void imgSub(BYTE *pImgA, BYTE *pImgB, int width, int height){int LUT[256];BYTE *pA, *pB;BYTE *pEndA = pImgA + width * height, *pEndB = pImgB + width * height;for (int i = 0; i < 256; i++){LUT[i] = i;}for (pA = pImgA, pB = pImgB; pA < pEndA, pB < pEndB; ){int t = *pA - (*pB++)<