public static Texture2D GetGreyTextureDirect(double[] probabilities, int width, int height, double normalization = 1) { //TODO Make version with only floats (being faster needing less memory) double[,] imageData = QuantumImageHelper.ProbabilitiesToHeight2D(probabilities, width, height, normalization); return(QuantumImageHelper.CalculateGreyTexture(imageData)); }
/// <summary> /// Getting a grey scale texture for a given quantum circuit (which should represent an image) directly without using python. /// Is faster than python versions but does not support logarithmic encoding yet and may still contain some errors. /// </summary> /// <param name="quantumCircuit">The quantum circuit with the grey scale image representation</param> /// <param name="width">The width of the image</param> /// <param name="height">The height of the image</param> /// <param name="renormalize">If the image (colors) should be renormalized. (Giving it the highest possible saturation / becomes most light) </param> /// <param name="useLog">If logarithmic encoding is chosen DOES NOTHING (at the moment)</param> /// <returns>A texture showing the encoded image.</returns> public static Texture2D GetGreyTextureDirect(QuantumCircuit quantumCircuit, int width, int height, bool renormalize = false, bool useLog = false, SimulatorBase simulator = null) { //TODO Make version with only floats (being faster needing less memory) double[,] imageData = QuantumImageHelper.CircuitToHeight2D(quantumCircuit, width, height, renormalize, simulator); return(QuantumImageHelper.CalculateGreyTexture(imageData)); }
/// <summary> /// Constructing a greyscale image from a single quantumCircuit (which should represent a greyscale image). /// Used after image effect are applied to the image (the circuit) to get the modified picture. /// </summary> /// <param name="quantumCircuit">The circuit representing the (modified) image.</param> /// <param name="useLog">If logarithmic decoding should be used to decode the image.</param> /// <returns></returns> public Texture2D GetGreyTexture(QuantumCircuit quantumCircuit, bool useLog = false) { MicroQiskitSimulator simulator = new MicroQiskitSimulator(); double[] doubleArray = new double[0]; string[] stringArray = new string[0]; QuantumImageHelper.GetProbabilityArrays(simulator.GetProbabilities(quantumCircuit), quantumCircuit.NumberOfQubits, ref doubleArray, ref stringArray); IronPython.Runtime.PythonDictionary dictionary = pythonFile.HeightFromProbabilities(stringArray, doubleArray, doubleArray.Length, quantumCircuit.DimensionString, useLog); return(QuantumImageHelper.CalculateGreyTexture(dictionary, quantumCircuit.DimensionString)); }
/// <summary> /// Using the quantum teleportation algorithm to mix 2 images. /// Kind of using teleportation to swap placed between the 2 images. /// Teleportation progress of 0 means no teleportation, Teleportation progress of 1 means the teleportation finished. /// And Teleportation progress of 0.5 means it is right in the middle. /// </summary> /// <param name="inputTexture">The first image which should be mixed.</param> /// <param name="inputTexture2">The second image which should be mixed.</param> /// <param name="teleportationProgress">How far the teleportation has progressed. 0 Not at all, 0.5 in the middle, 1 finished. Can take on any value between 0 and 1</param> /// <returns></returns> public Texture2D TeleportTexturesGrey(Texture2D inputTexture, Texture2D inputTexture2, double teleportationProgress) { string heightDimensions; Texture2D OutputTexture = new Texture2D(2, 2); double[,] imageData = QuantumImageHelper.GetGreyHeighArray(inputTexture); double[,] imageData2 = QuantumImageHelper.GetGreyHeighArray(inputTexture2); IronPython.Runtime.PythonDictionary greyDictionary = getTeleportDictionaryFromData(out heightDimensions, imageData, imageData2, teleportationProgress); OutputTexture = QuantumImageHelper.CalculateGreyTexture(greyDictionary, heightDimensions); return(OutputTexture); }