void fast_BilateralFilter::doBilateralFilter( const IplImage *SrcImageL, IplImage *result )
{
	m_ImageHeight = SrcImageL->height;
	m_ImageWidth  = SrcImageL->width;

	unsigned int temp = m_KernelSize / 2 + 1;

	double *UnitedImageL  = new double[m_ImageHeight * m_ImageWidth];
	double *UnitedResult  = new double[m_ImageHeight * m_ImageWidth];
	double *ParamDistance = new double[temp * temp];
	double *Wk  = new double[m_ImageHeight * m_ImageWidth * (m_BinNum + 1)];
	double *Jk  = new double[m_ImageHeight * m_ImageWidth * (m_BinNum + 1)];
	double *JkB = new double[m_ImageHeight * m_ImageWidth * (m_BinNum + 1)];

	m_ResultImg = result;

	GetImageContent( SrcImageL, UnitedImageL );
	GetParamDistance( ParamDistance );
	GetWkJk( UnitedImageL, Wk, Jk );
	GetJkB( Wk, Jk, ParamDistance, JkB );
	delete ParamDistance;
	delete Wk;
	delete Jk;
	GetUnitedResult( UnitedImageL, JkB, UnitedResult );
	delete UnitedImageL;
	delete JkB;
	ExtractImage( UnitedResult );
	delete UnitedResult;
}
예제 #2
0
 void FluidLauncher::populateFileBrowser(QStringList config) {
//qWarning("populateFileBrowser\n");

     Config = config;

     QString path = Config.at(0);
     QString filter = Config.at(1);
     dir.cd(path);
     //     QMessageBox::information(mainwindow,"new path",dir.absolutePath(),QMessageBox::Ok);
     dir.setFilter(QDir::Files | QDir::NoSymLinks | QDir::AllDirs | QDir::NoDot);
     dir.setSorting(QDir::DirsFirst | QDir::Name | QDir::IgnoreCase);

     QFileInfoList list = dir.entryInfoList(QStringList() << filter);

     pictureFlowWidget->setSlideCount(list.count());

     for (int i = 0; i < list.size(); ++i) {
         QFileInfo fileInfo = list.at(i);
         QImage *img = new QImage();

         if (fileInfo.isFile()) {
             img = new QImage(ExtractImage(fileInfo));
         }
         else if (fileInfo.isDir()) {
             img->load(":/core/folder.png");
         }

         QStringList sl;
         if (fileInfo.isDir()) sl.append("Dir");
         if (fileInfo.isFile()) sl.append("File");

         Launcher* newDemo = new Launcher(
                     list.at(i).fileName(),
                     list.at(i).fileName(),
                     list.at(i).fileName(),
                     "",
                     sl);
         demoList.append(newDemo);
         pictureFlowWidget->setSlide(i, *img);
         pictureFlowWidget->setSlideCaption(i, list.at(i).fileName());
         delete img;
     }
     pictureFlowWidget->setCurrentSlide(list.count()/2);
 }
예제 #3
0
void WorkThread::run()
{
	std::wstring srcDevInfo = m_srcPath + L"\\DeviceInfo";
	std::wstring dstDevInfo = m_dstPath + L"\\DeviceInfo";

	CopyFile(srcDevInfo.c_str(), dstDevInfo.c_str(), FALSE);

	srcDevInfo = m_srcPath + L"\\Device_Info.xml";
	dstDevInfo = m_dstPath + L"\\Device_Info.xml";

	CopyFile(srcDevInfo.c_str(), dstDevInfo.c_str(), FALSE);


	if ( m_extractFile )
		ExtractFile();

	if ( m_mergeFile )
		ExtractImage();
}
//////////////////////////////////////////////////////////////////////
// feature_Factory::CreateFeatureImages() //       \author Logan Jones
///////////////////////////////////////////            \date 2/15/2002
//               
//====================================================================
// Parameters:
//  FeatureFileInfo_t* pFeatureFileInfo - 
//  FeatureType_t* pNewFeatureType      - 
//
// Return: BOOL - 
//
BOOL feature_Factory::CreateFeatureImages( FeatureFileInfo_t* pFeatureFileInfo, FeatureType_t* pNewFeatureType )
{
	BOOL					bResult = FALSE;
	LPTA_GAF_FRAME_DATA		pFrameData;
	gfx_Image_t				Image;
	LPTA_GAF_FRAME_DATA		pShadowFrameData;
	gfx_Image_t				ShadowImage;
	gfx_Image_t				FinalImage;

	assert( m_CurrentAnimFile );

	// Start loading the images
	BEGIN_CODE_BLOCK
	{

		// Its not really a feature if there is no image now is there
		if( !StringIsValid(pFeatureFileInfo->SeqName) )
		{
			theApp.Console.Comment( CT_LOAD, "ERROR: No sequence name given" );
			EXIT_CODE_BLOCK;
		}

		// Extract the image from the gaf
		if( bFAILED(ExtractImage(pFeatureFileInfo->SeqName,m_CurrentAnimFile,&Image,(BYTE**)&pFrameData)) )
		{
			EXIT_CODE_BLOCK;
		}		

		// Record the image offset and size
		pNewFeatureType->ViewOffset.Set( pFrameData->XOffset, pFrameData->YOffset );
		pNewFeatureType->ViewSize.Set( pFrameData->Width, pFrameData->Height );
		pNewFeatureType->ImageRect.Set( std_Point(pFrameData->XOffset,pFrameData->YOffset), std_Size(pFrameData->Width,pFrameData->Height) );

		// If there is no shadow, there is no need to go on
		if( !StringIsValid(pFeatureFileInfo->SeqNameShad) )
		{
			if( bFAILED(gfx->CreateSprite( &Image, -std_Vector2(pFrameData->XOffset,pFrameData->YOffset), &pNewFeatureType->Image )) )
			{
				theApp.Console.Comment( CT_LOAD, "ERROR: Failed to create a sprite for %s in \'anims/%s.gaf\'", pFeatureFileInfo->SeqName, m_CurrentAnimFileName );
				bResult = FALSE;
			}
			else bResult = TRUE;
			delete [] Image.pBytes;
			pNewFeatureType->Shadow = NULL;
			EXIT_CODE_BLOCK;
		}

		// Extract the image from the gaf
		if( bFAILED(ExtractImage(pFeatureFileInfo->SeqNameShad,m_CurrentAnimFile,&ShadowImage,(BYTE**)&pShadowFrameData)) )
		{
			EXIT_CODE_BLOCK;
		}

		// Calculate the total area needed for the shadow image
		int RightOfShadow = pShadowFrameData->Width - pShadowFrameData->XOffset;
		int LeftOfShadow = pShadowFrameData->Width - RightOfShadow;
		int BelowShadow = pShadowFrameData->Height - pShadowFrameData->YOffset;
		int AboveShadow = pShadowFrameData->Height - BelowShadow;

		// Calculate the total area needed for the feature image
		int RightOfImage = pFrameData->Width - pFrameData->XOffset;
		int LeftOfImage = pFrameData->Width - RightOfImage;
		int BelowImage = pFrameData->Height - pFrameData->YOffset;
		int AboveImage = pFrameData->Height - BelowImage;

		// Determine the need size of the resulting melded texture
		int RightOfTexture = (RightOfShadow > RightOfImage) ? RightOfShadow : RightOfImage;
		int LeftOfTexture = (LeftOfShadow > LeftOfImage) ? LeftOfShadow : LeftOfImage;
		int BelowTexture = (BelowShadow > BelowImage) ? BelowShadow : BelowImage;
		int AboveTexture = (AboveShadow > AboveImage) ? AboveShadow : AboveImage;

		// Set up the final image structure
		FinalImage.Size.Set( RightOfTexture + LeftOfTexture, BelowTexture + AboveTexture );
		FinalImage.Pitch = FinalImage.Size.width;
		FinalImage.Stride = 1;
		FinalImage.pBytes = new BYTE[ *FinalImage.Size ];
		memset( FinalImage.pBytes, PALETTE_CLEAR, *FinalImage.Size );

		// Place the shadow in the final image at its offset
		BYTE* pFinal = FinalImage.pBytes + ( ((AboveTexture-AboveShadow)*FinalImage.Pitch) + (LeftOfTexture-LeftOfShadow) );
		BYTE* pShadow= ShadowImage.pBytes;
		for( DWORD y=0; y<pShadowFrameData->Height; y++)
		{
			for( DWORD x=0; x<pShadowFrameData->Width; x++)
				if( pShadow[x]!=PALETTE_CLEAR && pShadow[x]!=PALETTE_CLEAR2 )
					pFinal[x] = PALETTE_SHADOW;
			pFinal += FinalImage.Pitch;
			pShadow += ShadowImage.Pitch;
		}
		delete [] ShadowImage.pBytes;

		// Place the feature in the final image at its offset
		pFinal = FinalImage.pBytes + ( ((AboveTexture-AboveImage)*FinalImage.Pitch) + (LeftOfTexture-LeftOfImage) );
		BYTE* pFeature = Image.pBytes;
		for( y=0; y<pFrameData->Height; y++)
		{
			for( DWORD x=0; x<pFrameData->Width; x++)
				if( pFeature[x]!=PALETTE_CLEAR && pFeature[x]!=PALETTE_CLEAR2 )
					pFinal[x] = pFeature[x];
			pFinal += FinalImage.Pitch;
			pFeature += Image.Pitch;
		}
		delete [] Image.pBytes;

		// Record the image offset and size
		pNewFeatureType->ViewOffset.Set( LeftOfTexture, AboveTexture );
		pNewFeatureType->ViewSize = FinalImage.Size;
		pNewFeatureType->ImageRect.Set( pNewFeatureType->ViewOffset, FinalImage.Size );

		// Create the surface
		if( bFAILED(gfx->CreateSprite( &FinalImage, -std_Vector2(LeftOfTexture,AboveTexture), &pNewFeatureType->Image )) )
		{
			theApp.Console.Comment( CT_LOAD, "ERROR: Failed to create a combined sprite for %s in \'anims/%s.gaf\'", pFeatureFileInfo->SeqName, m_CurrentAnimFileName );
			delete [] FinalImage.pBytes;
			EXIT_CODE_BLOCK;
		}
		delete [] FinalImage.pBytes;

		bResult = TRUE;
	}
	END_CODE_BLOCK
	// End loading the images

	return bResult;
}