MacOS application, developed in Swift and SwiftUI, provides graphical user interface for applying:
- Functional filters
- Convolution filters
- Morphological operations
- Dithering
- Color quantization to the image.
Users may load images, apply transformations, and save the results. All filter and transformation implementations are done using pixel-by-pixel operations.
1. Functional filters
The application provides an interactive graph for functional filters using polylines. Users can create new filters starting with an identity function (a straight line), add, move, or delete points on the graph, and edit existing filters (except gamma correction). Available filters:
- Inversion
- Brightness
- Contrast adjustment
- Gamma correction
2. Convolution filters
- Blur
- Gaussian blur
- Sharpen
- Edge detection
- Emboss
The application supports essential morphological operations using a 3x3 kernel:
- Erosion
- Dilation
- Opening
- Closing
The application applies ordered dithering using adjustable threshold maps, with sizes chosen by the user (2, 3, 4, or 6). Both RGB and grayscale images are supported, with dithering applied separately to each channel.
The application uses median cut, which reduces the number of colours in an image to a value selected by the user while preserving the image’s overall appearance.
This application follows Model-View-ViewModel architecture, where Model is the Document which represents the loaded image. View is the SwiftUI ContentView which displays the UI, while ViewModel is the ContentViewModel responsible for performing actions in response to UI events such as filter function changes.
To install the project you need a Mac with Xcode 14 or later installed.
- Open
CGProject2.xcodeprojin Xcode. - Select CGProject2 build target and My Mac as run destination.
- Build and Run the project.
The project was developed as part of the Computer Graphics course at Warsaw University of Technology