コード例 #1
0
        /// <summary>
        /// Constructs a quantum circuit representing an image for a specific color channel.
        /// </summary>
        /// <param name="inputTexture">The texture from which a circuit is constructed</param>
        /// <param name="useLog">If logarithmic encoding should be used for the picture</param>
        /// <param name="colorChannel">The color channel (of the texture) which will be used to generate the image</param>
        /// <returns></returns>
        public QuantumCircuit GetCircuit(Texture2D inputTexture, bool useLog = false, ColorChannel colorChannel = ColorChannel.R)
        {
            //TODO optimize to get 3 channels directly
            double[,] imageData;

            switch (colorChannel)
            {
            case ColorChannel.R:
                imageData = QuantumImageHelper.GetRedHeightArray(inputTexture);
                break;

            case ColorChannel.G:
                imageData = QuantumImageHelper.GetGreenHeightArray(inputTexture);
                break;

            case ColorChannel.B:
                imageData = QuantumImageHelper.GetBlueHeightArray(inputTexture);
                break;

            case ColorChannel.A:
                imageData = QuantumImageHelper.GetAlphaHeightArray(inputTexture);
                break;

            default:
                imageData = QuantumImageHelper.GetGreyHeighArray(inputTexture);
                break;
            }

            return(GetCircuit(imageData, useLog));
        }