{"id":44862250,"url":"https://github.com/carbocation/matriximage","last_synced_at":"2026-02-17T10:38:48.886Z","repository":{"id":57549780,"uuid":"48192407","full_name":"carbocation/matriximage","owner":"carbocation","description":"Golang utility to convert between (grayscale) images and their Fourier transforms, and to manipulate them in frequency space","archived":false,"fork":false,"pushed_at":"2015-12-21T14:52:53.000Z","size":29,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-06-20T16:33:13.457Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/carbocation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-17T18:53:26.000Z","updated_at":"2022-01-21T08:18:35.000Z","dependencies_parsed_at":"2022-09-10T04:25:54.000Z","dependency_job_id":null,"html_url":"https://github.com/carbocation/matriximage","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/carbocation/matriximage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbocation%2Fmatriximage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbocation%2Fmatriximage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbocation%2Fmatriximage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbocation%2Fmatriximage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carbocation","download_url":"https://codeload.github.com/carbocation/matriximage/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carbocation%2Fmatriximage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29540247,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T08:11:05.436Z","status":"ssl_error","status_checked_at":"2026-02-17T08:09:38.860Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-02-17T10:38:48.204Z","updated_at":"2026-02-17T10:38:48.873Z","avatar_url":"https://github.com/carbocation.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# matriximage\n\nGolang utility to convert between (grayscale) images and their Fourier transforms, and to manipulate them in frequency space\n\n```sh\ngo get github.com/carbocation/matriximage\n```\n\n##Example:\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"math\"\n\t\"os\"\n\t\"testing\"\n\n\t\"github.com/mjibson/go-dsp/dsputils\"\n)\n\n// Work with the sine wave image\nconst Case = \"sin\"\nconst MaxUint = math.MaxUint16\n\nfunc main() {\n\tBasic()\n\tMasked()\n}\n\n// Reads an image, performs a Fourier transform, then outputs various components\n// as visible images\nfunc Basic() {\n\t// Read an image from file. This helper function also converts it to Gray16\n\tm, err := FromFile(fmt.Sprintf(\"./images/%s.gif\", Case))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Take the 2D Fourier transform of the image\n\tfourier := m.DFT()\n\n\t// Write the amplitude, (brightened) amplitude, phase, and then recombined gray image to disk\n\tsave(*fourier.AmplitudeImage(), \"amp\")\n\tsave(*fourier.BrighterAmplitudeImage(), \"logamp\")\n\tsave(*fourier.PhaseImage(), \"phase\")\n\tsave(*fourier.IDFTImage(), \"recovered\")\n}\n\n// Reads an image, applies a mask in the frequency space, performs the inverse \n// Fourier transform, and writes the resulting recovered image to disk\nfunc Masked() {\n\t// Read an image from file. This helper function also converts it to Gray16\n\tm, err := FromFile(fmt.Sprintf(\"./images/%s.gif\", Case))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// Take the 2D Fourier transform of the image\n\tfourier := m.DFT()\n\n\t// Create a square mask, where only the middle part of the amplitude is recovered.\n\tmaskMatrix := dsputils.MakeEmptyMatrix(fourier.Dimensions()) //fourier.AmplitudeImage().toGrayMatrix()\n\tdims := maskMatrix.Dimensions()\n\tfor y := 0; y \u003c dims[0]; y++ {\n\t\tfor x := 0; x \u003c dims[1]; x++ {\n\t\t\trad := 1\n\t\t\tif (y \u003c dims[0]/2-rad || y \u003e dims[0]/2+rad) || (x \u003c dims[1]/2-rad || x \u003e 1+dims[1]/2+rad) {\n\t\t\t\tmaskMatrix.SetValue(complex(0, 0), []int{y, x})\n\t\t\t} else {\n\t\t\t\tmaskMatrix.SetValue(complex(float64(MaxUint), 0), []int{y, x})\n\t\t\t}\n\t\t}\n\t}\n\n\tmaskedFourier, err := fourier.ApplyMatrixMask(maskMatrix)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tsave(*maskedFourier.AmplitudeImage(), \"masked-amplitude\")\n\tsave(*maskedFourier.BrighterAmplitudeImage(), \"masked-brighter-amplitude\")\n\tsave(*maskedFourier.PhaseImage(), \"masked-phase\")\n\tsave(*maskedFourier.IDFTImage(), \"masked-recovered\")\n}\n\nfunc save(m Image, name string) {\n\tos.MkdirAll(\"./images.out\", 0755)\n\n\tfilename := fmt.Sprintf(\"./images.out/%s-%s.png\", Case, name)\n\n\tm.ToFile(filename)\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarbocation%2Fmatriximage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarbocation%2Fmatriximage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarbocation%2Fmatriximage/lists"}