X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=blobdiff_plain;f=Parasitemia%2FParasitemiaCore%2FGranulometry.fs;h=877df99384d1f2671cd7481fc3d34dc3f78dfc9f;hp=b325534b04c815beab9ac4a1221264fd7c0ef23a;hb=04d4504e7b248a82ddfc1a41d325e59d24146590;hpb=276f1c9741f196e022bdbd175b4f6ef0ebb6367d diff --git a/Parasitemia/ParasitemiaCore/Granulometry.fs b/Parasitemia/ParasitemiaCore/Granulometry.fs index b325534..877df99 100644 --- a/Parasitemia/ParasitemiaCore/Granulometry.fs +++ b/Parasitemia/ParasitemiaCore/Granulometry.fs @@ -1,6 +1,7 @@ module ParasitemiaCore.Granulometry open System +open System.IO open System.Drawing open Emgu.CV @@ -24,7 +25,7 @@ let findRadiusByClosing (img: Image) (range: int * int) (scale: f let intensityImg = scaledImg.GetSum().Intensity // 's' must be odd. - let octagon (s: int) : Mat = + let octagon (s: int) : Matrix = if s % 2 = 0 then failwith "s must be odd" let m = new Matrix(Array2D.create s s 1uy) let r = (float s) / (Math.Sqrt 2. + 2.) |> roundInt @@ -36,12 +37,12 @@ let findRadiusByClosing (img: Image) (range: int * int) (scale: f m.[s - i - 1, j] <- 0uy m.[i, s - j - 1] <- 0uy m.[s - i - 1, s - j - 1] <- 0uy - m.Mat + m let mutable previous_n = Double.NaN for r in r1' .. r2' do let se = if useOctagon - then octagon (2 * r - 1) // It doesnd't speed up the process. + then (octagon (2 * r - 1)).Mat // It doesn't speed up the process. else CvInvoke.GetStructuringElement(CvEnum.ElementShape.Ellipse, Size(2 * r, 2 * r), Point(-1, -1)) use closed = scaledImg.MorphologyEx(CvEnum.MorphOp.Close, se, Point(-1, -1), 1, CvEnum.BorderType.Replicate, MCvScalar(0.0))