public IMeasurementResult TakeMeasurement(MeasurementScreenshotsSet inputSet)
        {
            if (!_initializedSkeletonizer)
            {
                _initializedSkeletonizer = true;
                _skeletonizer.Initialize();
            }

            var mainTexture = inputSet.HatchMainTexture;

            var distancesArray = GenerateDistancesArray(mainTexture);
            //var localMaximaArray = GenerateLocalMaximaArray(inputSet.HatchMainTexture2D);
            var localMaximaArray = OldGenerateLocalMaximaArray(inputSet.HatchMainTexture, distancesArray);
            var idArray          = inputSet.IdArray;

            bool[,] idChangesArray = GenerateIdChangesArray(idArray);
            foreach (var id in idArray)
            {
                if (id != 0)
                {
                    _lastIds.Add(id);
                }
            }

            return(new LinesWidthResult()
            {
                DistancesArray = distancesArray,
                LocalMaximaArray = localMaximaArray,
                OutIdArray = idArray,
                IdChagnesArray = idChangesArray
            });
        }
        public IMeasurementResult TakeMeasurement(MeasurementScreenshotsSet inputSet)
        {
            var occurenceArray = inputSet.HatchOccurenceArray;
            var idsArray       = inputSet.IdArray;
            var tParams        = GeneratePixelCountsDict(inputSet.HatchMainTexture, occurenceArray, idsArray);

            return(new StrokesPixelCountResult()
            {
                TParamsPerStroke = tParams, IdsArray = idsArray, OccurenceArray = occurenceArray
            });
        }
        public void TakeMeasurements(int frameNo, MeasurementScreenshotsSet screenshotsSet)
        {
            Debug.Log("R827 RESOLUTION: " + screenshotsSet.HatchMainTexture.Height + " " + screenshotsSet.HatchMainTexture.Width);
            var msw = new MyStopWatch();

            foreach (var gauge in _gauges)
            {
                msw.StartSegment(gauge.ToString());
                var result = gauge.TakeMeasurement(screenshotsSet);
                WriteResultsToFile(frameNo, result);
            }
            Debug.Log(msw.CollectResults());
        }
        public IMeasurementResult TakeMeasurement(MeasurementScreenshotsSet inputSet)
        {
            var fillingInfos = new List <OneBlockSpecificationInformation>(_divisionSettings.BlockCount.X * _divisionSettings.BlockCount.Y);

            for (int bx = 0; bx < _divisionSettings.BlockCount.X; bx++)
            {
                for (int by = 0; by < _divisionSettings.BlockCount.Y; by++)
                {
                    var blockStartPosition  = new IntVector2(bx * _divisionSettings.BlockSize.X, by * _divisionSettings.BlockSize.Y);
                    var allShapePixelsCount = 0;
                    var hatchPixelsCount    = 0;
                    var lightIntensitySum   = 0f;

                    for (int x = blockStartPosition.X;
                         x < Math.Min(blockStartPosition.X + _divisionSettings.BlockSize.X, _divisionSettings.ScreenSize.X);
                         x++)
                    {
                        for (int y = blockStartPosition.Y;
                             y < Math.Min(blockStartPosition.Y + _divisionSettings.BlockSize.Y, _divisionSettings.ScreenSize.Y);
                             y++)
                        {
                            var hatchPix = inputSet.HatchMainTexture.GetPixel(x, y);
                            if (GaugeUtils.PixelLiesOverShape(hatchPix))
                            {
                                allShapePixelsCount++;
                                if (GaugeUtils.PixelLiesOverHatchInShape(hatchPix))
                                {
                                    hatchPixelsCount++;
                                }

                                lightIntensitySum += hatchPix.g;
                            }
                        }
                    }

                    fillingInfos.Add(new OneBlockSpecificationInformation()
                    {
                        AllShapePixels    = allShapePixelsCount,
                        HatchPixels       = hatchPixelsCount,
                        BlockPosition     = new IntVector2(bx, by),
                        LightIntensitySum = lightIntensitySum
                    });
                }
            }
            return(new BlockSpecificationResult(fillingInfos, _divisionSettings));
        }
Example #5
0
        public IMeasurementResult TakeMeasurement(MeasurementScreenshotsSet inputSet)
        {
            Vector3[,] positionsArray = GeneratePositionsArray(inputSet.WorldPosition1Texture, inputSet.WorldPosition2Texture);
            var idArray        = inputSet.IdArray;
            var occurenceArray = inputSet.HatchOccurenceArray;
            var samplesDict    = GenerateSamplesDict(positionsArray, idArray, inputSet.HatchMainTexture, occurenceArray);

            var msw = new MyStopWatch();

            msw.StartSegment("Curve calc");
            var curves = CalculateCurves(samplesDict);

            //Debug.Log(msw.CollectResults());
            return(new LinesLayoutResult()
            {
                WorldSpacePositionsArray = positionsArray,
                Curves = curves,
                Samples = samplesDict
            });
        }
Example #6
0
        private void MakeMeasurement()
        {
            if (!_gauges.Any())
            {
                return;
            }
            var msw           = new MyStopWatch();
            var lastTestFrame = OneTestConfiguration.TestFramesCount + OneTestConfiguration.FirstTestFrame;

            msw.StartSegment($"Test {OneTestConfiguration.TestName} frame {_requestedTestFrame} = {_requestedTestFrame-OneTestConfiguration.FirstTestFrame}/{lastTestFrame}");
            MeasurementScreenshotsSet set = _lineMeasuringModule.OnRenderImageGenerateScreenshots();

            var measurementResults = new List <IMeasurementResult>();

            foreach (var aGauge in _gauges)
            {
                var measurementResult = aGauge.TakeMeasurement(set);
                measurementResults.Add(measurementResult);
            }

            _runnerSupports.ForEach(c => c.MyOnMeasurementsMade(measurementResults, set));

            Debug.Log(msw.CollectResults());
        }
Example #7
0
        public void MyOnMeasurementsMade(List <IMeasurementResult> measurementResults, MeasurementScreenshotsSet set)
        {
            _lastIdsArray = set.IdArray;

            foreach (var aResult in measurementResults)
            {
                var illustration = aResult.GenerateIllustration();
                var textureName  = "_" + aResult.GetResultName() + "IllustrationTex";
                MTestImageRenderingMat.SetTexture(textureName, illustration);

                if (aResult is LinesLayoutResult result)
                {
                    _lastLinesLayoutResult = result;
                }
            }
        }
Example #8
0
 public void MyOnMeasurementsMade(List <IMeasurementResult> measurementResults, MeasurementScreenshotsSet set)
 {
 }
Example #9
0
        public void MyOnMeasurementsMade(List <IMeasurementResult> measurementResults, MeasurementScreenshotsSet set)
        {
            foreach (var aResult in measurementResults)
            {
                File.WriteAllText($"{_measurementsPath}/{aResult.GetResultName()}.{_testingRunner.RequestedTestFrame}.csv", aResult.ToCsvString());
            }

            _lastTestTime = Time.time;
        }
 public void MyOnMeasurementsMade(List <IMeasurementResult> measurementResults, MeasurementScreenshotsSet set)
 {
     //TODO Once Code from MyOnUpdate was here and Check at line 33 was < not ==. In that setur screenshots could be taken only if there was measurement.
     // So no measurements were taken with only performance analisys animation playing
 }