open System
open System.Drawing
+open FSharp.Collections.ParallelSeq
+
open Emgu.CV
open Emgu.CV.Structure
logTime "areaOpen 1" (fun () -> ImgTools.areaOpenF filteredGreen config.Parameters.initialAreaOpen)
- config.RBCRadius <- logTime "Granulometry" (fun() -> Granulometry.findRadius (filteredGreen.Convert<Gray, byte>()) (10, 100) 0.3 |> float32)
+ let r1 = logTime "Granulometry (morpho)" (fun() -> Granulometry.findRadiusByClosing (filteredGreen.Convert<Gray, byte>()) (10, 80) 0.5 |> float32)
+ // let r2 = logTime "Granulometry (area)" (fun() -> Granulometry.findRadiusByAreaClosing filteredGreen (10, 80) |> float32)
+ // log (sprintf "r1: %A, r2: %A" r1 r2)
+ config.RBCRadius <- r1
let secondAreaOpen = int <| config.RBCArea / 3.f
+
if secondAreaOpen > config.Parameters.initialAreaOpen
then
logTime "areaOpen 2" (fun () -> ImgTools.areaOpenF filteredGreen secondAreaOpen)
| _ -> ()
cells
+
+
+let doMultipleAnalysis (imgs: (string * Image<Bgr, byte>) list) (config : Config) : (string * Cell list) list =
+ let nbConcurrentTaskLimit = 4
+ let n = Environment.ProcessorCount
+
+ imgs
+ |> PSeq.map (fun (id, img) -> id, doAnalysis img id (config.Copy()))
+ |> PSeq.withDegreeOfParallelism (if n > nbConcurrentTaskLimit then nbConcurrentTaskLimit else n)
+ |> PSeq.toList
\ No newline at end of file