Click here to Skip to main content
12,953,743 members (46,678 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
I am trying to apply simple average image fusion algorithm using the following function...
System::Void PanSharp::SA_btn_Click(System::Object^  sender, System::EventArgs^  e)
	{
		
		if(SA_Rbuffer!=NULL)
			CPLFree((void*)SA_Rbuffer);
 
		SA_Rbuffer = (float *)CPLMalloc(sizeof(float)*test_open::width*test_open::height);
		
		k=0;
		for (i=0;i<test_open::height;i++)
		{
			for (j=0;j<test_open::width;j++)
			{
				*(SA_Rbuffer+k) = (float)(((*(Panbuffer+k)) + (*(Rbuffer+k)))/2);
			}
		}
		fusedImage = gcnew System::Drawing::Bitmap(test_open::width,test_open::height,PixelFormat::Format24bppRgb);
		k=0;
		for (j=0;j<test_open::height;j++)
		{
			for (i=0;i<test_open::width;i++)
			{
				Color newcolor = Color::FromArgb((unsigned char)(*(SA_Rbuffer+k)),(unsigned char)(*(Gbuffer+k)),(unsigned char)(*(Bbuffer+k)));
				fusedImage->SetPixel(i,j,newcolor);
				k++;
			}
		}
 
		fusedPicBox->Visible = true;
		fusedPicBox->Image = fusedImage;
		String^ finalImageName = "..\\images\\finalfusedresult_SA.tif";
		fusedImage->Save(finalImageName,System::Drawing::Imaging::ImageFormat::Tiff);
	}


The problem is that all the values in SA_Rbuffer are coming 0. The red band is having all values as zero and I don't know the reason.
Please help me...
Posted 14-Jan-13 6:25am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,429
CHill60 3,490
Maciej Los 3,103
ppolymorphe 2,020
Jochen Arndt 1,975


Advertise | Privacy | Mobile
Web01 | 2.8.170525.1 | Last Updated 14 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100