New answers tagged

1

Do you understand why you have to check for values over 255? You are doing it too late. A BYTE has 8 bits. That means the maximum value it can hold is 255. You are calculating the new value and storing it directly into image[i][j].rgbtRed for example. At that point, if the calculated value is > 255, it will be truncated when you assign it. So it's ...


0

That's the correct image: https://imgur.com/a/Z4APwpb It seems that something is wrong with the edges for sure. And also something wrong with the rest of the numbers, too, because I see a lot of noise in your image (compare the left chimney, for instance). It would be great if you can figure out a less hard-coded version. Less hard coded versions protect us ...


0

Tried many times to fix and check Blur image section by check50 but keeps giving errors. I removed and reinstalled the filter folder, retyped code and voila check50 gave all four sections GREEN. Results for cs50/problems/2021/x/filter/less :) helpers.c exists :) filter compiles :) grayscale correctly filters single pixel with whole number average :) ...


0

After reading the documentation again, I found that to get an grayscale image you have to run it with a different command include image folder and the name of the image like: [ ./filter -g images/yard.bmp out.bmp ]. This commands created new grayscale image and was the correct scale.


1

This doesn't look like a code problem. Since check50 passes, the code is ok. Most likely (I'll put the odds at over 98%), the file infile.bmp either doesn't exist in the directory where you're running the program, or it is corrupted. Check to see that the file infile.bmp exists in the current directory and open it to see that it contains an image. If this ...


Top 50 recent answers are included