Beispiel #1
0
        public void InitColorMap(IEnumerable <Color> colors, IImageParams destination)
        {
            var colorList = colors as IList <Color> ?? colors.ToList();

            if (HasColorMap(destination) && _colorMap.ContainsColors(colorList))
            {
                return;
            }

            if (_colorMap != null)
            {
                _colorMap.Dispose();
            }

            _colorMap = new ColorMap(colorList);

            _colorMapDestinationPixelFormat  = destination.PixelFormat;
            _colorMapDestinationColorProfile = destination.ColorProfile;
            _colorMapTargetColorSpace        = TargetColorSpace;

            foreach (var colorSpace in _colorMap.ColorSpaces)
            {
                var source = new ImageParams(GetPixelFormat(colorSpace), GetProfile(this, colorSpace));
                using (var converter = GetColorConverter(this, source, destination))
                {
                    if (converter != null)
                    {
                        _colorMap.Convert(converter, colorSpace);
                    }
                }
            }
        }
Beispiel #2
0
        public async Task <IActionResult> AddImage([FromBody] AddImageViewModel model)
        {
            var user = await GetCurrentUserAsync();

            var imagePath   = ImageHelper.SaveImage(model.ImageData, model.Title);
            var imageParams = new ImageParams(user.Id, model.Title, model.Description, imagePath);

            var image      = _imageService.CreateOrUpdate(imageParams);
            var imageModel = _mapper.Map <ImageListModel>(image);

            return(Ok(imageModel));
        }
Beispiel #3
0
        public static Color ConvertColor(ColorManagement colorManagement, Color color, IImageParams destination)
        {
            var result = GetColorFromColorMap(colorManagement, color, destination);

            if (result != null)
            {
                return(result);
            }

            var source         = new ImageParams(color.PixelFormat, GetProfile(colorManagement, color.ColorSpace));
            var colorConverter = GetColorConverter(colorManagement, source, destination);

            return(colorConverter != null?colorConverter.ConvertColor(color, source.ColorProfile) : color);
        }
Beispiel #4
0
 public void WGSendToQQWithPhoto(eQQScene scene, ImageParams imageParams, string extraScene, string messageExt)
 {
     iOSConnector.SendToQQWithPhotoWithParams((int)scene, imageParams.ios_imageData, imageParams.ios_imageDataLen, extraScene, messageExt);
 }
Beispiel #5
0
        public static RgbColor GetPreviewColor(ColorManagement colorManagement, Color color)
        {
            var destination = new ImageParams(GetPixelFormat(ColorSpace.Rgb), GetSrgbProfile());

            return((RgbColor)ConvertColor(colorManagement, color, destination));
        }
Beispiel #6
0
        public void InitPreviewColorMap(IEnumerable <Color> colors)
        {
            var destination = new ImageParams(PixelFormat.Format32bppArgb, GetSrgbProfile());

            InitColorMap(colors, destination);
        }
Beispiel #7
0
        public static ColorConverter GetColorConverter(ColorManagement colorManagement, IImageParams source, PixelFormat destinationPixelFormat, ColorProfile destinationProfile)
        {
            var destination = new ImageParams(destinationPixelFormat, destinationProfile);

            return(GetColorConverter(colorManagement, source, destination));
        }
Beispiel #8
0
        public static ColorConverter GetColorConverter(ColorManagement colorManagement, IImageParams source, PixelFormat destinationPixelFormat, bool isPreview = false)
        {
            var destination = new ImageParams(destinationPixelFormat, GetProfile(colorManagement, destinationPixelFormat.ColorSpace, isPreview));

            return(GetColorConverter(colorManagement, source, destination));
        }
Beispiel #9
0
 public void WGSendToQQWithPhoto(eQQScene scene, ImageParams imageParams, string extraScene, string messageExt)
 {
     MsdkEvent.Instance.HandleShareNofify(dataGenerator.ShareData);
 }
Beispiel #10
0
        public static void ApplyImage(CreateMeshContract inputParams, int index, ref Stream moldDataPtr, Logger logger)
        {
            var clickInput = inputParams.ClickInputs.ImageClickInputDetailsList[index];
            var angle      = inputParams.ClickInputs.Angles[index];

            var imageAlterationParameters = new ImageAlterationParams
            {
                MoldPtDensity        = inputParams.PtDensity,
                MinImageHeightRatio  = inputParams.MinImageHeightRatio,
                PercentExtraWidth    = inputParams.PercentExtraWidth,
                ImageFolder          = inputParams.ImageFolder,
                InvalidColor         = inputParams.InvalidColor,
                ResizeType           = ResizeType.ComputeSizeBasedOnPtDensity,
                BottomPaddingPercent = inputParams.BottomPaddingPercent
            };
            var imageParams = ImageProcessor.GetImageParams(inputParams.VariationIn3DCoordinates, inputParams.BackgroundStrippingParams, clickInput, angle, imageAlterationParameters);

            if (moldDataPtr == null)
            {
                moldDataPtr = CreateMoldDataStream(imageParams.Image.Width, imageParams.Image.Height, (float)inputParams.VariationIn3DCoordinates, inputParams.PtDensity, logger);
            }

            var processMoldParams = new ProcessMoldParams
            {
                MoldData    = moldDataPtr,
                ImageParams = imageParams
            };
            var imagesToObject = new ImagesToObject(processMoldParams, inputParams.LogFilePath);

            imagesToObject.ProcessImage();

            #region track_changes_for_troubleshooting

            if (inputParams.SaveProcessedImages)
            {
                SaveProcessedImages(processMoldParams.ImageParams.Image, inputParams.ImageFolder, "ibmodeler3_modified_images", index, angle, logger);
            }

            var imageParamsToBeReused = false;
            if (AnalyzeMoldForDataLosses)
            {
                //if first time, just set values for subsequent use
                if (index == 0)
                {
                    FirstImageParams      = imageParams;
                    imageParamsToBeReused = true;
                }
                else
                {
                    var processMoldParamsForAnalysis = new ProcessMoldParams
                    {
                        MoldData    = moldDataPtr,
                        ImageParams = FirstImageParams,
                        SetColorForRetainedPixels = false
                    };
                    int pixelsWithAllPointsLost = MoldFileAnalyzerForImg.ProcessImage(processMoldParamsForAnalysis);
                    if (pixelsWithAllPointsLost > 0)
                    {
                        SaveDataLossImages(FirstImageParams.Image, inputParams.ImageFolder, "ibmodeler3_data_loss_analysis", index, angle, pixelsWithAllPointsLost, logger);
                    }
                }
            }

            #endregion

            //this will dispose off the image data from memory
            if (!imageParamsToBeReused)
            {
                imageParams.Dispose();
            }

            logger.Log(string.Format("Image applied for camera at an angle of {0} degrees", Math.Round(angle * 180 / Math.PI, 2)));
        }
 public void WGSendToQQWithPhoto(eQQScene scene, ImageParams imageParams, string extraScene, string messageExt)
 {
     AndroidConnector.SendToQQWithPhotoWithParams((int)scene, imageParams.android_imagePath, extraScene, messageExt);
 }