23 votes
Accepted

Why does it not round up correctly?

You are dividing an integer by an integer. This is integer division, and will produce an integer again, ignoring the fractional part. You could make it a floating point division by making at least ...
user avatar
  • 20.7k
6 votes
Accepted

pset4 filter won't open file

That's simple because infile.bmp does not exist, that is just a placeholder it means that, that the path you put in there should contain a file. The folder images has images where you could process or ...
user avatar
  • 711
4 votes
Accepted

pset4 Blur (Filter) not passing check50

This is an interesting one! It took me a bit to realize what was happening. As you probably did, I spent a lot of time, looking for an error in the math, in the logic, in something that was in the ...
user avatar
  • 64.1k
3 votes
Accepted

Pset4: Filter, reflect values are off

So you have an issue with even width only. In the example of a width of 2, round((width - 1) / 2) would be round((2 - 1) / 2) or round(1 / 2) and since that's integer division (both operands are ...
user avatar
  • 20.7k
3 votes
Accepted

helpers.c not compiling for filter

You are not meant to compile helpers.c to its own programme. Just make filter. The Makefile will make sure that helpers.c gets compiled as well, and that it gets linked into filter.
user avatar
  • 20.7k
2 votes
Accepted

rounding problems with blur function - pset4 2020, filter less

You solved grayscale. Maybe you should check how you did the rounding there, and if you can apply that to blur. Edit: Totally missed that you do typecasts in most of the averages. But there are some ...
user avatar
  • 20.7k
2 votes
Accepted

PSET 4 Filter(Less) help with Blur

>= 0, not > 0. 0 is a valid index. Also, you might have rounding issues because you are doing integer division.
user avatar
  • 20.7k
2 votes
Accepted

PSET4 Filter: Blur help

First you have to think that when taking the values from the surroundings pixels, some of them will be already changed so the result will be diferent than with the original ones. Think in how you ...
user avatar
  • 1,561
2 votes

pset4 filter - blur - runtime error, colors off

Um, your code seems pretty hardcoded. It is good to improve the ability to think by trying to implement a new algorithm. I'm really sorry, I couldn't read it because its a lot. :( Anyways here's my ...
user avatar
2 votes
Accepted

Pset4 Reflect not working on 4x4 image

This is interesting! ;-) I'll bet that the code works perfectly with any image that has an odd number of rows and produces the original image when there's an even number of rows! The reversal code, ...
user avatar
  • 64.1k
2 votes
Accepted

pset4 - filter program,can't figure out what exactly is the problem with blur!

This is happening because your loop is summing values from neighbors to the left and up of the current pixel that have already been blurred by previous iterations of the same loop. You need to modify ...
user avatar
  • 165
2 votes

Pset4 Filter sepia error from check50

just fixed it. so the code was wrote in wrong order and the Ternary Operator was missing a () void sepia(int height, int width, RGBTRIPLE image[height][width]) { for (int i = 0; i < height; i++)...
user avatar
  • 23
2 votes

PSET4 filter less Blur function

Well, this code definitely blurs the image, but far from correctly. While the "math" may be right (not saying yes or no because I didn't look), there's a more serious logic problem. To blur ...
user avatar
  • 64.1k
2 votes
Accepted

PSET4 LESS BLUR function -Ending Edges problem 2nd version

Not sure what you changed but the problem code remains exactly the same. It's in these lines (from the original code): for( int i = 0; i <= height ; i++) { for( int j = 0; j <= width ; j++)...
user avatar
  • 64.1k
1 vote
Accepted

PSET 4 BLUR and 2 of REFLECT

For reflect, you have to re-think this expresion: [width - (j + 1)]. For Blur, you need to reset your variables before every i/j iteration.
user avatar
  • 1,561
1 vote
Accepted

Pset4 less comfortable compile error

In the pset we have several files, if you look closely at the specifications, there is a special file called makefile, and what we have to write to the compiler is: make filter
user avatar
  • 5,172
1 vote

pset4 - Green and Blue off in filter (less)

Remember, Not Everytime multiplying a point notation will yield a perfect integer, so directly assigning a point notation to the single channel of a pixel won't work. You have to store the value in a ...
user avatar
1 vote
Accepted

PSET 4 - Filter: Anyone able to help me on Edges?

There is a little misspell in your gx array in the 'gXY_grid' function. There would be some improvements to optimize your code, but by fixing the array, your program will do the job.
user avatar
  • 1,561
1 vote

Pset4 Grayscale Not doing anything to image - Nothing happens to the images spit out of this am I doing something wrong?

When decimal point result is expected in a division, like in this case, working with 'int' variables, will result in a truncated results. For example if the result is 3.9 when assigned to an 'int' the ...
user avatar
  • 1,561
1 vote
Accepted

Pset4 less comfortable errors!

Go to the link given at end. It opens check50 website and you can look at actual errors that are happening.
user avatar
  • 992
1 vote
Accepted

PSET4 FILTER(LESS) BLUR HELP!

As you're experiencing, finding a misspelling in your code, is very dificult. When you are more comfortable with your coding, I suggest you give a try to reduce the lines of code. When I was about ...
user avatar
  • 1,561
1 vote

PSET 4 Errors: where did I go wrong?

For grayscale you should take a look to operator precedence in C (google). The result 'a + b / c' is not the same than '(a + b) / c' For reflect a question: How many swaps do you need to do to flip ...
user avatar
  • 1,561
1 vote

Edge detection produces weird outputs

May be some more issues but, a big one, is that you are not processing the edge and border pixels at all: Here: if (x - 1 < 0 || x + 1 > width - 1 || y - 1 < 0 || y + 1 > height - 1) ...
user avatar
  • 1,561
1 vote
Accepted

PSET4 - Filter edge too yellow

When checking the values of adj_i and adj_j in your 'if' conditions, you are not checking against your adjacent_positions arrays, since you added the values of i an j to them here: int adj_i = i + ...
user avatar
  • 1,561
1 vote
Accepted

Blur works visually, but check50 reads errors for every section

You're doing integer division it disregards the remainder, simple fix would be to just divide by 9.0 as it will become a float division, integer division is like 11 / 2 = 5.5, oh the data type is int ...
user avatar
  • 711
1 vote

PSET 4 filter less comfortable (blur filter) help

I realised that in line 4 i am assigning values to float only once. So when I loop it in the following lines, avg_of_9_blue, avg_of_9_red and avg_of_9_green just keep increasing past 255. Corrected ...
user avatar
  • 23
1 vote
Accepted

pset4 Filter Reflect could anyone check my code, I can't find the error as to why it does not output desirably

You only need two loops to go through all the pixels of the image. One for every row, and one for the horizontal switching. So think about this: How many switchings do you need to do for every row to ...
user avatar
  • 1,561
1 vote

CS50 Blur issue

I missed a += on the rgbtGreen :S
user avatar
  • 11
1 vote

PSET4 Filter: Blur help

Conditional loops is really the way to go on this one. If the pixel is along the left edge and time there is an image[j - 1] it would cause an index error. Think of all conditions that would cause an ...
user avatar
1 vote

Blur error in CS50 problem set 4 -- filter_less

I was facing this exact problem for a while. It's something you can solve by taking a step back and thinking in what you're doing. You take a pixel and you transform it using the information of the ...
user avatar
  • 1,561

Only top scored, non community-wiki answers of a minimum length are eligible