how compare pixels?
I write LBP algorithm. I need compare pixels. I do it correctly?
std::vector<int>s;
cv::Vec3b middelPixel = frame.at<cv::Vec3b>(i0 + 1, j0 + 1);
for (size_t i = i0; i < i0 + 3; i++)
{
for (size_t j = j0; j < j0 + 3; j++)
{
cv::Vec3b tempPixel = frame.at<cv::Vec3b>(i, j);
if ((int)middelPixel[0] + (int)middelPixel[1] + (int)middelPixel[2] >= (int)tempPixel[0] + (int)tempPixel[1] + (int)tempPixel[2])
s.push_back(1);
else
s.push_back(0);
}
}
{i0, j0} = {0, 0}, {0, 3}, {0, 6}....{3,0},..., {6,0}...
have a look here
you should do this on single channel (grayscale) images, not on bgr ones.
you also have to spare the "middle" element, since that's already the center pixel (that's actually wrong above !)
but if you do it like this, don't forget, that you have to spare 3 pixels, at the right / bottom border of your image !
@berak, Thank you!!!