Пример #1
0
        private string TakeSnapshot(string savePath)
        {
            string fileName = "snapshot-" + DateTime.Now.ToString("yyyyMMddHHmmssff") + ".jpg";

            Debug.WriteLine("savePath = {0}, fileName = {1}", savePath, fileName);
            if (!Directory.Exists(savePath))
            {
                Directory.CreateDirectory(savePath);
            }
            string filePath = Path.Combine(savePath, fileName);

            Debug.WriteLine("filePath = " + filePath);
            LogInfo("Saving snapshot to " + filePath);
            CubeImageUtils.TakeSnapshot(filePath, camControl, _config.JpegQuality,
                                        _config.UseMotionDetection, _config.MotionSensitivity,
                                        _config.UseMedianStacking,
                                        _config.UseContrastEnhancement, _config.ContrastValue, _config.ContrastMidpoint);

            _scan.imageSet.images.Add(new ScanImage(_cube.Elevation.ToString(), _cube.Rotation.ToString(), fileName));
            return(filePath);
        }
Пример #2
0
        private string TakeSnapshot(string savePath)
        {
            if (log.IsInfoEnabled)
            {
                log.Info("TakeSnapshot called using savePath = " + savePath);
            }

            string fileName = "snapshot-" + DateTime.Now.ToString("yyyyMMddHHmmssff") + ".jpg";

            if (log.IsDebugEnabled)
            {
                log.Debug("Snapshot file name is " + fileName);
            }

            if (!Directory.Exists(savePath))
            {
                if (log.IsDebugEnabled)
                {
                    log.Debug("savepath does not exist, creating");
                }

                Directory.CreateDirectory(savePath);
            }
            string filePath           = Path.Combine(savePath, fileName);
            bool   useMotionDetection = cbUseMotionDetection.Checked && !_temporarilyDisableMotionDetection;

            if (log.IsDebugEnabled)
            {
                log.Debug("use motion detection = " + useMotionDetection);
            }

            CubeImageUtils.TakeSnapshot(filePath, camControl, tbQuality.Value,
                                        useMotionDetection, tbSensitivity.Value,
                                        cbUseMedianStacking.Checked,
                                        cbUseContrastEnhancement.Checked, tbContrast.Value, tbMidpoint.Value);

            _scan.imageSet.images.Add(new ScanImage(_cube.Elevation.ToString(), _cube.Rotation.ToString(), fileName));
            _temporarilyDisableMotionDetection = false;
            return(filePath);
        }