3

In particular, I want to generate a tolerance interval, for which I would need to have the values of Zx for x some value on the standard normal.

Does the Java standard library have anything like this, or should I roll my own?

EDIT: Specifically, I'm looking to do something akin to linear regression on a set of images. I have two images, and I want to see what the degree of correlation is between their pixels. I suppose this might fall under computer vision as well.

Alex
  • 22,845
  • 25
  • 92
  • 147
  • Is it really necessary to use Java? Why not use R, SPSS or Mathematica? Seems overkill to reinvent the wheel, although it would be awesome how to learn to do that!:) – David Weiser Jan 12 '11 at 16:56
  • Java is necessary, yes. As for learning how to do that, I've got a good deal of statistics in place, I'm just trying to write as lean an implementation as possible. – Alex Jan 12 '11 at 17:08
  • What exactly are you trying to do? Are you trying to identify if two images are basically identical? Cluster images into groups? What is it that your tolerance interval is tolerating? You might want to check out some related questions here ([one](http://stackoverflow.com/questions/4196453/simple-and-fast-method-to-compare-images-for-similarity), [two](http://stackoverflow.com/questions/596262/image-fingerprint-to-compare-similarity-of-many-images)) and see if that helps you to clarify your question. – Matt Parker Jan 12 '11 at 21:45
  • (Hmm, are we only allowed one link per comment? Can't see why only one of those is working) – Matt Parker Jan 12 '11 at 21:47
  • related question : http://stackoverflow.com/questions/448643/statistical-library-for-java – Joris Meys Jan 14 '11 at 12:31

3 Answers3

1

Simply calculate Pearson correlation coefficient between those two images. You will have 3 coefficients because of R,G,B channels needs to be analyzed separately. Or you can calculate 1 coefficient just for intensity levels of images,... or you could calculate correlation between Hue values of images after converting to HSV or HSL color space. Do whatever your see fits :-)

EDIT: Correlation coefficient may be maximized only after scaling and/or rotating some image. This may be a problem or not - depends on your needs.

Agnius Vasiliauskas
  • 10,413
  • 5
  • 46
  • 66
  • Pearson correlation coefficient is not going to give you the answer you're looking for. I'd rather use methods based on Fourier or other transformations for that. – Joris Meys Jan 20 '11 at 12:08
  • Could you please be more specific and explain Why Pearson correlation coefficient is not suitable here ? – Agnius Vasiliauskas Jan 20 '11 at 13:28
1

You can use the complete statistical power of R using rJava/JRI. This includes correlations between pixels and so on.

Another option is to look around at imageJ, which contains libraries for many image manipulations, mathematics and statistics. It's an application allright, but the library is useable in development as well. It comes with an extensive developers manual. On a sidenote, imageJ can be combined with R as well.

imageJ allows you to use the correct methods for finding image similarity measures, based on fourier transformations or other methods. More info can be found in Digital Image Processing with Java an ImageJ. See also this paper.

Another one is the Commons-Math. This one also contains the basic statistical tools.

See also the answers on this question and this question.

Community
  • 1
  • 1
Joris Meys
  • 98,937
  • 27
  • 203
  • 258
0

It seems you want to compare to images to see how similar they are. In this case, the first two things to try are SSD (sum of squared differences) and normalized correlation (this is closely related to what 0x69 suggests, Pearson correlation) between the two images.

You can also try normalized correlation over small (corresponding) windows in the two images and add up the results over several (all) small windows in the image.

These two are very simple methods which you can write in a few minutes.

I'm not sure however what this has to do with hypothesis testing or linear regression, you might want to edit to clarify this part of your question.

carlosdc
  • 11,578
  • 3
  • 38
  • 60