319 views
0 votes
0 votes
Can we take image as an input in linked list using c programming?

If 'yes' then how to implement that?

2 Answers

0 votes
0 votes

Ofcourse you can do it by considering the file format as sequnce of bits/bytes and store the same in an array.

C does not have the high-level routines to read an image file - you have to read the file format and process it yourself.

Reading the file is easy:

FILE *input;
char get_char;
input = fopen("myimage.bmp", "rb");
while((get_char=fgetc(input))!= EOF)
   {
   ...
   }
fclose(input);

Reads a file a byte at a time.

For  more information refer the link given below.

https://stackoverflow.com/questions/10531884/write-a-jpg-image-file-in-c

0 votes
0 votes

To open Images in c in a viewable format, you can try OpenCV libraries. They are generally used for Image Processing and can input and output images (and videos) as well.

OpenCV as a data type called Mat which is, of course, a matrix representation of the image. so once you get the images. you can easily push them in the list. 

you can look for the documentation here. 

http://docs.opencv.org/2.4/doc/tutorials/introduction/display_image/display_image.html

Related questions

0 votes
0 votes
1 answer
1
Arnab Bhadra asked Jun 28, 2017
3,312 views
Insertion of a node into a doubly linked list requires how many changes to various Next and Previous Pointer?A. No ChangeB. 1 Next , 1 PreviousC. 2 Next , 2 PreviousD. 3 ...