internal ItemIconScan(Bitmap capture, Vector2 mouseVector2)
        {
            Logger.ClearDebugMats();

            Capture  = capture;
            MousePos = mouseVector2;

            var(iconPosition, iconSize) = LocateIcon(Capture);

            var padding = RatConfig.IconScan.ScanPadding;

            // Add padding
            var iconSlotSize = new Size();

            iconSlotSize.Width  = IconManager.PixelsToSlots(iconSize.X);
            iconSlotSize.Height = IconManager.PixelsToSlots(iconSize.Y);

            // Rectify icon position for padding
            iconPosition -= new Vector2(padding / 2, padding / 2);
            iconSize.X   += padding;
            iconSize.Y   += padding;

            if (iconPosition.X < 0)
            {
                iconPosition.X = 0;
            }
            if (iconPosition.Y < 0)
            {
                iconPosition.Y = 0;
            }
            if (iconSize.X + iconPosition.X > Capture.Width)
            {
                iconSize.X = Capture.Width - iconPosition.X;
            }
            if (iconSize.Y + iconPosition.Y > Capture.Height)
            {
                iconSize.Y = Capture.Height - iconPosition.Y;
            }

            if (iconSlotSize.Width == 0 || iconSlotSize.Height == 0)
            {
                return;
            }

            Logger.LogDebug("pX: " + iconPosition.X + " | pY: " + iconPosition.Y);
            Logger.LogDebug("pW: " + iconSize.X + " | pH: " + iconSize.Y);
            Logger.LogDebug("sW: " + iconSlotSize.Width + " | sH: " + iconSlotSize.Height);

            // Crop capture to icon
            var sourceBitmap = new Bitmap(Capture).Clone(new Rectangle(iconPosition, iconSize), Capture.PixelFormat);
            var croppedIcon  = sourceBitmap.ToMat();

            Logger.LogDebugMat(croppedIcon, "cropped_icon");

            // Rescale captured icon if resolution is not FHD
            if (RatConfig.ScreenResolution != RatConfig.Resolution.R1920x1080)
            {
                var invSSF      = RatConfig.GetInverseScreenScaleFactor();
                var croppedSize = new Size(croppedIcon.Width * invSSF, croppedIcon.Height * invSSF);
                croppedIcon = croppedIcon.Resize(croppedSize, 0, 0, InterpolationFlags.Area);
                Logger.LogDebugMat(croppedIcon, "resized_cropped_icon");
            }

            var iconWidthPixel  = IconManager.SlotsToPixels(iconSlotSize.Width);
            var iconHeightPixel = IconManager.SlotsToPixels(iconSlotSize.Height);

            IconRect.Size = new Size(iconWidthPixel, iconHeightPixel);

            // Actually scan the source
            var matchResult = ScanStaticAndDynamic(iconSlotSize, croppedIcon);

            if (RatConfig.IconScan.ScanRotatedIcons)
            {
                // Rotate source
                var croppedIconRotated = new Mat();
                Cv2.Rotate(croppedIcon, croppedIconRotated, RotateFlags.Rotate90Counterclockwise);
                var iconSlotSizeRotated = new Size(iconSlotSize.Height, iconSlotSize.Width);

                // Actually scan the source
                var matchResultRotated = ScanStaticAndDynamic(iconSlotSizeRotated, croppedIconRotated);

                if (matchResultRotated.conf > matchResult.conf)
                {
                    matchResult = matchResultRotated;

                    // Rotate match position when matched on rotated source
                    var xPos = matchResult.pos.X;
                    matchResult.pos.X = matchResult.pos.Y;
                    matchResult.pos.Y = xPos;
                    Rotated           = true;
                }
            }


            Logger.LogDebug("Icon Key: " + matchResult.iconKey);
            Logger.LogDebug("Conf: " + matchResult.conf);

            IconRect.X = MousePos.X - (RatConfig.IconScan.ScanWidth / 2) + iconPosition.X + matchResult.pos.X;
            IconRect.Y = MousePos.Y - (RatConfig.IconScan.ScanHeight / 2) + iconPosition.Y + matchResult.pos.Y;

            Confidence = matchResult.conf;

            var itemInfos = IconManager.GetItemInfo(matchResult.iconKey);

            if (!(itemInfos?.Length > 0))
            {
                return;
            }

            MatchedItems = Array.ConvertAll(itemInfos, itemInfo => itemInfo.GetItem());
            if (MatchedItems?.Length > 0)
            {
                MatchedItems = MatchedItems.Where(item => item != null).ToArray();
            }
            if (MatchedItems?.Length > 0)
            {
                ValidItem = true;
            }
        }