Click here to Skip to main content
14,970,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to apply simple average image fusion algorithm using the following function...
C++
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

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




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900