- for c in 0..xEdges.Cols-1 do
- xEdgesData.[0, c, 0] <- 0.0
- xEdgesData.[xEdges.Rows-1, c, 0] <- 0.0
- yEdgesData.[0, c, 0] <- 0.0
- yEdgesData.[xEdges.Rows-1, c, 0] <- 0.0
-
- use magnitudes = new Matrix<float>(xEdges.Size)
- CvInvoke.CartToPolar(xEdges, yEdges, magnitudes, new Mat()) // Compute the magnitudes (without angles).
-
- let min = ref 0.0
- let minLocation = ref <| Point()
- let max = ref 0.0
- let maxLocation = ref <| Point()
- magnitudes.MinMax(min, max, minLocation, maxLocation)
-
- use magnitudesByte = ((magnitudes / !max) * 255.0).Convert<byte>() // Otsu from OpenCV only support 'byte'.
- use edges = new Matrix<byte>(xEdges.Size)
- CvInvoke.Threshold(magnitudesByte, edges, 0.0, 1.0, CvEnum.ThresholdType.Otsu ||| CvEnum.ThresholdType.Binary) |> ignore
-
- logTime "Finding edges" (fun() -> thin edges)
- logTime "Removing small connected components from thinning" (fun () -> removeArea edges 12)
-
- (*
- let kmediansResults = KMedians.kmedians filteredGreen 1.0
-
- let parasites = ParasitesMarker.find green filteredGreen kmediansResults config
-
- let radiusRange = config.scale * config.minRBCSize, config.scale * config.maxRBCSize
- let windowSize = roundInt (1.6 * (snd radiusRange))
- let factorNbPick = 1.5
- let ellipses = logTime "Finding ellipses" (fun () ->
- Ellipse.find edges xEdges yEdges radiusRange windowSize factorNbPick)
-
- let cells = logTime "Classifier" (fun () -> Classifier.findCells ellipses parasites kmediansResults.fg config)
- *)
- let cells = []