- let fgFloat = (fg / 255.0).Convert<Gray, float32>()
- use greenWithoutBg = ImgTools.gaussianFilter green 1.0
- greenWithoutBg.SetValue(Gray(0.0), fg.Not())
-
- let findSmears (sigma: float) (level: float) : Image<Gray, byte> =
- use greenWithoutBgSmoothed = ImgTools.gaussianFilter greenWithoutBg sigma
- use fgSmoothed = ImgTools.gaussianFilter fgFloat sigma
- let smears = (greenWithoutBg.Mul(fgSmoothed)).Cmp(greenWithoutBgSmoothed.Mul(level), CvEnum.CmpType.LessThan)
- smears._And(fg)
- smears
-
- let tmp = filteredGreen.Convert<Gray, byte>()
-
- { darkStain = darkStain;
- stain = findSmears 10. 0.9
- infection = findSmears 2.2 0.87 },
- tmp,
- tmp
-
-// Create three binary markers :
-// * 'Dark stain' corresponds to the colored pixel, it's independent of the size of the areas.
-// * 'Stain' corresponds to the stain around the parasites.
-// * 'Infection' corresponds to the parasite. It shouldn't contain thrombocytes.
-let find (img: Image<Gray, float32>) (config: Config.Config) : Result * Image<Gray, float32> * Image<Gray, float32> =
-
- let imgFilteredInfection = ImgTools.gaussianFilter img config.LPFStandardDeviationParasite
- let filteredGreenWithoutInfection = imgFilteredInfection.Copy()
- ImgTools.areaCloseF filteredGreenWithoutInfection (roundInt config.RBCRadius.NucleusArea)
-
- (*
- let filteredGreenWithoutStain = filteredGreenWithoutInfection.Copy()
- ImgTools.areaCloseF filteredGreenWithoutStain (int config.RBCRadius.StainArea) *)