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

Pset4 (Filter-Less) Reflection: Not getting correct values on Check50

Image seems to be reflected correctly but the program doesn't pass check50. Code: void swap(RGBTRIPLE *a, RGBTRIPLE *b); void reflect(int height, int width, RGBTRIPLE image[height][width]) { for (...
user avatar
0 votes
1 answer
8 views

Pset4 (Filter-Less) Greyscale not passing check50

I tried implementing the GreyScale function but I didn't got the average values of the pixels correctly. I don't know what I'm doing wrong. Any hints will be appreciated. My code: void grayscale(int ...
user avatar
0 votes
1 answer
33 views

Filter (more) blur function fails check50

I've hit a bit of a brick wall writing a blur function for filter (more). This is my second go at refactoring the code, and although it produces a blurred image without any issues (no weird edges, ...
user avatar
  • 103
0 votes
1 answer
12 views

CS50x PSET4 (Filter) - BLUR

This code is supposed to blur an image together with other supporting files as per CS50 Pset4. I am able to compile my code with no errors and run the program but it does not seem to blur my image ...
user avatar
0 votes
0 answers
6 views

CS50 Blur Question. I have no idea why my get blur in the middle function does not work?

// Blur image void blur(int height, int width, RGBTRIPLE image[height][width]) { //Create a copy of image RGBTRIPLE copy [height][width]; int i, j; int redAverage, blueAverage, greenAverage; for (i = ...
user avatar
0 votes
0 answers
16 views

CS50P PSET4: Little Professor timed out

I'm solving this problem. My code works when I test it but it is failing check50 with the error :( Little Professor accepts valid level // timed out while waiting for program to exit Here is my code: ...
user avatar
  • 1
0 votes
1 answer
27 views

PSET4 - Recover - set output file pointer to NULL

case 1: FILE *file_out = NULL; case 2: FILE *file_out; "file_out" is a newly defined file pointer to where the recovered JPEG blocks will be written to. I tried both case 1 and case 2 and ...
user avatar
0 votes
0 answers
9 views

pset 4 filter edges help

pset 4 filter-more edges code. I'm confused where it is going wrong. Anybody can figure out please tell me. here is my code. // Detect edges void edges(int height, int width, RGBTRIPLE image[height][...
user avatar
0 votes
0 answers
20 views

PSET4 2021 Filter Reflect: Images visually flipped correctly but check50 still says the code is wrong

2021 PSET 4 https://cs50.harvard.edu/x/2021/psets/4/filter/less/ Outputted Image clearly is reversed and flipped but I still don't know why check50 doesn't recognize it!!! I'm already torned out by ...
user avatar
0 votes
1 answer
9 views

My Red and Blue values are wrong but all my green values are correct. It's pretty simple what i've done. What am I missing ? Please help

void blur(int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE tmpimage[height][width]; for (int i = 0; i < height ; i++) { for (int j = 0; j < width; j++) ...
user avatar
0 votes
0 answers
22 views

Why do we not need to read RGBTRIPLE in PSET4 Filter (Less Comfortable)?

For BITMAPFILEHEADER and BITMAPINFOHEADER, the code uses the function "fread()" as seen below. fread(&bf, sizeof(BITMAPFILEHEADER), 1, inptr); However, for RGBTRIPLE, the solution for ...
user avatar
0 votes
1 answer
13 views

Any idea why i am getting this error in pset4

#include "helpers.h" #include <math.h> // Convert image to grayscale void grayscale(int height, int width, RGBTRIPLE image[height][width]) { // comb trw each row for (int i = 0;...
user avatar
0 votes
1 answer
21 views

pset4 recover error segmentation fault

Can i please get some help with my recover code? i have rewritten it so many times but i still get a segmentation fault i even unmalloc'd a few things but to no avail // recovers deleted images #...
user avatar
  • 5
0 votes
0 answers
18 views

PSET 4 Blur - How to construct logical flow to average values without many IF statements?

I'm working on the Filter-more Blur problem, and I'm having trouble translating my ideas from paper to code. My first thought was to have many IF statements that would take care of the specific cases (...
user avatar
0 votes
1 answer
32 views

Pset4 (cs50) fails check50 (segmentation fault)

Here's my code : #include <stdio.h> #include <stdlib.h> #include <stdint.h> typedef uint8_t BYTE; int main(int argc, char *argv[]) { if (argc != 2) { printf("./...
user avatar
0 votes
1 answer
47 views

pset4 recover: segmentation fault when closing file

I have been stuck with this segmentation fault for quite a while now. After running valgrind I was able to determine that it happens when I close the output file at the end of the code, but I have no ...
user avatar
  • 1
1 vote
1 answer
26 views

Pset4 Blur filter (more comfortable) assign new struct to image does not work

I was trying to use the following code to complete the blur function. Everything seems fine but I just couldn't update the RGBTRIPLE variable image directly with another RGBTRIPLE variable I crreated. ...
user avatar
0 votes
1 answer
33 views

Pset4 Filter (Less) - Invalid operands to binary expression (Int and RGBTRIPLE)

Hello. I'm facing a problem trying to compile this code. I got the error msg Invalid operands to binary expression ('int' and 'RGBTRIPLE') void blur (int height, int width, RGBTRIPLE image[height][...
user avatar
1 vote
1 answer
47 views

Questions regarding pset4 Blur filter (less comfortable)

After tinkering for a while with why my filter didn't work, I finally succeded with the following code: // Blur image void blur(int height, int width, RGBTRIPLE image[height][width]) { //make copy ...
user avatar
0 votes
0 answers
23 views

Pset5 speller : whats wrong with "unload" in my program? everything are right except this

the problem is: **program is free of memory errors. valgrind tests failed; see log for more information. 112 bytes in 2 blocks are still reachable in loss record 1 of 1: (file: dictionary.c, line: 6**...
user avatar
0 votes
1 answer
27 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 ...
user avatar
0 votes
1 answer
13 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++) ...
user avatar
0 votes
0 answers
27 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 ...
user avatar
0 votes
0 answers
51 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 &...
user avatar
0 votes
0 answers
18 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 ...
user avatar
  • 5
0 votes
0 answers
45 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 ...
user avatar
0 votes
1 answer
53 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 ...
user avatar
0 votes
1 answer
34 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"...
user avatar
0 votes
0 answers
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? // ...
user avatar
0 votes
1 answer
46 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 ...
user avatar
0 votes
1 answer
31 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-...
user avatar
0 votes
1 answer
109 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, ...
user avatar
0 votes
1 answer
641 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 ...
user avatar
0 votes
1 answer
62 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 ...
user avatar
0 votes
0 answers
16 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 ...
user avatar
0 votes
2 answers
37 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' ...
user avatar
0 votes
1 answer
45 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 ...
user avatar
0 votes
1 answer
40 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 ...
user avatar
  • 7
0 votes
1 answer
15 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 ...
user avatar
0 votes
1 answer
24 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 ...
user avatar
0 votes
0 answers
26 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 "...
user avatar
0 votes
0 answers
78 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 ...
user avatar
0 votes
1 answer
63 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) ...
user avatar
0 votes
1 answer
69 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&...
user avatar
  • 3
0 votes
1 answer
25 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 ...
user avatar
0 votes
1 answer
17 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 = ...
user avatar
0 votes
1 answer
24 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[])...
user avatar
0 votes
1 answer
119 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 ...
user avatar
0 votes
0 answers
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 ...
user avatar
0 votes
1 answer
47 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;...
user avatar

1
2 3 4 5
36