0

https://cs50.harvard.edu/college/psets/4/filter/less/

I'm so lost I don't really know where to begin. The last exercise plurality with the distributive code was a nightmare, I only found one other post on stack overflow to reference. This reminds me of some of the other problems with these intro to comp sci classes.
Basically all the code is written, bmp.h deals with typedef structs, that I'm really uncomfortable with http://msdn.microsoft.com/en-us/library/dd183376(VS.85).aspx. filter.c gets into argv, fread, the real part of the code that takes all the other file parameters and run the code. helpers.h seems to be a template of helper.c, which would make sense because it's a header file but then again it's been hard too learn and I feel like I'm going down a rabbit hole.

There has to be some other books, youtube tutorial, that could bring me up to this point. I feel really sorry for anybody who's life depended on getting these psets time in a timely fashion, while there interesting problems there just wasnt enough time in the lectures to get everyone really acquainted and no other reference. I can see with the distributive code how easy this problem could be but I have no foundational skills can someone recommend a good way to learn c in 2019, at this point Im done with filter-less! I imagine I'm not the only one.

/ Convert image to grayscale void grayscale(int height, int width, RGBTRIPLE image[height][width])

1 Answer 1

2

Have you watched the "Walkthrough" videos yet? It looks like there's only one video, but there are actually several (just kind of hidden because they will play one after another, and you can select which one with a playlist to the top right corner of the video screen). Watching the video on the grayscale implementation helped a lot, and I was actually able to get it right the first time (first time coder!). Sepia has been more difficult for me, and I am really close, just have one problem...

Like I said, the walkthrough video on grayscale explains it a lot better, but I can try to break it down a bit.

  1. You should only be really focused on helpers.c - and you don't have to "make" it, just make sure to save. "make" the filter.c file and run that one to see if it's working. I was definitely overwhelmed by all the other code at first, but if it helps, just close out those tabs and ignore them for now.

  2. Each pixel has X amount of red, Y amount of blue, and Z amount of green. Specifically for turning something to its gray equivalent, you basically have to average these three values, and then set each amount of red/blue/green to that average value. (This is explained well, in a visual way, in the video).

  3. You have to iterate through each row, and through each pixel, changing the original values of red/blue/green to these averaged values. (This should make you think nested loops!)

It seems a bit more complicated than it actually is. Get the math figured out, and then set the pixel red/blue/green values to the average. I was assuming it's the same idea for sepia, but since I'm a little stumped on that, I am not yet sure.

1
  • I see how it could be done but starting the problem with unchanged and freshyl downloaded code, I pass an image with : ./filter -g yard.bmp out.bmp and I get "Could not open yard.bmp" I wanted to start with a simple approach - turn all channels to 0 thus darkening the whole file and working up from there but this will be funny when i could not even test the code. Commented Mar 27, 2020 at 18:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .