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
1answer
11 views

Pset4 Sepia Function

I test it and it works but check50 tell :( sepia correctly filters single pixel expected "56 50 39\n", not "56 62 60\n" :( sepia correctly filters simple 3x3 image ...
0
votes
1answer
9 views

filter more comfortable pset4 edges

this is my attempt on cs50 more comfortable pset4 edges part I cannot find my mistake. I get a mostly white image with some repeating noise as output. I have tried simplifying more complex expressions ...
0
votes
1answer
17 views

Recover finding all images but not passing check50

I know this has been brought up a few times before but none of the solutions seem to be relevant to the code that I have written below. My recover.c file compiles, executes and returns all 50 images ...
0
votes
1answer
8 views

Segmentation and bool fault in recover.c

Can anyone help? I keep getting a segmentation fault when trying to run recover.c. It compiles fine. My code is below. I do plan to add in the error returns once I can get this to work properly as ...
0
votes
1answer
13 views

CS50 Recover pset is causing segmentation fault

This is question is fairly common here, but I haven't seen code similar to mine. This has led me to doubt my screen thoroughly, so I come here asking for help. It doesn't throw any errors with either ...
0
votes
1answer
11 views

pset4 Recovered image doesnt match

I´m trying to solve the pset4 recover challenge, but i havent been able to make the program recover the full image, only one part of it. What am i doing wrong ?? This is my code: #include <stdio.h&...
0
votes
1answer
15 views

PSET4 Filter (Less) Sepia

:( sepia correctly filters simple 3x3 image expected "100 89 69\n100...", not "100 89 69\n100..." :( sepia correctly filters more complex 3x3 image expected "25 22 17\...
0
votes
1answer
14 views

Check50 shows errors on Blur Function, Filter even though images are blurred

My blur function seems to be working when I input the sample images and open the output file but check50 shows 4/5 errors :( blur correctly filters middle pixel expected "127 140 149\n", not ...
0
votes
1answer
24 views

Recover code makes 000.jpg to 049.jpg, but jpgs are corrupt

I've been working on this problem for a little bit, but right now I have no clue why my code isn't working. Right now it spits out the 50 jpgs like it's supposed to, but they're all blank. Anyone have ...
0
votes
1answer
17 views

PSET4 Recover Problem

This is the result of my code: :) recover.c exists. :) recover.c compiles. :) handles lack of forensic image :( recovers 000.jpg correctly recovered image does not match :( recovers middle images ...
0
votes
1answer
23 views

Where am I mystaking ? pset4-RECOVER

I've been rewriting that code for about a week now and start beeing very confused about what I am doing wrong, I hope my logic isn't fully wrong but I have some doubts about my understanding of ...
0
votes
1answer
8 views

In Recover, when I run check50, it says timed out while waiting for program to exit. But when I run it with ./recover card.raw, it works perfectly

#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int check_jpg(BYTE array[]); int main(int argc, char *argv[]) { if(argc != 2) { ...
0
votes
1answer
18 views

pset4 reflect half of the image

I have an issue with the reflect filter, it just reflects half of the image so what is the issue with my code here?! void swap(RGBTRIPLE *pixel1, RGBTRIPLE *pixel2) { RGBTRIPLE temp = *pixel1; ...
0
votes
1answer
24 views

pset4 filter Invalid or Unsupported Image Format

I have an issue with the pset4 filter, I've applied grayscale filter and sepia filter and they are working already, but when I started to write a code for reflect filter and try to compile then ...
0
votes
1answer
34 views

Pset4 Im having issues with the blur filter

Im extremely close to solve this problem, this is the result of check50 :) helpers.c exists :) filter compiles :) grayscale correctly filters single pixel with whole number average :) grayscale ...
1
vote
1answer
21 views

I am asking about pset4. What is the importance of creating a header file like helpers.h?

I am confused about the usage of helpers.h and declaring the functions in it. As I can from the beginning include the bmp.h in the helpers.c and create the functions in the helpers.c.
0
votes
1answer
26 views

pset4 filter (more) edge not passing check50

this is my code for Edge, and it's not passing check50. below are the errors I got. any help is appreciated. :( edges correctly filters middle pixel expected "210 150 60\n", not "28 202 ...
0
votes
1answer
24 views

PSET4: Why are my values off?

#include "helpers.h" #include <math.h> // Convert image to grayscale void grayscale(int height, int width, RGBTRIPLE image[height][width]) { // looping through the image row by row ...
0
votes
1answer
36 views

Pset4 Filter sepia error from check50

below is my code for Pset4 filter(less). the code compiles fine, but I was getting these errors from check50. really appreciate if anyone can help. thanks :( sepia correctly filters single pixel ...
0
votes
2answers
39 views

Pset4 recover segmentation fault when running

Finished the problem but when running check50 gets segmentantion faultand running ./recover card.raw . The error code is the following: :) recover.c exists. :) recover.c compiles. :) handles lack of ...
0
votes
1answer
25 views

Pset4 filter blur corner

I finished the other filters and just the blur filter is giving errors. The errors are the following: :) blur correctly filters pixel on edge :( blur correctly filters pixel in corner expected &...
0
votes
1answer
24 views

Segmentation fault in blur filter

This is my code for the blur filter in the pset 4. First I used the average for the corner pixels, then I used a loop for the average of the first and last row and columns and then a nested loop for ...
0
votes
1answer
26 views

pset4 recover Segmentation Fault jpg000

Please can someone explain why I get a segmentation fault? The code below works for check50 but ideally I'd like to use the function write_header to write the first file. #include <stdio.h> #...
0
votes
2answers
36 views

Getting a segmentation fault in pset4 recover

I'm getting a segmentation fault when trying to run my program for pset4 recover. I've been trying for ages to debug it, but I'm finding it really difficult because when I try to use debug50, after ...
0
votes
1answer
26 views

Why can't I assign the return value of a fwrite() function to another variable? Infinite loop

In 'recover' I wanted to jump out of my while loop if the fwrite() function of the last photo (of the file) returns a value < 512 (indicating that the last photo or end of file is reached). I ...
0
votes
1answer
26 views

I don't know what I'm doing wrong Pset4 filter “edges”

I can't get edges to work I would really like some hints to what's wrong with my code. // Detect edges void edges(int height, int width, RGBTRIPLE image[height][width]) { //copying original image ...
0
votes
1answer
62 views

cs50 2021 pset4 recover help

EDIT: Ok after trying for 3 hours after posting this I have finally managed to solve this pset. The problem wasn't actually a logical one but rather it was a problem with the type definition and the ...
1
vote
2answers
97 views

Possible error in solution video of pset4 lab 'volume' within fread() function of header

I think there is an error in the solution video of pset4 lab called 'volume' within the fread() function of the header (of the wav file). I think they swapped 'header_size and '1' - so they swapped ...
0
votes
1answer
67 views

PSET 4 - Filter Grayscale

I've managed to make Filter Grayscale work. It wasn't too complicated, I was just missing to cast each color to float as such; void grayscale(int height, int width, RGBTRIPLE image[height][width]) { ...
0
votes
1answer
16 views

PSET4 Filter less BLUR

I want to check if the array exists for the edges so I've been trying to check if the block is NULL. if (image[i-1][j-1] != NULL); { redAverage+=image[i-1][j-1].rgbtRed; ...
1
vote
1answer
34 views

PSET4 — Filter (more) — Edges Error

I'm currently working through the filter problem, and I'm not sure why it's not working on the pixels on the edge (it also seems to only be incorrect on the B value in RGB). This is the message I'm ...
0
votes
1answer
42 views

Help with recover.c! I tried to use recursion

The lines which attempt to stop the recursion using EOF don't seem to work. Can anyone help me see why? #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string....
0
votes
1answer
25 views

Recover - PSet 4

I am for some reason unable to generate any jpgs with my code; I think there's a mistake in the logic somewhere? Would be very grateful for some hints! Thank you! #include <stdio.h> #include <...
0
votes
1answer
32 views

pset4 Blur calculation does not work properly

for some reason I can't get my calculation for the blur value running. The pictures are really odd and contain crazy colors. Any ideas to why this could be the case? I compared it already to working ...
0
votes
1answer
16 views

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

I'd really appreciate any help that can be offered here. My code seems to output a blurred image perfectly, but fails every check50 check and I can't work out why... void blur(int height, int width, ...
0
votes
1answer
45 views

pset4 - Recover passed check50, but want to understand the logic on fwrite or file-pointer

Below are my code for pset4 - Recover, it passed the check50, but I am trying to understand the logic on a particular process of fwrite or file-pointer. In short, my question is how does line 74 know ...
0
votes
1answer
20 views

Pset 4 - Filter - Edge detection

My function kind of works but the result is too white. I saw some people having the same issue because they didn't store the new pixels in a temporary image, but I already did that. void edges(int ...
0
votes
1answer
19 views

PSET 4 - Recover produces an infinite loop

I have been working through this problem and cannot figure out why this while loop is producing an infinite loop and no image files, which is probably caused by a logic error on my part. As far as I ...
0
votes
0answers
25 views

pset4 - filter - less - blur doesn't work

// Blur image void blur(int height, int width, RGBTRIPLE image[height][width]) { //Temp array RGBTRIPLE temp[height][width]; for (int i = 0; i < height; i++) { for (int j = ...
0
votes
1answer
36 views

PS4 Recover Segmentation Fault (Core Dumped)

Hope you got into the new year well and healthy! I get a segmentation fault (core dumped) if I want to run ./recover card.raw Anyone got any tips because I have checked it 100 times already. Valgrind ...
0
votes
1answer
31 views

Pset4 Reflection Less Comfortable - Check50 Errors

Hello CS50 community, my question is about the reflection filter (less comfortable): I have compiled a code that is reflecting (YEAH!) but there seems to be the following errors when checking: *:) ...
0
votes
1answer
14 views

PSET4 - Recover - program timing out and not passing the check

could you please help me to understand why my program is not passing the check - the error says "timed out while program is trying to exit". It's compiling well, but seems to not even create ...
1
vote
1answer
25 views

CS50 Pset4 Sepia

I have been working on PSET4 and understood the code and the tasks fine. But my compilation does not change the image and I cannot figure out why it will not work for the life of me. I have checked ...
0
votes
1answer
21 views

PSET4 - Recover - Segmentation fault, not sure what's wrong

Can't understand what's wrong in my code: it's compiling but not creating jpgs, the check says "failed to execute program due to segmentation fault". Please help to understand - THANKS IN ...
0
votes
1answer
27 views

Regarding PSET4: Recover is compiled but only 26 files are recovered but unable to open images

#include <stdio.h> //call for sprintf() #include <stdint.h> //call for typedef uint8_t BYTE #include <stdlib.h> //call for sizeof() and NULL typedef uint8_t BYTE; //...
0
votes
1answer
21 views

PSet 4 Filter(less) Sepia - Why is my output image slightly red tinted?

At first, I forgot to cap the RGB values at 255 for sepia, and it resulted in white pixels being blue. But other areas were fine(proper sepia). So additionally, I added the ternary operators to check ...
0
votes
1answer
26 views

pset4 recover.c last image does not match

I've doing recover.c from pset4. When I ran check50, all images except for the last one. I guess it's probably the problem of feof function. But I don't know how to edit my code to make it works //...
0
votes
0answers
15 views

PSET 4 - Blur - IF Statement

I can't seem to understand why the if-statement doesn't work to filter out the cells outside of the image's rows/columns. see the full code below, I left out the part where I copy it back into the ...
0
votes
1answer
22 views

pset4 recover creates 50 images but bytes don't match up

My code creates the 50 files, all of them starting with the correct JPEG signature, however the rest of the bytes don't match up. In other words, first 4 bytes are correct, the following bytes are ...
0
votes
0answers
11 views

I keep getting the error: linker command failed with exit code 1 (use -v to see invocation) when I'm compiling my code for filter: blur in ide

I seem to get this error over and over again when i compile my code for filter: blur by typing "make helpers". I don't know if it's because of my code. This error did not appear when I ...

1
2 3 4 5
35