Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manipulate an image at pixel level in C?

How do I read an image in C so that I can have direct control over its pixels (like we do in MATLAB)?

I tried the old way:

FILE *fp;
fp = fopen("C:\\a.tif","r");

that just gives me the ascii form of the image file (I think).

How can I get pixel level control over the image and do some basic operations like say, inverting the image?

like image 709
Moeb Avatar asked Oct 20 '09 11:10

Moeb


People also ask

What is pixel manipulation?

The user can manipulate pixels, the basic unit of programmable color on a computer display or in a computer image. The user can erase, create, copy, and move pixels on a screen to show something different than it was originally was (erasing the pixels of a burglar on a video so he wont get caught)

What technique is used to manipulate an image?

Other examples of photo manipulation include retouching photographs using ink or paint, airbrushing, double exposure, piecing photos or negatives together in the darkroom, scratching instant films, or through the use of software-based manipulation tools applied to digital images.

How do you represent an image in pixels?

Digital images are made up of pixels . Each pixel in an image is made up of binary numbers. If we say that 1 is black (or on) and 0 is white (or off), then a simple black and white picture can be created using binary. To create the picture, a grid can be set out and the squares coloured (1 – black and 0 – white).

How pixel is playing a role in image processing?

A pixel is the smallest unit of a digital image or graphic that can be displayed and represented on a digital display device. A pixel is the basic logical unit in digital graphics. Pixels are combined to form a complete image, video, text, or any visible thing on a computer display.


1 Answers

OpenCV is computer vision library, but can be used for "low level" tasks too. It supports BMP, DIB, JPEG, JPG, JPE, PNG, PBM, PGM, PPM, SR, RAS, TIFF, TIF.

like image 193
Harriv Avatar answered Sep 18 '22 06:09

Harriv