6 votes
Accepted

pset4 filter: blur seems to be working, but check50 reads errors

You overwrite pixels you still need later, for calculating the neighbouring pixels. What looks about right visually is still wrong. I made another array, wrote my blurred image to that, then later ...
Blauelf's user avatar
  • 20.9k
5 votes
Accepted

check50 error on helpers.c in pset4

When doing math operations that could result in decimal point number, although the recieving variable is a decimal point capable, the math on the right side of the asign simbol'=', when working with ...
Tritum's user avatar
  • 1,571
4 votes
Accepted

pset4 filter blur problem

You're adding one pixel twice, and missing one pixel. The code, as you've written it, is really prone to tiny bugs like that, and they're hard to find. Once you've got it working, consider how you can ...
Llenk's user avatar
  • 744
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 ...
Cliff B's user avatar
  • 68.8k
4 votes

Help with blur filter for pset4! Output image is significantly darker than input

Got the solution. Using the BYTE type to store the color values resulted in overflow. Solving by using int or double for redAvg, greenAvg, and blueAvg.
Michael Weiser's user avatar
3 votes
Accepted

Questions regarding pset4 Blur filter (less comfortable)

Because BYTE can only hold values up to 255. If say all three RGB values were already 255, then the sum would overflow the variable. If both dividend and divisor are ints in a division, then it's ...
Fuelled_By_Coffee's user avatar
3 votes
Accepted

Image blurs but check50 fails for filter less. Why?

Did you look at the actual raw data of the resulting image to see what's happening? You can't just look at the image and say it's working because it "looks blurrred". Its just not blurred ...
Cliff B's user avatar
  • 68.8k
2 votes

pset4 filter blur help

You read from and write to the same array, but you need the original values for computing other averages. A solution would be to use two arrays, one for reading, one for writing, and copy between ...
Blauelf's user avatar
  • 20.9k
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 ...
Blauelf's user avatar
  • 20.9k
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.
Blauelf's user avatar
  • 20.9k
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 ...
Tritum's user avatar
  • 1,571
2 votes
Accepted

CS50 filter issues with greyscale, sepia, and blur

When you divide the 3 colors by 3 you'll probably get a decimal point value. If you receive it in a 'int' variable you'll get a trimmed number. (the decimal part will be removed) The way to do it is ...
Tritum's user avatar
  • 1,571
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 ...
Kavija Karunarathna's user avatar
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 ...
AWTom's user avatar
  • 165
2 votes
Accepted

CS50 Pset4 Blur

From one blind old fart to another, it's like the guy that lost his glasses in the basement but was looking in the back yard because the light was better. You're looking in the wrong place. ;-) The ...
Cliff B's user avatar
  • 68.8k
2 votes

My blur function blurs every image, but fails every check50 check - please help!

Please note I haven't validated this with testing and have only glanced at your code, but one thing that stands out to me: round((float) (sum_blue / pixel_type)) Remember operator precedence here: ...
Sentox's user avatar
  • 950
2 votes
Accepted

PSET4 Blur not passing Check50

Without doing a deep dive, I do see a major problem in the logic. The code copies all the pixels from image to temp array. But then, it does all the calculations using the temp array as the source ...
Cliff B's user avatar
  • 68.8k
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 ...
Cliff B's user avatar
  • 68.8k
2 votes
Accepted

My CS50 PSET4 Filter (Less) Blur function doesn't pass check50 despite seemingly working fine

"The code seemingly blurs images without error" indicates a problem. "Seemingly" correct output is not exactly correct. It tells me that the actual digital data output needs to ...
Cliff B's user avatar
  • 68.8k
1 vote

cs50 pset4 blur function index out of bounds issue

Some of your conditions need to change. There's no 'between' syntax like in maths, so (0 < j < width-1) won't work in c. You need to split this into something like (j > 0 && j < ...
smartinmelbourne's user avatar
1 vote
Accepted

Pset 4 Blur Filter Program Seems to Compile but Doesn't Output Anything and Check50 Reads Errors

For starters, the loops never run. That's why the output looks like the original image. Look at the test conditions in the for loop: for (int i = 0; i < height && i > 0; i++) { for (...
Cliff B's user avatar
  • 68.8k
1 vote
Accepted

pset4 filter/blur code problem

If you look carefully at the extended results for check50 (the link at the end), you'd see that the result array is the same as the original input array. The problem lies here: image = new_image; ...
Cliff B's user avatar
  • 68.8k
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.
Tritum's user avatar
  • 1,571
1 vote
Accepted

blur pset4 help please, my code compiles but it does not pass any of the check50 at all

It's the same problem here: https://cs50.stackexchange.com/a/38197/27433 Also by doing the division for the averaging with 'int' types, will result in a number that will be truncated. i.e. if the ...
Tritum's user avatar
  • 1,571
1 vote

pset4 filters: thinking behind blur

What I understand at a quick glance at your code is that you transfer every value one by one into another 2D array at every iteration. To process the colors you program calculations for every possible ...
MO_TM's user avatar
  • 24
1 vote
Accepted

pset4 problem with blur, can't find what's wrong

You are averaging the values in the wrong place. You have to calculate the average after you have added all the values around the current pixel. Don't forget to reset the variables for the following ...
Tritum's user avatar
  • 1,571
1 vote
Accepted

pset4 filter /blur

Look at the test conditions. Here's an example. else if (0<h<height-1) That form is fine in python but not in C. It needs to look like else if (0 < h && h < height - 1) Not ...
Cliff B's user avatar
  • 68.8k
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 ...
Tritum's user avatar
  • 1,571
1 vote
Accepted

pset 4 reflect & blur work but don't test

For reflect a question: How many swaps do you need to do to flip the image horizontaly? Think about it. For blur you got it rigth, except for a little mispell in your 'if' line. Edited because I ...
Tritum's user avatar
  • 1,571
1 vote
Accepted

CS50 pset4, I have problems with getting the blur filter to work

When you divided here: image[i][j].rgbtRed = (sumRed / pixCount); you'll problably get a decimal point result. The problem is that working with int variables will result in a truncated result, the ...
Tritum's user avatar
  • 1,571

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