No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

Histogram.cs

Description du code

Histogram.cs est un fichier du projet PhotoBrol.
Ce fichier est situé dans /var/www/bin/sniplets/bibliobrol/photobrol/.

Projet PhotoBrol :

Editeur d'images en CSharp.

Code source ou contenu du fichier

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace be.gaudry.model.math
  6. {
  7. public class Histogram
  8. {
  9. private int[] values;
  10. private double mean = 0;
  11. private double stdDev = 0;
  12. private int median = 0;
  13. private int min;
  14. private int max;
  15.  
  16. /// <summary>
  17. /// Values of the histogram
  18. /// </summary>
  19. ///
  20. public int[] Values
  21. {
  22. get { return values; }
  23. }
  24.  
  25. /// <summary>
  26. /// Mean value
  27. /// </summary>
  28. ///
  29. public double Mean
  30. {
  31. get { return mean; }
  32. }
  33.  
  34. /// <summary>
  35. /// Standard deviation
  36. /// </summary>
  37. ///
  38. public double StdDev
  39. {
  40. get { return stdDev; }
  41. }
  42.  
  43. /// <summary>
  44. /// Median value
  45. /// </summary>
  46. ///
  47. public int Median
  48. {
  49. get { return median; }
  50. }
  51.  
  52. /// <summary>
  53. /// Minimum value
  54. /// </summary>
  55. ///
  56. /// <remarks>Minimum value of the histogram with non zero
  57. /// hits count.</remarks>
  58. ///
  59. public int Min
  60. {
  61. get { return min; }
  62. }
  63.  
  64. /// <summary>
  65. /// Maximum value
  66. /// </summary>
  67. ///
  68. /// <remarks>Maximum value of the histogram with non zero
  69. /// hits count.</remarks>
  70. ///
  71. public int Max
  72. {
  73. get { return max; }
  74. }
  75.  
  76. /// <summary>
  77. /// Initializes a new instance of the <see cref="Histogram"/> class
  78. /// </summary>
  79. ///
  80. /// <param name="values">Values of the histogram</param>
  81. ///
  82. public Histogram(int[] values)
  83. {
  84. this.values = values;
  85.  
  86. int i, n = values.Length;
  87.  
  88. max = 0;
  89. min = n;
  90.  
  91. // calculate min and max
  92. for (i = 0; i < n; i++)
  93. {
  94. if (values[i] != 0)
  95. {
  96. // max
  97. if (i > max)
  98. max = i;
  99. // min
  100. if (i < min)
  101. min = i;
  102. }
  103. }
  104.  
  105. mean = Statistics.Mean(values);
  106. stdDev = Statistics.StdDev(values);
  107. median = Statistics.Median(values);
  108. }
  109.  
  110. /// <summary>
  111. /// Get range around median containing specified percentage of values
  112. /// </summary>
  113. ///
  114. /// <param name="percent">Values percentage around median</param>
  115. ///
  116. /// <returns>Returns the range which containes specifies percentage
  117. /// of values.</returns>
  118. ///
  119. public IntRange GetRange(double percent)
  120. {
  121. return Statistics.GetRange(values, percent);
  122. }
  123. }
  124. }

Structure et Fichiers du projet

Afficher/masquer...


Répertoires contenus dans /var/www/bin/sniplets/bibliobrol/photobrol/model/math/ 
IcôneNomTailleModification
Pas de sous-répertoires.
IcôneNomTailleModification
| _ Répertoire parent0 octets1718522003 16/06/2024 09:13:23
Fichiers contenus dans /var/www/bin/sniplets/bibliobrol/photobrol/model/math/ 
IcôneNomTailleModificationAction
IcôneNomTailleModificationAction
Afficher le fichier .cs|.csStatistics.cs6.11 Ko31/10/2018 18:32:51-refusé-
Afficher le fichier .cs|.csIntRange.cs2.64 Ko31/10/2018 18:32:51-refusé-
Afficher le fichier .cs|.csHistogram.cs2.96 Ko31/10/2018 18:32:51-refusé-

Utilisation de l'explorateur de code

  • Navigation :
    • Un clic sur une icône de répertoire ouvre ce répertoire pour en afficher les fichiers.
    • Lorsque le répertoire en cours ne contient pas de sous-répertoires il est possible de remonter vers le répertoire parent.
    • La structure de répertoires en treetable (tableau en forme d'arborescence) n'est plus possibledans cette version.
    • Un clic sur une icône de fichier ouvre ce fichier pour en afficher le code avec la coloration syntaxique adaptée en fonction du langage principal utilisé dans le fichier.
  • Affichage :
    • Il est possible de trier les répertoires ou les fichiers selon certains critères (nom, taille, date).
  • Actions :
    • Les actions possible sur les fichiers dépendent de vos droits d'utilisateur sur le site. Veuillez activer le mode utilisateur pour activer les actions.

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 30/10/2009, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/cs-photobrol-source-rf-model/math//Histogram.cs.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.