Add modules to perform 8 and 9 bits frame difference

This commit is contained in:
jfmcarreira committed 2015-10-21 17:25:52 +01:00
1 parent f805434592
commit d7e54c059c
5 files changed
+146 -2

No files matched your search

+3 -2
View File
@@ -34,7 +34,7 @@ FrameDifference::FrameDifference()
m_iModuleAPI = MODULE_API_2;
m_iModuleType = FRAME_PROCESSING_MODULE;
m_pchModuleCategory = "Measurements";
m_pchModuleName = "FrameDifference";
m_pchModuleName = "FrameDifference8Bits";
m_pchModuleTooltip = "Measure the difference between two images (Y plane), Y1 - Y2, with max absolute diff of 128";
m_uiModuleRequirements = MODULE_REQUIRES_NEW_WINDOW;
m_uiNumberOfFrames = MODULE_REQUIRES_TWO_FRAMES;
@@ -45,7 +45,7 @@ FrameDifference::FrameDifference()
Bool FrameDifference::create( std::vector<PlaYUVerFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
UInt bitsPixel = ( apcFrameList[0]->getBitsPel() + 1 ) & 0x0F;
UInt bitsPixel = ( apcFrameList[0]->getBitsPel() ) & 0x0F;
m_iMaxDiffValue = ( 1 << ( bitsPixel - 1 ) );
m_pcFrameDifference = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY, bitsPixel );
return true;
@@ -65,6 +65,7 @@ PlaYUVerFrame* FrameDifference::process( std::vector<PlaYUVerFrame*> apcFrameLis
aux_pel_1 = *pInput1PelYUV++;
aux_pel_2 = *pInput2PelYUV++;
diff = aux_pel_1 - aux_pel_2;
diff = diff / 2;
diff = std::min( diff, m_iMaxDiffValue );
diff = std::max( diff, -m_iMaxDiffValue );
diff += m_iMaxDiffValue + 1;