Cleaning + renaming.
[master-thesis.git] / Parasitemia / ParasitemiaCore / ImgTools.fs
index 51b0c19..cbb65b4 100644 (file)
@@ -49,12 +49,7 @@ let mergeChannelsWithProjection (img: Image<Bgr, float32>) (v1r: float32, v1g: f
 
 // Normalize image values between 0uy and 255uy.
 let normalizeAndConvert (img: Image<Gray, 'TDepth>) : Image<Gray, byte> =
-    let min = ref [| 0.0 |]
-    let minLocation = ref <| [| Point() |]
-    let max = ref [| 0.0 |]
-    let maxLocation = ref <| [| Point() |]
-    img.MinMax(min, max, minLocation, maxLocation)
-    ((img.Convert<Gray, float32>() - (!min).[0]) / ((!max).[0] - (!min).[0]) * 255.0).Convert<Gray, byte>()
+    (normalize (img.Convert<Gray, float32>()) 255.).Convert<Gray, byte>()
 
 let saveImg (img: Image<'TColor, 'TDepth>) (filepath: string) =
     img.Save(filepath)