QFT_code
QFT_code
@author: allda
"""
import cv2
import numpy as np
import matplotlib.pyplot as plt
def qft(N):
# Create the QFT matrix for N points
omega = np.exp(2 * np.pi * 1j / N) # N-th root of unity
qft_matrix = np.zeros((N, N), dtype=complex)
for j in range(N):
for k in range(N):
qft_matrix[j, k] = omega ** (j * k) / np.sqrt(N)
return qft_matrix
pi = np.sqrt(22/7)
def imagedetect(input_files,img_comp,message,weight,bias=500000,margin=1e6):
# Load the image using cv2
img_list=[]
edge_list=[]
pixel_list = []
for img_file in input_files:
img = cv2.imread(img_file, cv2.IMREAD_GRAYSCALE)
edges = cv2.Canny(img, 100, 200)
qftedges = apply_qft(edges)
summed_intensity = np.sum(qftedges)
img_list.append(img)
edge_list.append(edges)
pixel_list.append(summed_intensity)
# print(summed_intensity)
# print(intensity_comp)
# print(margin)
# print(average)
if __name__ == "__main__":
# print("testing for eye detection")
# input_files = ["eye12345.jpg",'eye2.jpg',"eye3.jpg",'eye4.jpg','eye5.jpg',"Screenshot
2025-02-16 193428.png","Screenshot 2025-02-16 193506.png","Screenshot 2025-02-16
193522.png","Screenshot 2025-02-16 193548.png","Screenshot 2025-02-16
193559.png","Screenshot 2025-02-16 193641.png","Screenshot 2025-02-16 193653.png"]
# img_comp = "eye2.jpg"
# message = "eye"
# margin = 0
# bias=1e5
# imagedetect(input_files, img_comp,message,margin,bias)