Questions tagged [pset4]

The standard edition of Problem Set 4 will move beyond C programming language basics, testing your knowledge of pointers, memory management, file i/o and structs.

Filter by
Sorted by
Tagged with
0
votes
0answers
57 views

Pset4 Filter Check50 error

I have a problem with check50 on grayscale function in pset4/filter. When I add the code if(!(image[i][j].rgbtRed==image[i][j].rgbtGreen==image[i][j].rgbtBlue)) Check50 gives me the error (...
0
votes
1answer
56 views

PSET 4 filter, check50 shows no errors but on submission it scores only 50%

#include "helpers.h" #include<math.h> // Convert image to grayscale void grayscale(int height, int width, RGBTRIPLE image[height][width]) { int avg; for(int i=0;i<height;i++) // ...
0
votes
1answer
54 views

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

// Reflect image horizontally void reflect(int height, int width, RGBTRIPLE image[height][width]) { int t[3]; // using temporary array to swap values for(int i=0;i<height-1;i++) // loop thru ...
0
votes
0answers
34 views

Pset4 Recover segmentation error

Help needed with recover part of pset4. Please find my code below. It compiles but produces a seg fault. Any comments are welcome. Thanks in advance. #include <stdio.h> #include <stdlib.h&...
0
votes
1answer
36 views

Speller - Program has memory errors, but Valgrind claims all heap blocks were freed

:( program is free of memory errors | pset5 Speller I have invalid reads at lines 148 and 153 of my code (commented out below): bool unload(void) { // CS50 for (int i = 0; i < 26; i++)...
0
votes
1answer
27 views

CS50, pset4 recovery, partial recovery of one picture, inconsistent with debug

thank you for considering my question My code is capable of recovering one picture partially. When I open the picture I get maybe a fifth of the picture (someone sitting in a field, I only get up to ...
0
votes
0answers
52 views

CS50 pset4, problem with edge filter

I'm really sorry for the lengthy code. Program compiles with no errors at all. But the output image is all milky white. Please tell me what's wrong with my code. RGBTRIPLE temp[height][width]; for (...
0
votes
2answers
189 views

check50 error on helpers.c in pset4

I'm currently working on the filters assignment in pset4 of CS50. My code compiles and runs without issue and produces the results it should on all the stock images. However when I run check50 I get ...
0
votes
0answers
60 views

Pset 4 filter(less comfortable) manipulating pointers through an array

Very new to coding, so please bear with me! I've been trying to wrap my head around pointers/ addresses since Lecture 4 but I haven't been able to solve the following issue. I can make the following ...
0
votes
2answers
189 views

Rounding Issue with Grayscale and Blur

I seem to be having problems with rounding numbers in these two functions. I am making sure to work with floats and I'm using the round() function so I'm stuck scratching my head at the minute! ...
0
votes
0answers
34 views

Cannot find the problem with my function Detecting Edges

I believe my logic is ok, I have compared it to others and it looks fine, but for some reason all output images are all black // Detect edges void edges(int height, int width, RGBTRIPLE image[height][...
1
vote
2answers
103 views

CS50 PSET4 RECOVER.C SEGMENTATION FAULT PLEASE HELP!

I'm seriously struggling with this assignment and I can't seem to find the problem in my code. I'm supposed to create a program that reads a raw card one block at a time with each block containing ...
0
votes
1answer
114 views

Pset4 Recover conceptually struggling

Pset4 Recover is different since it uses files; fopen, fcloser, fprintf, and fread. It adds a whole new dimension to the coding. Its change from just formatting conceptions to making sure all the ...
0
votes
2answers
56 views

Can't write jpegs in recover, segmentation fault

here's the code i wrote: #include <stdio.h> #include <stdint.h> #include <stdlib.h> typedef uint8_t BYTE; //take command line argument from the user for the file name int main(int ...
0
votes
1answer
165 views

CS50 Blur issue

void blur(int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE holder[height][width]; int red; int green; int blue; float counter; for (int i = 0; i < height; i++) { for (int j ...
0
votes
2answers
189 views

pset4 - Filter - blur error

first post on here so be nice :) I'm working my way through CS50 on edx.org, I've come to pset4 - Filter (less) and have become absolutely stuck. I have programmed the other 3 photo filters with ...
0
votes
1answer
124 views

Pset 4 Filter Reflect less

I can't find why it doesn't work. That's the error message: index 600 out of bounds for type 'RGBTRIPLE [width] And I think it makes half reflection and half stays the same... That's my code: // ...
0
votes
2answers
938 views

PSET4 Filter: Blur help

While trying to create an algorithm to come up with the average of the color for all nine pixels (if using 9) I realized I would need a way to see how many surrounding pixels are used in the ...
0
votes
1answer
56 views

Recover doesn't provide any images

Not sure why there are not results from this program, recover literally does nothing. Better than my old program that created over 500 images I guess. #include <stdio.h> #include <stdlib.h&...
0
votes
1answer
54 views

Filter Blur Image output is wrong

I'm not sure exactly what is wrong with my code. I don't get any runtime errors and my code compiles, but the image doesn't change at all compared with the original, and check 50 tells me I am out - ...
0
votes
1answer
81 views

Blur error in CS50 problem set 4 — filter_less

I have been trying to figure out the error for hours long and still no success, it'll mean a lot to me if someone can tell me what is the error in this code in order to apply a blur filter. I ...
0
votes
1answer
69 views

pset4 recover incorrectly generate images

I need your help with pset4 recover, as image does not recover correctly. And I would like to have more understanding on how file pointer works. Below is what I have written which generate no correct ...
1
vote
1answer
481 views

Filter (Less Comfortable) Seems to Work Perfectly, but only passes 7 of 22 checks

My code is posted here: https://gist.github.com/themattmcguire/1ee1a683fe2e22ff1b7b4ef8cebe120b My code correctly works on all the stock images, for all the functions (grayscale, sepia, reverse, and ...
0
votes
1answer
434 views

CS50 filter issues with greyscale, sepia, and blur

for greyscale I get issues with check50, but the program appears to operate correctly. With sepia and blur, the image outputted is the same as the image inputted. For blur, I would also be curious to ...
0
votes
1answer
53 views

Using fseek in Pset4 recover to iterate through the binary file (one 512 Byte block at a time)

I just have a conceptual question for how fread and fseek works in the context of the pset4's recover assignment. Initially when I was trying to write my program for this assignment, I was using fseek ...
0
votes
2answers
35 views

Code divides image

I run my code and it complies and provides a (kind of) reflected image. It breaks the image in half and mirrors it instead of just reflecting. My goal was to switch the place of each pixel in the row, ...
0
votes
1answer
421 views

CS50 Problem Set 4 Edge Filter

the output of my program seems fine. When i run Check50 though i get two error messages: :( edges correctly filters 3x3 image expected "76 117 255\n21...", not "76 117 255\n21..." :( edges ...
0
votes
1answer
51 views

pset4 Recover - need to break (^C) to exit

I'm recovering the files just fine, but my program seems stuck in the while loop. I've tried adding extra closing statements and adding else statements, but I can't seem to find where/why it won't ...
1
vote
1answer
183 views

pset4 filter reflect. runtime error: index 601 out of bounds for type 'RGBTRIPLE [width]'

Below is the code that generated the error message. From what i can tell some part of this created a [j] value that was larger than the width. My thoughts on this problem was: With a hypothetical ...
0
votes
2answers
462 views

PSET4 (More Comfortable) Filter Edges

I am trying to code Pset4 (more comfortable) edges, the program is running, but my outcome is completely white. Any Suggestions? Here's My Code.... void edges(int height, int width, RGBTRIPLE image[...
1
vote
1answer
219 views

pset 4 filter edge not working

I am having issues with my implementation of edges. I decided to make a 'border' around the edges of the image made up of zeros (did this in a copyImage array). I get correct outputs for some of the ...
0
votes
1answer
91 views

Unusual errors in Blur filter

I am working on the Blur filter in pset4 and I have received some very unusual errors when trying to compile my program. The following is my code for the blur filter. As part of this, I have decided ...
0
votes
1answer
79 views

Reflection - Pset4 - Code compiles however, not producing expected outcome

I have the following code below. The code compiles correctly, but the resulting images is exactly the same as the one that was used as the input file. I have gone through each line multiple times and ...
0
votes
1answer
104 views

Please could I get some help with pset4 recover

Please could I get some help with my code for Pset4's recover? I have been stuck on it for about 8 hours today and cannot work out why it isn't working. I think the current issue is that my current[] ...
0
votes
1answer
73 views

What can be going wrong in this blur code?

void blur(int height, int width, RGBTRIPLE image[height][width]) { for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { //i0j0 corner top-left ...
0
votes
1answer
45 views

PSET4 Recover timing out

My code works for the card.raw that is given part of the problem set. However, it times out when I use check50. Does anyone know why even though the code compiles rather quickly for the card.raw? Or ...
0
votes
1answer
201 views

PSET4 Filter(More) Edge detection help

Hello guys I have been trying to figure out what is wrong with my code for hours now but to no avail. I really wanted to finish this problem myself but I am so close and hope that someone can figure ...
0
votes
1answer
72 views

One tiny step to completion. Recover recovers all images except the first one. Help!

Alrighty. I just need someone to point out to me where the issue is so i can finish this thing. submit it. and move on. i'm so so close. so help would be greatly appreciated. // include libraries #...
0
votes
1answer
325 views

Pset4 Filter Edge Dedection

my code is running well on a dedicated hardcoded version of check50 edges middle pixel, but as soon as I use it for the check50 it gives an error. Debug50 did calculate exactly what it should have ...
0
votes
2answers
122 views

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

This is the output and input image that my code generates: https://imgur.com/a/mT7YqCD void blur(int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE newImage[height][width]; ...
0
votes
0answers
28 views

strange bug in pset 4 recover

I solved pset 4 recover, but one of the bugs in my program which I removed, I found the code which was causing the problem but I don't know why it was. At the end of my program I was freeing up ...
0
votes
0answers
51 views

Help with detecting edges on pset4/filter/more

My program seems to be ok in my brain and on the "outfile.bmp", but when I check50 it all I get is: Here is my code, void edges(int height, int width, RGBTRIPLE image[height][width]) { int gxb, ...
0
votes
1answer
45 views

PSET4 Recover Segmentation Fault, please help

I hope everyone is doing well during this difficult time, my prayers to those been affected by it. I have difficulty debugging the segmentation fault here and the cs50 debugger is not too helpful on ...
0
votes
1answer
311 views

To those who struggle with pset4’s filter-more’s edge detection filter

I’m sure it is obvious for some people, but it wasn’t for me) If your code isn’t working the way it should, you can create new .c file and put there your logic from edge detection function. You can ...
0
votes
1answer
95 views

Pset4: Recover, only 49 images and fails with check50

I recently started with CS50 and I struggle a bit with pset4's recover. While the jpgs look correct to me, my code only recovers 49 jpgs total, not the 50 which are expected. Check50 fails on the ...
0
votes
2answers
216 views

pset4 blur filter

I've been working for like a week on cs50/pset/filter/blur question, but this doesn't seem to be working. My code is like this, and the resulting "blur filtered" image is not any close to what is ...
0
votes
1answer
55 views

PSET 4- RECOVER getting 22 pictures and none good

I keep looking my code and connot identify what is going on. I open 22 pictures, but none of them are good. It doesn't even write in the entire picture, some of them just a part of the picture is ...
1
vote
1answer
539 views

pset 4 : filter - Could not open .bmp file

I have a trivial question. Starting the pset with freshly downloaded and unchanged code and trying to pass a file with ./filter -g yard.bmp out.bmp yields : Could not open yard.bmp. I wrote a simple ...
0
votes
1answer
156 views

Problem Set 4 - Filter (Blur)

I know its pretty lame and uninspired to hard-code each and every special case of the blur function, but somehow it still refuses to pass most of check50's tests (aside from the middle and edge pixel ...
0
votes
1answer
81 views

Pset4/recover: code is working fine but the recoverd images are not correct

I have written this code. The code seems to work fine but the images are not correct they are distorted. I have attached those photos below. Can you please help me and tell me where I went wrong in ...

1 2 3
4
5
32