Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC++
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 7:25am

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

  Print Answers RSS
0 OriginalGriff 195
1 Afzaal Ahmad Zeeshan 132
2 ProgramFOX 130
3 Maciej Los 115
4 Sergey Alexandrovich Kryukov 75
0 OriginalGriff 6,564
1 Sergey Alexandrovich Kryukov 6,048
2 DamithSL 5,228
3 Manas Bhardwaj 4,657
4 Maciej Los 4,150


Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 14 Jan 2013
Copyright © CodeProject, 1999-2014
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