ngnnah / CS50-pset4-Filter

4 Image filters, in C (C is challenging and kinda fun ;))

Home Page:https://cs50.harvard.edu/x/2021/psets/4/filter/less/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CS50-pset4-Filter

My immplentation of image filters can be found in helpers.c file. They include:

  • grayscale FLAG -g
  • sepia FLAG -s
  • reflect (horizontal mirror) FLAG -r
  • blur (box blur) FLAG -b

To run the program, first compile it:

$ make filter

Then input input and output image files, with one of the 4 filters e.g.:

$ ./filter -g images/yard.bmp out.bmp

$ ./filter -s images/yard.bmp out.bmp

$ ./filter -r images/yard.bmp out.bmp

$ ./filter -b images/yard.bmp out.bmp

Some of my own notes, while watching Week4 lecture video

In C: A string has same address as address of its first char (since we already know its ending @ \0 or bx0000-0000 or 0x00 or null)image

NOTE: string comparison: s1 == s2 (actually comparing address pointer. This is the same as &s1 == &s2)image

In C, we can allocate memory, with malloc (from <stdlib.h>). Dont forget: NULL checking, and free (return memory space) after use.image

MEMORY SPACE: • malloc: allocate space in heap functions: work with space in stackimage

  • Origin of "StackOverflow": we attempt calling functions so many time (in recursion), that it overflows into the heap. Buffer overflow: overflow allocated array, or allocated memory (from using malloc) e.g. buffer in Netflix/Zoom/Youtube (videos)image

About

4 Image filters, in C (C is challenging and kinda fun ;))

https://cs50.harvard.edu/x/2021/psets/4/filter/less/


Languages

Language:C 98.0%Language:Makefile 2.0%