Exemplo n.º 1
0
        /// <summary>
        /// Initializes the parallel processor.
        /// </summary>
        /// <param name="imageSize">Image size.</param>
        /// <param name="destImageCreator">Destination image creator.</param>
        /// <param name="processPatch">Process patch func. The function will execute on every patch.</param>
        /// <param name="parallelOptions">Parallel options.</param>
        /// <param name="minPatchHeight">Minimal patch height. Put 0 if there are no preferences.</param>
        protected void Initialize(Size imageSize, FieldCreator destImageCreator, ProcessPatch processPatch, ParallelOptions2D parallelOptions, int minPatchHeight)
        {
            this.imageSize        = imageSize;
            this.destImageCreator = destImageCreator;
            this.processPatch     = processPatch;
            this.runParallel      = parallelOptions.ShouldProcessParallel(imageSize); //assume depth = sizeof(byte)

            if (runParallel)                                                          //do not build structures if they are not needed
            {
                makePatches(imageSize, minPatchHeight, out patches);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates parallel patch processor.
 /// </summary>
 /// <param name="imageSize">2D structure size.</param>
 /// <param name="destFieldCreator">Function that creates destination structure.</param>
 /// <param name="processPatch">Function that performs patch processing.</param>
 /// <param name="parallelOptions">Parallel options.</param>
 /// <param name="minPatchHeight">Minimal patch height. Patches that has lower size will not be created.</param>
 public ParallelProcessor(Size imageSize, FieldCreator destFieldCreator, ProcessPatch processPatch, ParallelOptions2D parallelOptions, int minPatchHeight = 0)
 {
     Initialize(imageSize, destFieldCreator, processPatch, parallelOptions, minPatchHeight);
 }