projects
/
master-thesis.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleaning.
[master-thesis.git]
/
Parasitemia
/
ParasitemiaCore
/
ImgTools.fs
diff --git
a/Parasitemia/ParasitemiaCore/ImgTools.fs
b/Parasitemia/ParasitemiaCore/ImgTools.fs
index
cc15af7
..
44a6c86
100644
(file)
--- a/
Parasitemia/ParasitemiaCore/ImgTools.fs
+++ b/
Parasitemia/ParasitemiaCore/ImgTools.fs
@@
-43,7
+43,7
@@
let histogramImg (img: Image<Gray, float32>) (nbSamples: int) : Histogram =
img.MinMax(min, max, minLocation, maxLocation)
float32 (!min).[0], float32 (!max).[0]
img.MinMax(min, max, minLocation, maxLocation)
float32 (!min).[0], float32 (!max).[0]
- let bin (x: float32) : int =
+ let
inline
bin (x: float32) : int =
let p = int ((x - min) / (max - min) * float32 nbSamples)
if p >= nbSamples then nbSamples - 1 else p
let p = int ((x - min) / (max - min) * float32 nbSamples)
if p >= nbSamples then nbSamples - 1 else p
@@
-67,7
+67,7
@@
let histogramMat (mat: Matrix<float32>) (nbSamples: int) : Histogram =
mat.MinMax(min, max, minLocation, maxLocation)
float32 !min, float32 !max
mat.MinMax(min, max, minLocation, maxLocation)
float32 !min, float32 !max
- let bin (x: float32) : int =
+ let
inline
bin (x: float32) : int =
let p = int ((x - min) / (max - min) * float32 nbSamples)
if p >= nbSamples then nbSamples - 1 else p
let p = int ((x - min) / (max - min) * float32 nbSamples)
if p >= nbSamples then nbSamples - 1 else p
@@
-90,7
+90,7
@@
let histogram (values: float32 seq) (nbSamples: int) : Histogram =
if v < min then min <- v
if v > max then max <- v
if v < min then min <- v
if v > max then max <- v
- let bin (x: float32) : int =
+ let
inline
bin (x: float32) : int =
let p = int ((x - min) / (max - min) * float32 nbSamples)
if p >= nbSamples then nbSamples - 1 else p
let p = int ((x - min) / (max - min) * float32 nbSamples)
if p >= nbSamples then nbSamples - 1 else p
@@
-201,7
+201,6
@@
let findEdges (img: Image<Gray, float32>) : Matrix<byte> * Image<Gray, float32>
let thresholdHigh, thresholdLow =
let sensibilityHigh = 0.1f
let sensibilityLow = 0.0f
let thresholdHigh, thresholdLow =
let sensibilityHigh = 0.1f
let sensibilityLow = 0.0f
- use magnitudesByte = magnitudes.Convert<byte>()
let threshold, _, _ = otsu (histogramMat magnitudes 300)
threshold + (sensibilityHigh * threshold), threshold - (sensibilityLow * threshold)
let threshold, _, _ = otsu (histogramMat magnitudes 300)
threshold + (sensibilityHigh * threshold), threshold - (sensibilityLow * threshold)