{"id":25497421,"url":"https://github.com/pklito/graphics-project","last_synced_at":"2026-05-06T03:31:29.193Z","repository":{"id":247602421,"uuid":"826222460","full_name":"pklito/Graphics-Project","owner":"pklito","description":"Locating cubes in an image of a voxel world, using traditional computer graphics techniques","archived":false,"fork":false,"pushed_at":"2025-01-09T14:53:08.000Z","size":50591,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-19T11:45:44.681Z","etag":null,"topics":["hough-transform","image-recognition","lsd","opencv"],"latest_commit_sha":null,"homepage":"https://pklito.github.io/Graphics-Project/","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/pklito.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-09T09:48:10.000Z","updated_at":"2025-01-22T18:56:40.000Z","dependencies_parsed_at":"2025-05-19T11:47:43.596Z","dependency_job_id":null,"html_url":"https://github.com/pklito/Graphics-Project","commit_stats":null,"previous_names":["pauloalbert/graphics-project","pklito/graphics-project"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pklito/Graphics-Project","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pklito%2FGraphics-Project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pklito%2FGraphics-Project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pklito%2FGraphics-Project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pklito%2FGraphics-Project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pklito","download_url":"https://codeload.github.com/pklito/Graphics-Project/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pklito%2FGraphics-Project/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32677874,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T02:33:58.958Z","status":"ssl_error","status_checked_at":"2026-05-06T02:33:39.611Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["hough-transform","image-recognition","lsd","opencv"],"created_at":"2025-02-19T01:19:37.271Z","updated_at":"2026-05-06T03:31:29.167Z","avatar_url":"https://github.com/pklito.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Traditional cube detecting graphics project\n_(website version: https://pklito.github.io/Graphics-Project/)_  \nThis project's goal is to recognize and locate cubes in images with traditional edge detecting methods and graphics fundamentals.\nIn these images, the position and orientation of the camera isn't known, however the FOV is constant.\n\nThere are several different approaches I explored in order to achieve decent results:\n#### Finding faces and using Perspective N-Point solvers.\nThe first method consisted of constructing a planar graph out of the edges of the image, finding cube faces by searching for loops in the graph,\napplying the PNP solver on these faces, and consolidating the results.\n#### Finding the vanishing points of the image\nI've explored modelling the vanishing points for an image of a voxel world (grid aligned cubes) in order to find the camera parameters,\nand then applying the previous face localizing method, but also finding the distance and angle to each detected edge manually.\n\nA graphics engine based in modernGL was also used in order to generate simple testing images for this problem.\n\nRead the writeup below for more in-detail explanations about the process.\n\n## Writeup\nRead [here](docs/writeup.pdf) the full writeup\n\n## Video\nhttps://youtu.be/lJQKC-Njt0E\n\n## Installation\n\nThe project uses python 3. To install the libraries, enter the main directory and run\n\n`pip install -r requirements.txt`\nor alternatively\n`pip install pygame opencv-python numpy moderngl matplotlib`\n\n# Running the code\nThere are two seperate runnable files, the first is the simulator that can generate cubes for you.\nThe second is the prediction that takes an image and guesses where the cubes are.\n\n## Graphics simulator\n```sh\npy run_simulation.py\n```\n\nControls:\nESC - exit\nP - Pause\nWASD - move around\nSPACE/SHIFT - move down/up\nMouse - turn camera\nT - export current frame as 'generated_images/output.png'\nY - Print camera matrix and cube positions\nG - Process the current frame directly\n\nThe area has some randomly placed cubes I used to test out different configurations for the image.\nPressing G does the LSD graph method of finding cubes without having to run `run_prediction.py`.\n*Note*: To continue, you may have to close the result MatPlotLib provides.\n\n## Predictor\n### Predictor\n`py run_prediction.py \u003cimage_name\u003e [-d DETECTOR] [-v]`\n\nThis script processes an image to detect cubes using different detection methods.\n\n#### Arguments:\n- `image_name`: The name of the image file to process.\n- `-d`, `--detector`: The edge detection method to use. Options are `lsd` (default), `hough`.\n- `-p`, `--pipeline` Which analysis will be run on the image.\n  - For the first faces and solvePNP solution, `graph`\n  - For the method which localizes edges individually using the vanishing points, `lines`\n  - For the mixture, which gets the edges from the vanishing points and uses solvePNP with faces of those edges, use `mixed`\n- `-v`, `--verbose`: If set, enables verbose mode for detailed images along with the result.\n\n#### Example usages:\n```sh\npy run_prediction.py generated_images/demo_scarce.png\n```\n```sh\npy run_prediction.py generated_images/demo_scarce.png --detector lsd --verbose --pipeline graph\n```\n\n```sh\npy run_prediction.py generated_images/demo_scarce.png --pipeline lines\n```\nIf no image is provided, the script defaults to `generated_images/demo_scarce.png` with the `lsd` detector and non-verbose mode.\n\n#### Detection Methods:\n- `lsd`: Line Segment Detector.\n- `prob` / `hough` / `houghp`: Alias for Probabilistic Hough Transform.\n\n# Previews:\n![](docs/solution.png)\n![](docs/solution_graph.png)\n![](docs/fitting.png)\n\u003cimg src=\"docs/color_faces.png\" alt=\"Alt Text\" height=\"300\"\u003e \u003cimg src=\"docs/edges.png\" alt=\"Alt Text\" height=\"300\"\u003e \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpklito%2Fgraphics-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpklito%2Fgraphics-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpklito%2Fgraphics-project/lists"}