X-Git-Url: http://git.euphorik.ch/?p=master-thesis.git;a=blobdiff_plain;f=Parasitemia%2FParasitemia%2FParasitesMarker.fs;h=a6fce83b4f06a9d0739311bb051b04697e55222f;hp=720488d8bcc61e9322f061e651d6f20a539d90cb;hb=05be8164d308447b916544ae3ce4211500dfd8da;hpb=6b550c3faf4dea77738fa5c27cd9af277f45549c diff --git a/Parasitemia/Parasitemia/ParasitesMarker.fs b/Parasitemia/Parasitemia/ParasitesMarker.fs index 720488d..a6fce83 100644 --- a/Parasitemia/Parasitemia/ParasitesMarker.fs +++ b/Parasitemia/Parasitemia/ParasitesMarker.fs @@ -51,17 +51,17 @@ let findMa (green: Image) (filteredGreen: Image) ( // * 'Infection' corresponds to the parasite. It shouldn't contain thrombocytes. let find (filteredGreen: Image) (config: Config.Config) : Result * Image = use filteredGreenWithoutInfection = filteredGreen.Copy() - ImgTools.areaCloseF filteredGreenWithoutInfection (int config.InfectionArea) + ImgTools.areaCloseF filteredGreenWithoutInfection (int config.RBCRadius.InfectionArea) let filteredGreenWithoutStain = filteredGreenWithoutInfection.Copy() - ImgTools.areaCloseF filteredGreenWithoutStain (int config.StainArea) + ImgTools.areaCloseF filteredGreenWithoutStain (int config.RBCRadius.StainArea) - // We use the filtered image to find the dark stain. - let _, mean_fg, mean_bg = - let hist = ImgTools.histogramImg filteredGreenWithoutInfection 300 - ImgTools.otsu hist - - let darkStain = filteredGreenWithoutInfection.Cmp(-(float mean_bg) * config.Parameters.darkStainLevel + (float mean_fg), CvEnum.CmpType.LessThan) + let darkStain = + // We use the filtered image to find the dark stain. + let _, mean_fg, mean_bg = + let hist = ImgTools.histogramImg filteredGreenWithoutInfection 300 + ImgTools.otsu hist + filteredGreenWithoutInfection.Cmp(-(float mean_bg) * config.Parameters.darkStainLevel + (float mean_fg), CvEnum.CmpType.LessThan) let marker (img: Image) (closed: Image) (level: float) : Image = let diff = img.Copy() @@ -70,8 +70,15 @@ let find (filteredGreen: Image) (config: Config.Config) : Result diff._ThresholdBinary(Gray(0.0), Gray(255.)) diff.Convert() - let infectionMarker = marker filteredGreen filteredGreenWithoutInfection config.Parameters.infectionLevel - let stainMarker = marker filteredGreenWithoutInfection filteredGreenWithoutStain config.Parameters.stainLevel + let infectionMarker = marker filteredGreen filteredGreenWithoutInfection (1. / config.Parameters.infectionSensitivity) + let stainMarker = marker filteredGreenWithoutInfection filteredGreenWithoutStain (1. / config.Parameters.stainSensitivity) + + // TODO: comprendre pourquoi des valeurs sont negatives!?!? + (* + let blackTopHat = filteredGreen.CopyBlank() + CvInvoke.Subtract(filteredGreenWithoutInfection, filteredGreen, blackTopHat) + ImgTools.saveImg (ImgTools.normalizeAndConvert blackTopHat) "BottomHat.png" + *) { darkStain = darkStain infection = infectionMarker