{"id":22273823,"url":"https://github.com/geeksloth/image-fourier-transform-example","last_synced_at":"2025-03-25T16:42:49.188Z","repository":{"id":221943386,"uuid":"755840855","full_name":"geeksloth/image-fourier-transform-example","owner":"geeksloth","description":"A simple demo of image Fourier Transformation, invented from-scratch DFT and iDFT Python functions.","archived":false,"fork":false,"pushed_at":"2024-02-23T12:29:55.000Z","size":308,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T14:48:37.332Z","etag":null,"topics":["fourier-transform","image-processing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geeksloth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-11T08:29:35.000Z","updated_at":"2024-11-11T14:01:24.000Z","dependencies_parsed_at":"2024-02-11T09:31:03.653Z","dependency_job_id":"2888f1aa-02bb-46ee-a69d-eba036986285","html_url":"https://github.com/geeksloth/image-fourier-transform-example","commit_stats":null,"previous_names":["geeksloth/fourier-image-transformation","geeksloth/image-fourier-transform-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geeksloth%2Fimage-fourier-transform-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geeksloth%2Fimage-fourier-transform-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geeksloth%2Fimage-fourier-transform-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geeksloth%2Fimage-fourier-transform-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geeksloth","download_url":"https://codeload.github.com/geeksloth/image-fourier-transform-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245502311,"owners_count":20625948,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fourier-transform","image-processing"],"created_at":"2024-12-03T13:16:28.860Z","updated_at":"2025-03-25T16:42:49.163Z","avatar_url":"https://github.com/geeksloth.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Image Fourier Transform Example\nA simple demo of Fourier image transformation by from-scratch DFT and iDFT functions.\n\n![Figure_1.png](static/Figure_1.png)\n\n## Theorem\nThe discrete two-dimensional Fourier transform of an image array is defined in series form as\n\n![eq-dft.png](static/eq-dft.png)\n\nI implemented from scratch in Python (without the normalization part) as follow:\n\n```python\ndef DFT_2d(image):\n\t#data = np.asarray(image)\n\tdata = image\n\tM, N = image.shape # (img x, img y)\n\tdft2d = np.zeros((M,N),dtype=complex)\n\tfor k in range(M):\n\t\tfor l in range(N):\n\t\t\tsum_matrix = 0.0\n\t\t\tfor m in range(M):\n\t\t\t\tfor n in range(N):\n\t\t\t\t\te = cmath.exp(- 2j * np.pi * ((k * m) / M + (l * n) / N))\n\t\t\t\t\tsum_matrix +=  data[m,n] * e\n\t\t\tdft2d[k,l] = sum_matrix\n\treturn dft2d\n```\n\ninverse transform equation:\n\n![eq-idft.png](static/eq-idft.png)\n\nthe implementation (and again, without the normalization part) is as follow:\n\n```python\ndef iDFT_2d(image):\n\t#data = np.asarray(image)\n\tdata = image\n\t#M, N = image.size # (img x, img y)\n\tM, N = image.shape\n\tdft2d = np.zeros((M,N),dtype=complex)\n\tfor k in range(M):\n\t\tfor l in range(N):\n\t\t\tsum_matrix = 0.0\n\t\t\tfor m in range(M):\n\t\t\t\tfor n in range(N):\n\t\t\t\t\te = cmath.exp(2j * np.pi * ((k * m) / M + (l * n) / N))\n\t\t\t\t\tsum_matrix +=  data[m,n] * e\n\t\t\tdft2d[k,l] = sum_matrix\n\treturn dft2d\n```\n\nThese 4 steps are:\n1. Showing the original spatial domain of the input image.\n2. Transform it into the Frequency Domain by applying the Fourier Transform, then show the F-image.\n3. Cutting some frequencies area, this might be more complex process a you desire, then show the filtered F-image.\n4. Transfrom into the Saptial Domain and show the result.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeeksloth%2Fimage-fourier-transform-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeeksloth%2Fimage-fourier-transform-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeeksloth%2Fimage-fourier-transform-example/lists"}