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
12 views

Getting an “Invalid or Unsupported Image Format” while trying to open images (Recover, Pset4)

I'm currently trying out CS50's Recover (PSET4). The program compiles and I manage to get back all the 50 jpgs. But I can't open them because the image isn't correctly returned and I get an "...
0
votes
0answers
14 views

CS50/pset4/recover doesnt recover img 49

Hei All, I am running my version of recover and check50 validates every check apart from the last one This is my code. I really cant figure out what's wrong. #include <stdio.h> #include <...
0
votes
1answer
14 views

(PSET 4 - Recover) Why is first recovered image blank?

I am on problem set 4 recover and I have nearly completed it. I have written my code and it compiles but when I run it on the card.raw file it appears to recover all the 50 photos except the 1st one ...
0
votes
1answer
20 views

My Program is not recovering the jpegs correctly

My program is compiling properly it is even recovering the images but when I am opening the image to view, it is not opening. It is showing "Invalid or Unsupported file format". Please look ...
0
votes
1answer
13 views

pset4 filter blur less got stuck

i have been working on blur and it works just fine as i run it. but when i run check50 i get this : :( blur correctly filters middle pixel expected "127 140 149\n", not "145 160 169\n&...
0
votes
1answer
21 views

pset4 recover fread segmentation fault

guys I want to ask why am I constantly getting segfault with second fread inside of a while loop after checking jpeg header. first fread works perfectly going through first several 512bytes of card....
0
votes
0answers
6 views

Getting a segmentation fault on cs50's filter

I'm currently stuck on cs50's pset4 filter (less comfortable). The program compiles perfectly. I have tried out the first three parts of the code (grayscale, sepia & reflection) and their output ...
0
votes
1answer
13 views

The sepia code passes 2 first tests but doesn't pass the rest of those tests. What am I doing wrong?

This is the code I have written but it fails to produce the intended result. I am really not able to figure out why it's wrong. Can somebody help me? [snip] if (image[i][j].rgbtRed > 255) { ...
0
votes
1answer
7 views

Pset4 (Less). Filter sepia. In the output image, the white parts are magenta

For some reason, the image attached below is the output I get with Sepia filter. I don't know where the code is wrong. void sepia(int height, int width, RGBTRIPLE image[height][width]) { int k = 0;...
0
votes
1answer
20 views

Need clarity for Problem Set4 recover

I am working on set4 recover My program is always printing "Testing EOF", hence it looks card file is empty. Here is my code in detail. #include <stdio.h> #include <stdlib.h> #...
0
votes
1answer
9 views

Pset 4 filter less comfortable, cant open the output BMP file

So I just made the greyscale function and it passes check50 but when I try to open or download the output.bmp file, it doesn't show anything. Anyone know how to fix this? This was the command I put in ...
0
votes
1answer
16 views

Pset 4 Recover output shows Segmentation Fault

#include <stdlib.h> #include <stdint.h> //to use uint8_t as BYTE typedef uint8_t BYTE; int main(int argc, char *argv[]) { if (argc != 2) { printf("INVALID. There ...
0
votes
1answer
18 views

Filter - Structures & Headers

The problem statement states that BMP files have a particular header with: (1) BITMAPFILEHEADER 14 bytes long and (2) BITMAPINFOHEADER 40 bytes long. bmp.h (provided) includes the definitions of the ...
0
votes
2answers
40 views

CS50 Recover - fread into buffer

I am working on CS50 Recovery and I am unable to get the program to check the JPEG starting header. I used debug50 and added a couple print statements to try and find the problem. Every time I run the ...
0
votes
1answer
19 views

CS50 - PSET 4 - Filter - Edges

//Pixel buffer RGBTRIPLE pixelBuffer[height][width]; //Iterates on every pixel and calculates Gx and Gy for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++)...
0
votes
1answer
11 views

cs50 Pset4 filter(more) blur

void add(RGBTRIPLE* a, RGBTRIPLE* b){ a->rgbtRed += b->rgbtRed; a->rgbtGreen += b->rgbtGreen; a->rgbtBlue += b->rgbtBlue; } // Blur image void blur(int height, int width,...
1
vote
1answer
11 views

pset4 filter greyscale error

When I run "make helper," the following error comes up: "undefined reference to `main'" and "linker command failed with exit code 1" What am I doing wrong?? thank you in ...
0
votes
1answer
38 views

PSET4 Recover, output files are blank

Honestly, I have been struggling with Week 4, and I have been trying to complete this pset to the best of of my current understanding. I have researched multiple articles on this topic, but I have yet ...
0
votes
1answer
21 views

Pset4/recover: Why does it not works? Image names are correct. But it doesn't match. Please help?

:) recover.c exists. :) recover.c compiles. :) handles lack of forensic image :( recovers 000.jpg correctly recovered image does not match :( recovers middle images correctly recovered image ...
0
votes
1answer
28 views

CS50 Recover recovering corrupted images, and only 43 images

I'm attempting to solve the Recover problem, and I'm using a for loop to go through the bytes of the raw file. It spits out 43 images, some of which have the full image, but most are corrupted, and ...
0
votes
0answers
26 views

Filter (more) Edge error not passing check50

Yesterday I copleted filter less and all images passes check50, today I try to complete filter more edge I've added the same code like like filter less for Grayscale, Reflection, Blur and added new ...
0
votes
1answer
11 views

Pset4 - Memory/reflection problem

So I've been on this reflection in pset4's memory problem for well over an hour and I can't seem to get the first column of height to reflect. Only the first column too, everything else reflects. here'...
0
votes
1answer
33 views

pset4 filter. Blur image compiles goed but does'nt pass the check50 lots of error

The code in helpers.c all images compiles exept for the Blur image it compiles without any errors. But doesn't pass the cs50 check? any suggestions only the Blur image section. Thanks // Blur ...
0
votes
2answers
24 views

pset4 filter Could not open infile.bmp

I compiled the grayscale image in helpers.c with make filter without any errors correctly and check50 also correctly and passes all creterea But when I enter [ ./filter -g infile.bmp outfile.bmp ] it ...
0
votes
0answers
14 views

Pset4 able to compile but unable to recover images

My code compiled successfully and it passed check50,but when I implemented it, nothing occurred and no jpg file is created. Can anyone help me figure out what happened? [EDIT: Code removed for Harvard ...
0
votes
0answers
11 views

Cant figure out what is wrong with pset 4 more edges. check50 returns the following :-

:) edges correctly filters middle pixel :) edges correctly filters pixel on edge :) edges correctly filters pixel in corner :( edges correctly filters 3x3 image expected "76 117 255\n21...&...
0
votes
0answers
31 views

Pset4 - Filter - Blur- some pixels have RGB 0 0 0

I've been struggling with the filter portion of problem set 4 for quite a while. In particular, I've had a particularly persistent bug. As you can see from the Check50 screenshot below, some RGB ...
0
votes
1answer
29 views

PSET4 Blur not passing Check50

My code seems to work (when visually inspecting output files), but Check50 does not pass it. I'm struggling to understand what is causing this issue despite having repeatedly read over the code and ...
0
votes
1answer
29 views

Segmentation Fault in CS50 Recover - pset4

I would appreciate some guidance on the below issue. I have seen the other threads with the same issue but haven't had any luck applying those fixes. I am getting the below error in my code and I can'...
0
votes
1answer
31 views

Wrote a simple recover.c program to extract the first image from card.raw but the image is corrupted?

that is the code I wrote can anyone tell what is wrong with my code!! FILE *file = fopen(argv[1], "rb"); FILE *outptr = fopen("000.jpg", "wb"); typedef uint8_t BYTE; ...
0
votes
1answer
46 views

Problem with Recover (Pset4)

everyone. I've been struggling with the Recover problem of Pset4. I really don't understand why I'm getting the following error message when applying the Check50 control: *Results for cs50/problems/...
1
vote
1answer
32 views

Recover - segmentation fault and other general problems

Hey guys so I've hit a bit of a wall with Recover, when I run my program I get segmentation fault but I also don't know how to end off one jpeg when another header pops up? In essence, I'm not sure ...
0
votes
1answer
26 views

Collatz Function Iteration

Guys help here I'm so lost as how to answer this question, I'm infact clueless...Find the two smallest different input numbers x,y (with 0<x<y), for which the COLLATZ algorithm takes equally ...
0
votes
1answer
24 views

PSET4 Recover fread/fwrite

PSET 4 is really taking me for a wild ride that I am not enjoying whatsoever. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> int num = 0; ...
1
vote
2answers
42 views

Cleaning up PSET4 Blur

I have successfully finished the blur effect on PSET4. Here is a small smattering of the code if(i - 1 >= 0 && j - 1 >= 0) { red += OgImage[i-1][j-1]....
0
votes
1answer
24 views

PSET 4 reflection

Been stuck on reflect for a couple of hours now and can't seem to figure it out. I've written the following code. I take the values, find what the opposite should be, put both sets into variables and ...
0
votes
1answer
20 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
15 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
22 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
13 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
14 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
12 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
22 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
25 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
30 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
27 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
12 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
20 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
33 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 ...

1
2 3 4 5
35