Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. //3. show the resulting 2D Gaussian probability distribution
  2. float[][] gaussian_distribution = new float[256][256];
  3. for (double[] rg_value : rg_values)
  4. {
  5. int[] rg = new int[2];
  6. rg[0] = (int) (rg_value[0]*255);
  7. rg[1] = (int) (rg_value[1]*255);
  8. double distance = md.distance(rg_value);
  9. double prob = Math.exp(-(Math.pow(distance, 2)/2.0));
  10. gaussian_distribution[rg[0]][rg[1]] += (float) prob;
  11. }
  12.  
  13. FloatProcessor fp_Gaussian_Prob = new FloatProcessor(gaussian_distribution);
  14. //fp_Gaussian_Prob.setMinAndMax(0.0, 100);
  15. new ImagePlus("Gaussian probability distribution", fp_Gaussian_Prob).show();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement