Skip to content

C program for basic PGM image operations: read, logarithm transformation, contrast stretching, region filling, and save.

Notifications You must be signed in to change notification settings

MatheusPaivaa/Image_processing_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Digital Image Processing 👁️‍🗨️🖥️

FeaturesGetting startedInput FormatOutput FormatExamplesAknowledgements

This repository contains a C program designed for performing basic image operations on PGM (Portable Gray Map) images. The program enables reading PGM image files, applying operations such as logarithm transformation, contrast stretching, region filling (similar to the "paint bucket" tool in Paint applications), and saving the resulting image to a new file.

Features

The program includes functionalities for point operations (logarithm, contrast stretching, etc.) and digital filters (mean filter, median filter, Gaussian smoothing). It also provides a prototype histogram generation feature. Additionally, there are functions for reading and saving PGM images, and handling image memory allocation and deallocation.

Full explanation of each operation can be found here: https://homepages.inf.ed.ac.uk/rbf/HIPR2/wksheets.htm

Getting started

  • Clone the repository to your local machine
1. git clone https://github.com/MatheusPaivaa/image-processing-project
2. cd imageGenerator
  • Compile the program using a C compiler (e.g., GCC).
3. gcc -std=c99 .\image_generator.c -o imgGen 
  • Run the compiled executable.
4. .\imgGen.exe
  • Provide the name of a PGM image file.
5. PGM image file: exampleImage.pgm
  • Choose the desired operation or filter.
  • The resulting image will be saved as "imagemGerada.pgm".

Note: The code's comments provide detailed explanations of functions, operations, and logic.

Input Format

  • Provide the name of the PGM image file (e.g., image.pgm) when prompted.
  • Choose an operation category and select a specific operation.
  • For certain operations (e.g., thresholding), additional input may be required (e.g., threshold value).

Note: The program is compatible with PGM images, catering to both ASCII (P2) and binary (P5) formats. It effortlessly identifies the format and reads the image accordingly.

Output Format

  • Processed images are saved as PGM files, named "imagemGerada.pgm".
  • The modified image will be generated in the P2 (ASCII) format, regardless of the input format.
  • For histogram operation, the histogram values are printed, and a basic graphical representation of the histogram is displayed.

Examples

Logarithm operator

fusca1 fuscamod1

Contrast Stretching

normal cs

Floodfill

folha folha_final

Image Negative

normal negativo

Aknowledgements

Please note that this program is designed for educational purposes and demonstrates image processing techniques in C. This is an extended version of the final project from the discipline Introduction do Computer Science (SCC-221) at the Institute of Mathematics and Computer Science (University of São Paulo).

License

This project could be used by anyone! MIT License.

About

C program for basic PGM image operations: read, logarithm transformation, contrast stretching, region filling, and save.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages