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
Copy file name to clipboardExpand all lines: filter/less/filter.md
+14-11Lines changed: 14 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -85,6 +85,7 @@ The new value of each pixel would be the average of the values of all of the pix
85
85
86
86
For a pixel along the edge or corner, like pixel 15, we would still look for all pixels within 1 row and column: in this case, pixels 10, 11, 12, 14, 15, and 16.
87
87
88
+
88
89
## Getting Started
89
90
90
91
Here's how to download this problem's "distribution code" (i.e., starter code) into your own CS50 IDE. Log into [CS50 IDE](https://ide.cs50.io/) and then, in a terminal window, execute each of the below.
@@ -97,6 +98,7 @@ Here's how to download this problem's "distribution code" (i.e., starter code) i
97
98
* Execute `cd filter` to change into that directory.
98
99
* Execute `ls`. You should see this problem's distribution, including `bmp.h`, `filter.c`, `helpers.h`, `helpers.c`, and `Makefile`. You'll also see a directory called `images`, with some sample Bitmap images.
99
100
101
+
100
102
## Understanding
101
103
102
104
Let's now take a look at some of the files provided to you as distribution code to get an understanding for what's inside of them.
@@ -149,6 +151,7 @@ Then, you can run the program by running:
149
151
150
152
which takes the image at `images/yard.bmp`, and generates a new image called `out.bmp` after running the pixels through the `grayscale` function. `grayscale` doesn't do anything just yet, though, so the output image should look the same as the original yard.
151
153
154
+
152
155
## Specification
153
156
154
157
Implement the functions in `helpers.c` such that a user can apply grayscale, sepia, reflection, or blur filters to their images. You should not modify any of the provided function signatures, nor should you modify any other files other than `helpers.c`.
@@ -185,6 +188,8 @@ The function `grayscale` should take an image and turn it into a black-and-white
185
188
186
189
1. Use this function in your `grayscale` function to make the black-and-white version of the full image.
187
190
191
+
1. Test your code: `./filter -g images/infile.bmp outfile.bmp`. The resulting image will clearly be in grayscale.
192
+
188
193
### Sepia
189
194
190
195
The function `sepia` should take an image and turn it into a sepia version of the same image.
@@ -195,7 +200,9 @@ The function `sepia` should take an image and turn it into a sepia version of th
195
200
196
201
1. Implement a separate `sepia_pixel` function, like you did for `grayscale_pixel`.
197
202
198
-
2. Use this function in your `sepia` function to make the sepia-colored version of a full image.
203
+
1. Use this function in your `sepia` function to make the sepia-colored version of a full image.
204
+
205
+
1. Test your code: `./filter -s images/infile.bmp outfile.bmp`. The resulting image will be in sepia, but it may be hard to clearly distinguish (especially when you're color-blind in some way).
199
206
200
207
### Reflect
201
208
@@ -207,6 +214,8 @@ The `reflect` function should take an image and reflect it horizontally.
207
214
208
215
1. For reflect, it's cleaner to **not** use an additional helper function. You can implement the full reflect inside the `reflect` function.
209
216
217
+
1. Test your code: `./filter -r images/infile.bmp outfile.bmp`.
218
+
210
219
### Blur
211
220
212
221
Finally, the `blur` function should take an image and turn it into a box-blurred version of the same image.
@@ -219,21 +228,15 @@ Finally, the `blur` function should take an image and turn it into a box-blurred
219
228
220
229
1. Use this function in your `blur` function to make the blurred version of a full image.
221
230
222
-
1. Hint: To blur a pixel, you should always use the surrounding values from the original image. So for blurring, make sure that you have a copy of the original image pixels available.
223
-
224
-
## Usage
231
+
1. Hint: To blur a pixel, you should always use the surrounding values from the **original** image. So make sure that you have a copy of the original image pixels available.
225
232
226
-
Your program should behave per the examples below.
227
-
228
-
$ ./filter -g infile.bmp outfile.bmp
229
-
$ ./filter -s infile.bmp outfile.bmp
230
-
$ ./filter -r infile.bmp outfile.bmp
231
-
$ ./filter -b infile.bmp outfile.bmp
233
+
1. Test your code: `./filter -b images/infile.bmp outfile.bmp`. The resulting image should indeed be a little bit blurry.
232
234
233
235
234
236
## Hints
235
237
236
-
The values of a pixel's `rgbtRed`, `rgbtGreen`, and `rgbtBlue` components are all integers, so be sure to round any floating-point numbers to the nearest integer when assigning them to a pixel value!
238
+
The values of a pixel's `rgbtRed`, `rgbtGreen`, and `rgbtBlue` components are all integers, so be sure to **round** any floating-point numbers to the nearest integer when assigning them to a pixel value!
0 commit comments