hi
i want to find the correlation coefficient between two images, so i have to apply mathmatical equations on them.
i want to ask how can i convert the image to a form that can deal with maths' operator like -, /, XOR after reading it from a file.
i try to convert it to byte or a string to make calculations but that does not work! :cry:
You will have to read the image into a two dimensional structure, maybe a two dimensional array, and then apply the operations to corresponding elements at position x and y.
hi
thanks for your reply;
i deal with two black and white images(binary images); and want to make correlation method calculations on them to find correlation coefficient.
so the pixel value is (0,0,0) for black or (1,1,1) for white.
that i use the GetPixel then test if its black or white and set an integer to 0 if black or 1 if white.
and then deal with these integer instead of converting the images to array int as you suggest.
this is the code below; its behind the correlation coeff button; I have error when debugging at the bold font:
note: im sure that both images have the same size.
any suggestions...
int q=0;
int w=0;
Bitmap a = (Bitmap)Image.FromFile("C:\\standard\\test1.bmp");
Bitmap b = (Bitmap)Image.FromFile("C:\\standard\\test2.bmp");
int x=0;
int y=0;
int i=0;
int j=0;
for(i=0;i<=a.Height;i++)
{
for(j=0;j<=a.Width;j++)
{ Color c=a.GetPixel(i,j);
Color r=b.GetPixel(i,j);
NAN is short for "Not A Number". You get this for values like infinity. Check the values of sss and (s*s)+(ss*ss). Most probably either both of them are 0 or the (s*s)+(ss*ss)value is zero. You should know already that 0 divided by 0 is undefined and any number defined by 0 is also undefined. You should check for these conditions before dividing.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.