{"id":30559361,"url":"https://github.com/pramithamj/ec-7212-take-home-assignment-1","last_synced_at":"2025-08-28T09:34:35.401Z","repository":{"id":300433410,"uuid":"1005945957","full_name":"PramithaMJ/EC-7212-Take-Home-Assignment-1","owner":"PramithaMJ","description":"EC7212 – Computer Vision and Image Processing","archived":false,"fork":false,"pushed_at":"2025-06-21T17:29:43.000Z","size":64309,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-21T17:33:52.098Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/PramithaMJ.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":"2025-06-21T06:25:49.000Z","updated_at":"2025-06-21T17:29:46.000Z","dependencies_parsed_at":"2025-06-21T17:43:56.461Z","dependency_job_id":null,"html_url":"https://github.com/PramithaMJ/EC-7212-Take-Home-Assignment-1","commit_stats":null,"previous_names":["pramithamj/ec-7212-take-home-assignment-1"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PramithaMJ/EC-7212-Take-Home-Assignment-1","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PramithaMJ%2FEC-7212-Take-Home-Assignment-1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PramithaMJ%2FEC-7212-Take-Home-Assignment-1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PramithaMJ%2FEC-7212-Take-Home-Assignment-1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PramithaMJ%2FEC-7212-Take-Home-Assignment-1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PramithaMJ","download_url":"https://codeload.github.com/PramithaMJ/EC-7212-Take-Home-Assignment-1/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PramithaMJ%2FEC-7212-Take-Home-Assignment-1/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272476928,"owners_count":24940946,"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","status":"online","status_checked_at":"2025-08-28T02:00:10.768Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2025-08-28T09:34:34.514Z","updated_at":"2025-08-28T09:34:35.377Z","avatar_url":"https://github.com/PramithaMJ.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Computer Vision and Image Processing - EC7212 Assignment\n\nThis project implements various image processing operations required for the EC7212 Computer Vision and Image Processing assignment.\n\n## Project Structure\n\n```\n.\n├── images/                 # Input images\n│   └── lena_standard.png   # Main test image used by all scripts\n├── results/                # Output images and individual task results\n│   ├── task1_lena/         # Task 1 individual results (different intensity levels)\n│   │   ├── 128_levels.png\n│   │   ├── 64_levels.png\n│   │   ├── 32_levels.png\n│   │   ├── 16_levels.png\n│   │   ├── 8_levels.png\n│   │   ├── 4_levels.png\n│   │   └── 2_levels.png\n│   ├── task2_lena/         # Task 2 individual results (different kernel sizes)\n│   │   ├── 3x3_Average.png\n│   │   ├── 10x10_Average.png\n│   │   └── 20x20_Average.png\n│   ├── task3_lena/         # Task 3 individual results (different rotation angles)\n│   │   ├── Rotated_45deg.png\n│   │   └── Rotated_90deg.png\n│   ├── task4_lena/         # Task 4 individual results (different block sizes)\n│   │   ├── 3x3_Blocks.png\n│   │   ├── 5x5_Blocks.png\n│   │   └── 7x7_Blocks.png\n│   ├── task1_lena_intensity_reduction.png  # Task 1 combined results\n│   ├── task2_lena_spatial_averaging.png    # Task 2 combined results\n│   ├── task3_lena_rotation.png             # Task 3 combined results\n│   └── task4_lena_block_averaging.png      # Task 4 combined results\n├── task1_intensity_reduction.py  # Task 1 implementation\n├── task2_spatial_averaging.py    # Task 2 implementation\n├── task3_image_rotation.py       # Task 3 implementation\n├── task4_block_averaging.py      # Task 4 implementation\n└── README.md                     # This file\n```\n\n## Task Descriptions\n\n1. **Task 1: Intensity Level Reduction** (`task1_intensity_reduction.py`)\n   - Reduces the number of intensity levels in an image from 256 to a specified power of 2\n   - Tests with levels: 128, 64, 32, 16, 8, 4, 2\n   - Features interactive mode for selecting specific intensity levels\n\n2. **Task 2: Spatial Averaging** (`task2_spatial_averaging.py`)\n   - Performs spatial averaging with different neighborhood sizes\n   - Tests with kernel sizes: 3×3, 10×10, 20×20\n\n3. **Task 3: Image Rotation** (`task3_image_rotation.py`)\n   - Rotates an image by 45 and 90 degrees\n   - Preserves all image content without cropping\n\n4. **Task 4: Block Averaging** (`task4_block_averaging.py`)\n   - Reduces spatial resolution by replacing non-overlapping blocks with their average\n   - Tests with block sizes: 3×3, 5×5, 7×7\n\n## Running the Scripts\n\nAll scripts are now simplified to use the \"lena_standard.png\" image by default. To run any of the tasks, simply execute the corresponding Python script:\n\n### Task 1: Intensity Level Reduction\n\n```bash\npython3 task1_intensity_reduction.py\n```\n\nYou'll be prompted to enter a desired intensity level (e.g., 2, 4, 8, 16, 32, 64, 128, or 256). The script will then reduce the Lena image to your specified number of intensity levels and display the results.\n\n### Task 2: Spatial Averaging\n\n```bash\npython3 task2_spatial_averaging.py\n```\n\nThis will apply spatial averaging to the Lena image with 3×3, 10×10, and 20×20 kernel sizes.\n\n### Task 3: Image Rotation\n\n```bash\npython3 task3_image_rotation.py\n```\n\nThis will rotate the Lena image by 45° and 90° angles.\n\n### Task 4: Block Averaging\n\n```bash\npython3 task4_block_averaging.py\n```\n\nThis will apply block averaging to the Lena image with 3×3, 5×5, and 7×7 block sizes.\n\n## Available Images\n\nThe following test images are included in the project:\n- `lena_standard.png`: Classic test image with good gradients\n- `mandrill.png`: Highly textured image\n- `smriti.png`: Additional test image\n- `jeep.png`: Additional test image\n\n## Output Results\n\nWhen you run each script:\n1. The processed images are displayed in a matplotlib window\n2. A combined image showing all processing steps is saved in the `results/` directory\n3. Individual processed images are saved in task-specific subdirectories (e.g., `results/task1_lena/`)\n\n## Requirements\n\n- Python 3.x\n- OpenCV (cv2) - `pip install opencv-python`\n- NumPy - `pip install numpy`\n- Matplotlib - `pip install matplotlib`\n\n## How to Install Dependencies\n\nYou can install all the required dependencies using pip:\n\n```bash\npip install opencv-python numpy matplotlib\n```\n\n## Implementation Details\n\n### Task 1: Intensity Level Reduction\n\nThis task reduces the number of intensity levels in an image from 256 (8-bit) to a desired power of 2 level (e.g., 128, 64, 32...). The implementation uses bit manipulation:\n\n1. Calculate the number of bits needed for the desired intensity levels\n2. Use bit shifting to remove the appropriate number of least significant bits\n3. Display the original and reduced images side by side\n\n### Task 2: Spatial Averaging\n\nThis task implements spatial averaging (mean filtering) with different kernel sizes:\n\n1. Create averaging kernels of sizes 3×3, 10×10, and 20×20\n2. Apply convolution using cv2.filter2D\n3. Display results showing the effects of different kernel sizes\n\n### Task 3: Image Rotation\n\nThis task rotates images by specific angles while preserving all image content:\n\n1. Calculate the new image dimensions to fit the rotated image without cropping\n2. Apply rotation transformation using cv2.warpAffine\n3. Display original and rotated images\n\n### Task 4: Block Averaging\n\nThis task reduces spatial resolution by replacing non-overlapping blocks with their average value:\n\n1. Divide the image into non-overlapping blocks of specified size\n2. Replace each block with the average intensity value of all pixels in that block\n3. Display results showing the effects of different block sizes\n\n- Python 3.x\n- OpenCV (cv2)\n- NumPy\n- Matplotlib\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpramithamj%2Fec-7212-take-home-assignment-1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpramithamj%2Fec-7212-take-home-assignment-1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpramithamj%2Fec-7212-take-home-assignment-1/lists"}