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

Recover: Encountering many problems

My code compiles fine, but no jpg files are created. It seems like the condition that checks for the start of a jpg is never true, so the body of that if condition never executes. I'm also having ...
0
votes
1answer
9 views

CS50 Pset 4 Reflect with Bubble Sort

I tried using bubble sort for Reflect, it goes something like this pretend I defined temp here for (int i = 0; i = height; i++) for (int j = 0; j = width - 1; j++) for (int k = 0; k = width - 1; k++) ...
0
votes
0answers
14 views

pset4 filter edges too white

I've read through other posts that had a similar result: the output image being too white; however, the solutions to those have not fixed my code. Also, there's a strange dark vertical line running ...
0
votes
0answers
22 views

Pset4 Blur and Edge check50 problem with 3 x 3 image and 4 x 4 image

For both edge and blur check50 is saying: :( blur correctly filters 3x3 image expected "70 85 95\n80 9...", not "70 85 95\n80 9..." :( blur correctly filters 4x4 image expected &...
0
votes
0answers
13 views

PSET-4 Recover. Getting a segmentation fault even though the program compiles correctly [duplicate]

Here is my code #include <stdio.h> #include <stdlib.h> #include <string.h> #include <cs50.h> #include <stdint.h> //defining new type typedef uint8_t BYTE; //defining ...
0
votes
0answers
30 views

pset4 blur function not working properly with tests

Here's my solution for the blur function on the less hard pset4 exercise filter. When I test the function it seems to work fine, and it outputs blurred images, but some tests do not pass. I think I ...
0
votes
1answer
30 views

Code compiles but files are not read. Recover pset4

Trying to find the problem i could track it to the else statement where ""printf("Could not open file because NULL.\n");"" is located. The files are not read at all or ...
0
votes
1answer
16 views

Why the pixels are not rendering correctly in recover problem?

I am working on recover problem and suffice to say I am just a beginner. Here is my code: #include <stdio.h> #include <stdlib.h> #include "stdint.h" #include "stdbool.h"...
0
votes
0answers
7 views

pset4 (more comfortable) blur

coded only for the middle pixels first but result was a complete mess! how do i retain the pixels information after its use for other pixels i think that is the most prominent problem with my code? // ...
0
votes
1answer
35 views

Pset4 recover 000.jpg 001.jpg 049.jpg are not found

PLEASE I am dying: I am searching for hours for the problem, but I can't find it. It compiles. At least 000. and 001. should be found but I get these results and I am full of remorse. Where could be ...
0
votes
1answer
23 views

filter less: Reflection : image is reflected correctly but does not pass check50

void reflect (int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE invert[height][width]; for (int i=0; i<height; i++) { for (int j=width,s=0; j>=0; j-...
0
votes
1answer
55 views

lab 4 is not passing check50, but the volume is changing by the factor when we listen to the audio

// Modifies the volume of an audio file #include <stdint.h> #include <stdio.h> #include <stdlib.h> // Number of bytes in .wav header const int HEADER_SIZE = 44; int main(int argc, ...
0
votes
1answer
98 views

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

I've been working on CS50 PSET4 Filter (Less) and finally got a working blur function (or so I thought!) // Blur image void blur(int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE ...
0
votes
1answer
45 views

Recovering problem

While debugging, the compiler doesn't enter the condition (although it should be entered at the first iteration), also I get segmentation fault in the fwrite line after the conidion I 'm including ...
0
votes
0answers
14 views

Pset4 Blur. Only the most right column and botton row of pixel is wrong

I'm ultra stock right now. I know its probably something stupid but i can't figure out why only the value of the bottom row and right column are not working as intended. I've been staring at this code ...
0
votes
2answers
34 views

Blur problem (Less)

I can't catch the error in my code, I think that I 'm using the right Algorithm and approach. // creating a copy to apply blur on it RGBTRIPLE copy[height][width]; // initializing avaerages' ...
0
votes
1answer
36 views

pset4 recover doesn't recognize jpegs

I've been working on Recover for quite many hours now and I can't really understand what is wrong. Here I share my commented code. What I can tell you about its behavior is the following: It does not ...
0
votes
1answer
35 views

Im busy with problem set 4(recover) and the image says Invalid or unsupported format. The sizes of the images look legit

I am not sure why my images are unsupported. Everything looks as if it works until you try to open the images. Even the image sizes look correct.(meaning they aren't 0bytes or all the same size or 512 ...
0
votes
1answer
14 views

pset4 CS50 IDE broken when opened card.raw

While I was working on pset4/recover I couldn't make it work as desired, so I wanted to check the first few bytes of card.raw manually. I double-clicked the file and now my cs50 IDE never loads and ...
0
votes
0answers
17 views

pset4 blur filter invalid or unsupported image format

In pset4 Filter problem when I write blur function I get Invalid or Unsopported Image Format Error. The program compiles without errors and in check50 it also works fine. This is my code. I would ...
0
votes
0answers
20 views

CS50 Problem Set 4 filter less blur: please help debugging

//:( blur correctly filters 3x3 image expected "70 85 95\n80 9...", not "70 85 95\n80 9..." //:( blur correctly filters 4x4 image expected "70 85 95\n80 9...", not "...
0
votes
0answers
54 views

Academic honesty

Question about the Academic Honesty after working on recover problem for more than 10 hours and watching the lecture , shorts , and walking through several times , and still facing lots of errors and ...
0
votes
1answer
47 views

pset 4 recover, I can compile but no JPEGs returned

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

CS50 PSET4 recover Segmentation Fault

Can someone point out why this code is resulting in segmentation fault? It's a code for the 'recover' question in pset4, cs50. #include <stdio.h> #include <stdlib.h> #include <stdint.h&...
0
votes
1answer
22 views

PSET4 LESS BLUR function -Ending Edges problem 2nd version

New version of my previous problem here PSET4 LESS BLUR function -Ending Edges problem I know the problem is with the imitations but can't figure out what is it My code works fine but for the ending ...
0
votes
1answer
16 views

PSET4 LESS BLUR function -Ending Edges problem

My code works fine but for the ending edges not. I mean the right & bottom edges values. Here is my code : void blur(int height, int width, RGBTRIPLE image[height][width]) { // h = 400 w = ...
0
votes
1answer
20 views

PSET4/Recover -- Why am I getting "double free or corruption (top)"?

#include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int counter = 0; char filename[8]; FILE *img; BYTE buffer[512]; int main(int argc, char *argv[])...
0
votes
1answer
57 views

Pset4 filter reflect segmentation fault

I'm currently trying out cs50's pset4 filter (less comfortable). The program compiles but when run, it outputs segmentation fault. When using check50, it showed that my reflect code passed three of ...
0
votes
0answers
67 views

My Filter program is not blurring the image correctly. And it is not able to open the input file. It shows it as NULL

Here is my code: #include"helpers.h" #include<math.h> #include<stdio.h> #include<stdlib.h> // Convert image to grayscale void grayscale(int height, int width, RGBTRIPLE ...
0
votes
1answer
36 views

Pset4 recover produces only 2 corrupted iamges

I am at Pset4 recover pset. When I run my code, it produces only 2 corrupted images here is my code : #include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE;...
0
votes
1answer
41 views

PSET4 Recover error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *

I am at PSet4-recover. I can't compile code properly. Always get these errors : recover.c:47:31: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *' [-...
0
votes
1answer
65 views

CS50 blur filter failed 3x3 and 4x4

I created a for loop checking each pixel around the one to be blurred. If the pixel was in range, its RGB values would be added to a total variable to then be averaged. My program works for all ...
0
votes
1answer
21 views

Debug50 won't even open and I don't know what step to take next in lab4 Recover

Because I can't get debug50 to help me out, I don't know where to start to debug this program. I think I have an infinite loop somewhere, but I'm not sure. Any help to get me started on right path ...
0
votes
0answers
26 views

pset4 filter, reverse: Made it work but cant quite understand how

So I created the function reverse and it works, it flips the image. To get to this point I had to try and repeat several times. While my logic says that: First I should use a temp variable to store ...
0
votes
1answer
30 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
36 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
31 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
38 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
54 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
45 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
40 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
22 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
16 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
34 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
18 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
27 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
21 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
47 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 ...
1
vote
1answer
44 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
26 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
2 3 4 5
35