Skip to content

Commit 5d73251

Browse files
committed
filter
1 parent 9013b1e commit 5d73251

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

filter/less/filter.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ The new value of each pixel would be the average of the values of all of the pix
8585

8686
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.
8787

88+
8889
## Getting Started
8990

9091
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
9798
* Execute `cd filter` to change into that directory.
9899
* 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.
99100

101+
100102
## Understanding
101103

102104
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:
149151

150152
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.
151153

154+
152155
## Specification
153156

154157
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
185188

186189
1. Use this function in your `grayscale` function to make the black-and-white version of the full image.
187190

191+
1. Test your code: `./filter -g images/infile.bmp outfile.bmp`. The resulting image will clearly be in grayscale.
192+
188193
### Sepia
189194

190195
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
195200

196201
1. Implement a separate `sepia_pixel` function, like you did for `grayscale_pixel`.
197202

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).
199206

200207
### Reflect
201208

@@ -207,6 +214,8 @@ The `reflect` function should take an image and reflect it horizontally.
207214

208215
1. For reflect, it's cleaner to **not** use an additional helper function. You can implement the full reflect inside the `reflect` function.
209216

217+
1. Test your code: `./filter -r images/infile.bmp outfile.bmp`.
218+
210219
### Blur
211220

212221
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
219228

220229
1. Use this function in your `blur` function to make the blurred version of a full image.
221230

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.
225232

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.
232234

233235

234236
## Hints
235237

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!
239+
237240

238241
## Testing
239242

0 commit comments

Comments
 (0)