Untitled

 avatar
unknown
plain_text
10 months ago
875 B
11
Indexable
LONG CBaseMotionDetector::CompareBinaryMask(const vector<BYTE>& input, const SIZE& m_sizeImage, const RECT* _prcDetectArea)
{
	// The CompareBinaryMask is looking at the input as the equivalent of a bitmask, in a YUV sense. The input pixels will be the Luma
	// min or the Luma max so we're just counting up the number of "non-black" pixels, where non-black indicates motion.
	//
	LONG lTotalDiffFactor = 0;

	for (INT Line = _prcDetectArea->top; Line < _prcDetectArea->bottom; Line++)
	{
		const DWORD dwStartOffset = (Line * (m_sizeImage.cx)) + (_prcDetectArea->left);
		LONG LineFactor = 0;

		for (int i = 0; i < (_prcDetectArea->right - _prcDetectArea->left); i++)
		{
			if (input[dwStartOffset + i] == FOREGROUND_PIXEL)
				LineFactor += 1;
		}

		lTotalDiffFactor += (LineFactor * GridSizeScaleFactor() * 0.50);
	}

	return lTotalDiffFactor;

}
Editor is loading...
Leave a Comment