Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ImageProcessing
hi all,
Before I start writing my question I want to make it clear that this is my first post and I am really newbie in programming. I just learned C (i.e string manipulation, array n all). I use very old version of turbo C compiler ( blue screen:P now I know its antique these dayz) (coz my friend told me that its easy to use and with C you can do anything which other compiler can do). I have to admit it was really easy to understand.
 
Now I want to make a program which takes image as an input n also give image as an input with some editing like zoom in/out. I dont know where to start.
 
So my question is: Is it possible with C n this compiler to input image and store its pixel in array coz all libraries ( like magick++, opencv, CImg) I tried gives error during compilation, so I think they r not compatible with this compiler.
 
After some more google search I came around this code:
FILE *fp;
unsigned char *bufferImmagine;
bufferImmagine=new unsigned char [dimX*dimY*3];
fp=fopen(argv[1],"r");
fread (bufferImmagine,dimX*dimY*3,1,fp);
 
but I can't understand anything in it. So please help here also.
 
and my last question is:
I want to learn graphic handling and c++ now. So please suggest me a good way and a good compiler. whether I stick with this turbo c++, or use new version of borland or VC++??
n also tell me what is the difference between these compilers??
 
thanks n regard
Posted 19-Sep-11 22:59pm
Edited 20-Sep-11 0:11am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You are approaching this problem from the wrong starting point. You say that you do not understand the code snippet posted above, which is a fairly simple piece of C code. You would be better spending some time learning the basics of file handling and Windows programming before moving on to graphics. As to which compiler to use I would suggest Microsoft's C++ compiler which you can get free here[^].
  Permalink  
Comments
deepak212 at 20-Sep-11 5:50am
   
thanks richard...
but what i didnt understand in that code is:
it is allocation (dimx*dimy*3) bytes of space to bufferimmagine....
then i m opening image in that...
but to do that i should know dimension of image first....
if i want to input images of different sizes then how can i do that???
Richard MacCutchan at 20-Sep-11 5:58am
   
You cannot do it this way. Images are not simple files of X x Y bytes. They have specific control information around them to show how the raw bytes are transformed into colours on the screen, and each file type has a different format. Try searching Google for BMP, JPEG, GIF, etc. to get some more information.
As I said above you really need to have a good understanding of file handling before you can approach this more advanced subject.
deepak212 at 21-Sep-11 16:31pm
   
ok thanks richard...
i think so better way for me is to write code in vs.
deepak212 at 21-Sep-11 16:31pm
   
and use some libraries.
Richard MacCutchan at 22-Sep-11 3:19am
   
Here are two article links on CodeProject that you should find useful:
Bitmap Basics and Loading JPEG and PNG images.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

you can not directly include the image in the c++.
and the last ans of your question is that you use the turbo c++ for the graphic and for leaning the graphic you can prefer the book graphic in c.
  Permalink  
Comments
deepak212 at 20-Sep-11 5:02am
   
thanks for your reply.... but my question is then how can I input image in C or C++. and store its pixel values in 2Darray for manipulation?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 499
1 Maciej Los 325
2 Sergey Alexandrovich Kryukov 234
3 DamithSL 233
4 Mathew Soji 195
0 OriginalGriff 7,168
1 Sergey Alexandrovich Kryukov 6,377
2 DamithSL 5,461
3 Manas Bhardwaj 4,876
4 Maciej Los 4,450


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 20 Sep 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100