Skip to content

A command line menu-driven Java application that is capable of filtering an image using a convolution kernel.

License

Notifications You must be signed in to change notification settings

pj-oboyle/Image_Convolution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Image Filtering System

This is a command-line menu-driven Java application capable of filtering an image using a convolution kernel. It provides robust features for creating custom filters, applying predefined filters, and selecting edge handling methods, all while supporting multiple image formats.


Features

1. Filter Options

  • Predefined Filters:

    • Offers 15 preset filters, including:
      • 12 filters with a 3x3 kernel.
      • 2 filters with a 5x5 kernel.
      • 1 filter with a 9x9 kernel.
    • Displays the filter matrix in an ASCII grid format with the filter name.
  • Custom Filters:

    • Allows users to create filters by specifying:
      • Kernel size: Must be odd and between 3 and 9.
      • Kernel values: Accepts positive/negative floating-point numbers within a range of ±999.9.
    • Provides labeled matrix rows (letters) and columns (numbers) to simplify input.
    • Displays the custom filter matrix and name in the console.

2. Edge Mode Options

  • Supports four methods for handling out-of-bounds pixels during convolution:
    1. Wrap Mode: Pixels wrap around to the opposite edge.
    2. Extend Mode: Edge pixels are extended to cover out-of-bounds areas.
    3. Pad Mode: Adds zero-padding around the image edges.
    4. Ignore Mode: Ignores calculations for out-of-bounds pixels (default mode).

3. Input/Output Features

  • Input File Types: Supports PNG, JPG, and GIF formats.
  • Input Handling:
    • Automatically appends missing file extensions.
    • Verifies file existence and prompts users for valid filenames if needed.
    • Accepts file names from directories or folders.
  • Output File Naming:
    • Names output images by concatenating the input filename, filter name, and edge mode.
    • Matches the input file type for the output image.

4. Debug Mode

  • Option to run the program in debug mode, which generates additional data:
    • Creates two text files containing RGB channel data for the input and output images.
    • Files are named with the input filename and appended suffixes _InputRGB and _OutputRGB.
    • Pixel data is displayed as integers (0-255) for each channel in [red/green/blue] format.

5. User Input Validation

  • Error Handling:
    • Detects illegal inputs such as out-of-range values, invalid strings, and empty entries.
    • Provides custom error messages for each invalid input scenario.
  • Dynamic Menus:
    • Prevents menu spam by redisplaying filter options only after multiple invalid inputs.

6. User Interface

  • Command-line menu allows seamless navigation:
    • Main menu options for running the program, selecting filters, setting edge modes, and quitting.
    • Submenus for creating filters, choosing edge modes, and managing input sources.
  • Program runs continuously until an image is processed or the user quits.

Installation

Prerequisites

  • Java Development Kit (JDK): Version 8 or above.
  • Integrated Development Environment (IDE): Eclipse, IntelliJ IDEA, or a text editor with Java support.

Steps

  1. Clone the repository or download the source code.
    git clone https://github.com/your-username/image-filtering-system.git
  2. Open the project in your preferred IDE.
  3. Compile the Java files:
    javac *.java
  4. Run the program by executing the Runner class.

Usage

Running the Program

  1. Select Option 1: Run Program from the main menu.
  2. Choose a filter (predefined or custom) if not already selected.
  3. Enter the input image filename.
  4. Verify the input file and current attributes.
  5. Execute the program to generate the filtered image.

Filter Options

Access filters via Main Menu > Option 2:

  1. Choose from 15 preset filters.
  2. Create a custom filter by defining the kernel size and values.
  3. View the selected filter matrix and name in the console.

Edge Mode Options

Navigate to Main Menu > Option 3 to select one of four edge modes:

  1. Wrap Mode
  2. Extend Mode
  3. Pad Mode
  4. Ignore Mode (default)

License

This project is licensed under the GNU General Public License v3.0. See the LICENSE file for details.


Contact

For further information, contact:


Thank you for using the Image Filtering System! If you find this project helpful, please give it a star on GitHub.

About

A command line menu-driven Java application that is capable of filtering an image using a convolution kernel.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages