You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 30, 2023. It is now read-only.
`make project3` or `make`: compile only alphamask and compose
12
+
`make`: clean compiled outputs and compile only `convolve`
13
13
14
14
`make all`: compile all code into the program suite
15
15
16
16
`make recompile`: clean compiled outputs and recompile all code into the program suite
17
17
18
-
`make [imgview, alphamask, compose]`: compile just one program at a time
18
+
`make [imgview, alphamask, compose, convolve]`: compile just one program at a time
19
19
20
20
`make clean`: delete compiled outputs (will not touch images the program creates)
21
21
@@ -64,14 +64,7 @@ If the input file does not exist or cannot be opened, the program will exit.
64
64
65
65
If .png is omitted from output, the program will append it automatically. You cannot print any other image format from this program - convert it with other software.
66
66
67
-
If not enough values are provided for target or fuzz, the program will ignore the rest. (It's not particularly helpful but at least you can see a result - a .cfg file was planned but trying to user-proof it was a nightmare)
68
-
69
-
#### My inputs for masking each image
70
-
D.House: 135.0 0.7 0.4 60.0 0.5 0.5 - there's a cloud of low alpha pixels to the left, but it's not a big issue
71
-
72
-
Hand: 90.0 0.5 0.5 40.0 0.6 0.6 - this one looks pretty clean!
73
-
74
-
Scientist: 130.0 0.7 0.6 40.0 0.7 0.6 - best I could get without wrecking parts of the image
67
+
If not enough values are provided for target or fuzz, the program will ignore the rest. (It's not particularly helpful but at least you can see a result - a .cfg file was planned but trying to user-proof it is a nightmare)
75
68
76
69
## compose
77
70
**compose** draws one image over another, taking transparency into account. It does not support cropping - the background image *B* must be the same size as or larger than the foreground image *A*.
@@ -92,3 +85,43 @@ Load the foreground image A and background image B using their file paths. You c
92
85
If either input file does not exist or cannot be opened, the program will exit.
93
86
94
87
If the file extension is omitted from output, the program will assume .png format.
88
+
89
+
## convolve
90
+
**convolve** allows you to apply simple global filters (.filt) to an image as many times as desired.
91
+
92
+
#### Controls
93
+
The program will automatically display the original image.
94
+
95
+
C: apply filter once
96
+
97
+
R: revert to original image (specifically, deletes the displayed data and copies the original data)
98
+
99
+
W: write result to file (prompts if not specified in command line)
100
+
101
+
Q or ESC: quit program
102
+
103
+
Note that applying filters will take some time depending on the image and filter sizes. It's not recommended to use large images with this program at the moment.
104
+
105
+
106
+
#### Command line usage
107
+
Load the desired filter file first, then the image you want to open. Additionally, you can specify your desired output filename from the command line instead of entering it upon pressing W.
108
+
109
+
```./convolve [filter].filt [image] (output)```
110
+
111
+
If either input file or filter file do not exist or cannot be opened, the program will exit. This specific program was designed for .png images foremost, but should theoretically work with most common formats.
112
+
113
+
114
+
#### .filt format
115
+
**.filt** files are plaintext data files that define a global convolution filter. Only numbers (integer or floating point, anything's fine) should be put inside each file - any non-numerical data may cause errors.
116
+
117
+
The first number in the file, designated *N*, informs the program of the size of the filter kernel, or its number of rows and columns. The program expects *N*^2 entries after that, separated by whitespace. The exact line usage does not matter, but keeping each row of the filter kernel seperate is recommended.
118
+
119
+
You can find various examples in the included `filters` directory.
120
+
121
+
122
+
#### Known issues
123
+
convolve currently copies the original pixel value to calculate values for pixels that would be outside the image. This may cause edges of images to be bizzarely colored or not change.
124
+
125
+
Additionally, the program currently uses a scale factor and clamping function to keep resulting values within 8 bits per channel. The original plan was to normalize the kernel when loading it, but I discarded this behavior during some confusion with calculations. The current method can make areas of some images too dark or too bright, especially if relatively large negative values are in the filter kernel.
126
+
127
+
Edge calculation filters in general do not work too well with this version of the program.
0 commit comments