/// <summary>
    /// A placeholder for creating your own image effect. Keep it static this way you can use it for mesh creation
    /// </summary>
    /// <param name="inputTexture">The Texture of which one wants a blurred image</param>
    /// <returns>A texture with your own image effect applied</returns>
    public static Texture2D CalculateMyOwnEffect(Texture2D inputTexture, float parameter1 = 0, float parameter2 = 0, float parameter3 = 0)
    {
        Texture2D outputTexture;

        // Since we do not need python we do not need to intialize the creator and we can use the static functions of the QuantumImageCreator

        //generating the quantum circuits encoding the color channels of the image
        QuantumCircuit red   = QuantumImageCreator.GetCircuitDirect(inputTexture, ColorChannel.R);
        QuantumCircuit green = QuantumImageCreator.GetCircuitDirect(inputTexture, ColorChannel.G);
        QuantumCircuit blue  = QuantumImageCreator.GetCircuitDirect(inputTexture, ColorChannel.B);

        //Add your own quantum circuit manipulation here!
        //You can use the functions in the region "Effects" bellow

        //ApplyHadamar(red,7);
        //ApplyHadamar(green,7);
        //ApplyHadamar(blue,7);

        //ApplyControlledNotToFraction(red,4);
        //ApplyControlledNotToFraction(green,4);
        //ApplyControlledNotToFraction(blue,4);

        //ApplyControledQtoFraction(red, 0.25f);
        //ApplyControledQtoFraction(green, 0.25f);
        //ApplyControledQtoFraction(blue, 0.25f);

        //Generating the texture after the quantum circuits were modified.
        outputTexture = QuantumImageCreator.GetColoreTextureDirect(red, green, blue, inputTexture.width, inputTexture.height);

        return(outputTexture);
    }
Example #2
0
    //Doing the work. Creates a new job and runs it.
    void prepareAndStartJob()
    {
        //Showing Loading Indicator
        LoadingIndicator.SetActive(true);

        //First create a new simulatejob to run this on a seperate thread
        myJob = new SimulateJob();
        //Now set the "simulator" to the QiskitSimulator. (If UseReal is set to true, a real backend is used, and your Token needs to be provided).
        myJob.Simulator = new QiskitSimulator(1000, UseReal, Token);
        //Creating a circuit from the red channel of the provided texture (for black and white image any of the 3 color channels is ok).
        myJob.Circuit = QuantumImageCreator.GetCircuitDirect(Input, ColorChannel.R);
        //applying additional manipulation to the circuit
        applyPartialQ(myJob.Circuit, Rotation);
        //run the job, meaning start the simulation (or the call to the backend)
        myJob.Start();
    }
Example #3
0
    //Doing the work. Creates a new job and runs it.
    void prepareAndStartJob()
    {
        if (DeviceName.Length < 5)
        {
            DeviceName = "ibmq_16_melbourne";
        }

        //Showing Loading Indicator
        LoadingIndicator.SetActive(true);

        //First create a new simulatejob to run this on a seperate thread
        myJob = new SimulateJob();
        //Now set the "simulator" to the QiskitSimulator. (If UseReal is set to true, a real backend is used, and your Token needs to be provided).
        myJob.Simulator = new QiskitSimulator(NumberOfShots, UseReal, Token, DeviceName, DontStartPython, UseInternalDevice);
        //Creating a circuit from the red channel of the provided texture (for black and white image any of the 3 color channels is ok).
        myJob.Circuit = QuantumImageCreator.GetCircuitDirect(Input, ColorChannel.R);
        //applying additional manipulation to the circuit
        applyPartialQ(myJob.Circuit, QuantumBlurRotation);
        //run the job, meaning start the simulation (or the call to the backend)
        myJob.Start();
    }
    /// <summary>
    /// Produces a blured version of the input texture (using the quantum blur algorithm) directly in unity without the use of python.
    /// Does NOT support logarithmic encoding. Blur effect done by rotation of quantum state representation.
    /// IS A LOT faster than python version, however, the result still has some errors.
    /// </summary>
    /// <param name="inputTexture">The Texture of which one wants a blurred image</param>
    /// <param name="rotation">How strong the blur effect is.</param>
    /// <returns>A blured texture</returns>
    public static Texture2D CalculateUnityBlur(Texture2D inputTexture, float rotation)
    {
        Texture2D outputTexture;

        // Since we do not need python we do not need to intialize the creator
        // and we can use the static functions of the QuantumImageCreator

        //generating the quantum circuits encoding the color channels of the image
        QuantumCircuit red   = QuantumImageCreator.GetCircuitDirect(inputTexture, ColorChannel.R);
        QuantumCircuit green = QuantumImageCreator.GetCircuitDirect(inputTexture, ColorChannel.G);
        QuantumCircuit blue  = QuantumImageCreator.GetCircuitDirect(inputTexture, ColorChannel.B);

        //applying the rotation generating the blur effect
        ApplyPartialQ(red, rotation);
        ApplyPartialQ(green, rotation);
        ApplyPartialQ(blue, rotation);

        //Generating the texture after the quantum circuits were modified.
        outputTexture = QuantumImageCreator.GetColoreTextureDirect(red, green, blue, inputTexture.width, inputTexture.height);

        return(outputTexture);
    }