用C/C ++和图形处理图像? [英] Image handling in c/c++ and graphics?
问题描述
大家好,
在开始写问题之前,我想弄清楚这是我的第一篇文章,并且我真的是编程方面的新手.我刚学过C(即字符串操作,数组n全部).我使用非常老版本的turbo C编译器(蓝屏:P,现在我知道这些天了)(因为我的朋友告诉我,它易于使用,并且使用C可以执行其他编译器可以执行的任何操作).我必须承认这真的很容易理解.
现在,我想制作一个将图像作为输入n的程序,并通过一些编辑(例如放大/缩小)将图像作为输入.我不知道从哪里开始.
所以我的问题是:使用C n编译器是否可以输入图像并将其像素存储在数组coz中,所以我尝试过的所有库(例如magick ++,opencv,CImg)在编译期间都会出错,因此我认为它们与该编译器不兼容.
在进行更多Google搜索之后,我遇到了以下代码:
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);
但我什么都不懂.所以也请帮忙.
我的最后一个问题是:
我现在想学习图形处理和C ++.因此,请向我建议一个好的方法和一个好的编译器.是我坚持使用此turbo c ++,还是使用borland或VC ++的新版本?
n还告诉我这些编译器有什么区别?
谢谢您的问候
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
推荐答案
您是从错误的起点着手解决此问题的.您说您不理解上面发布的代码段,这是相当简单的C代码.在转向图形之前,最好花一些时间学习文件处理和Windows编程的基础知识.至于要使用哪种编译器,我建议您使用Microsoft的C ++编译器,您可以免费获得 ^ ].
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[^].
您不能直接将图像包含在c ++中.
问题的最后一个答案是,您将turbo c ++用于图形,并且为了倾斜图形,您更喜欢在c中使用书籍图形.
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.
这篇关于用C/C ++和图形处理图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!