Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Looking for good graphics language.

  1. Jan 18, 2008 #1

    DSR

    User Avatar

    Hello.

    I want to find a computer language for doing real-time interactive graphics. I want to be able to operate on each point of an image in real-time. For example I thought it would be interesting to be able to write a program that will perform a Fourier Transform on an image, do some operation on it, and then transform it back, sort of like an optical filter. I’m not asking anyone to write me code that does this. It’s just an example of something I’m thinking of doing. What would be the best language for this task? I know ‘C’, Pascal, and BASIC pretty well. And I know a little Visual Basic and C++. If possible it would be good if I could find something that's at least reasonably priced.

    You might be able to tell that it’s been a little while since I’ve done some coding since I’m not up on the latest languages, like C#, Java, Perl, or J. And what is the difference between C++ and C#? And has anyone heard of a language called 'D'? I suppose it’s supposed to be the latest, greatest successor to C++, and C#.

    Thanks.
     
  2. jcsd
  3. Jan 18, 2008 #2

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    OpenCV is a C library for doing image processing tasks, it's a very good way to learn about the various operations and it comes with framework code to load images and display them and the results. And it's free.
     
  4. Jan 18, 2008 #3

    ranger

    User Avatar
    Gold Member

    For such purposes I would choose C. The main reason for this is because there are tons of open source programs (written in C/C++) that already do similar functions. But the more important thing is that these programs use existing libraries that make implementing Fourier transforms and other tools for manipulating images in the frequency domain a little easier. The good thing is that you probably won't have to do much of the low level detail of the transforms yourself as someone else has already provided a library for it.

    You can search Souceforge for such software and libs. And example of such an image manipulation program is GFourier (which I've never tried):
    http://sourceforge.net/projects/gfourier/
    http://sourceforge.net/projects/fourier-ipal/
     
  5. Jan 18, 2008 #4
    If you want proper GUI, I'd recommend using Qt - it has a QPainter widget which does the painting to the window, and it's really a breeze drawing some basic GUI using the designer and adding the functionality, once you complete the basic tutorial...

    as for language - C# is MS-Java clone, it has many built in functions which makes coding for windows faster then plain C++, but it's an interpreted language - which means it's slower then C++.

    I've never used D, but I think it would be easier for you to stick with C++, it's better then C in the sense that (if you code right) you code will be more readable and logical, and you could re factor your program with minimal amount of work... while the run time difference between C and C++ is usually negligible... both C and C++ have many mature libraries for everything you can think of, as opposed to new languages like D...

    anyway, if you don't want to learn C++ and QT, you can try glut with C for the rendering part... but I'd recommend it only in the case you don't plan to use a GUI... glut can show menus, but thats about it...
     
    Last edited: Jan 18, 2008
  6. Jan 19, 2008 #5

    daniel_i_l

    User Avatar
    Gold Member

    I'd recommend C++, there're plenty of open source image processors you can use. But python also has some cool image processing modules.
     
  7. Jan 19, 2008 #6
    python is elegant and has some very nice modules like scipy and matplotlib, but it's not that fast... its good for making non realtime calculations and prototypes, for realtime I'd recommend either C or C++...
     
  8. Jan 20, 2008 #7

    DSR

    User Avatar

    Thanks everyone for the advice. That's helpful. Now where can I go to get a good C or C++ compiler?

    One more question. Just curious, but I'm just wondering how those visualization that come with something like "Real Player" work? What language were they written in? How is a fast moving image like that done? Or how about software to display something like an oscilloscope? It seems like it should be a simple algorithm, but when I tried it previously it always came out too slow. I still need to learn something about animation, if that's what's used.
     
  9. Jan 20, 2008 #8

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    The 'express' editions of microsoft's visual studio is free.
    There are various tricks you can do to make visualisations without re-calculating every pixel on each frame. You can use colour maps or combine a few different variable functions to get some impressive effects with very few resources - although today they probably just calculate everything for each frame!
     
  10. Jan 20, 2008 #9
    well, I would recommend against the express edition of MS Visual Studio if you wish to redistribute your software...
    minGW is a free windows compiler, and eclipse is a free IDE which has some very nice features - there are the obvious ones like auto-completion, got to definition, debugging interface etc. and there are some i haven't found anywhere else like auto-closing of parenthesis and quotation marks.

    the advantage of using minGW (which is a port of gcc for windows) is that you can compile the same code for almost every OS out there, and you're not limited to windows.
    another advantage over the express MSVS is that you only need to supply one dll with your program for it to run on another windows machine, while with microsoft's express compiler you'd have to supply the whole redistributable run-time environment for visual studio...

    as for your question about displaying a moving picture - modern software utilize the drivers of the graphic device through an abstraction layer, in windows it's direct X or openGL (the latter is used on many other OS's as well).

    the memory on you video card is much faster then your main RAM, and it probably has a Graphics Processing Unit too, newer video cards (those made after 2005, i think) have video decoders built-in for better video rendering.
    drawing something you computed from the main RAM is called software rendering, it is a slow process for the reasons I've just mentioned... if you want to make use of your hardware, you must use direct X or OpenGL for rendering.
     
  11. Jan 20, 2008 #10
    I would suggest C (gcc) and OpenGL .
    Very good performance + They are free + You can run any OS (Unix,Linux,Microsoft)
     
    Last edited: Jan 20, 2008
  12. Jan 21, 2008 #11
    I would suggest the use of the CImg Library : http://cimg.sourceforge.net

    This is an open-source C++ Image Processing Library, which is very simple to use,
    free and multi-plateform. It has a lot of classical image transforms implemented (including Fourier Transform).
    It allows image display and interaction as well, using generally very few lines of code.
    (see the tutorial for an example of code : http://cimg.sourceforge.net/reference/group__cimg__tutorial.html )

    There is an example of interactive Fourier filtering included in the example codes of the package.
     
  13. Jan 21, 2008 #12

    DSR

    User Avatar

    Interesting. How can there be so many free items like - OpenCV, express MS Visual Studio, MinGW, Eclipse, CImg Library, C (gcc) and OpenGL - available? Are they of good quality? I won't be compromising my system's security by using these, will I? How do I get a hold of these? What does the "gcc" refer to? And learning which of these would be of greatest value to me in the job market, even an entry level position, not that that is my primary motivation in this case?

    And what would be the best source for learning these? Is there an OpenCV for Dummies?
     
    Last edited: Jan 21, 2008
  14. Jan 21, 2008 #13

    ranger

    User Avatar
    Gold Member

    Not everyone sees it as a benefit to the programming community at large to design software, make it closed source, and sell it for a profit. My system right now comprises strictly of free open source software. As I stated in post #3, you can find lots of these open source software on Sourceforge or by simply searching for it via google. The good thing about having your source out there is that its open to scrutiny of professionals.

    GNU GCC is just a (free) compiler collection for various languages.
    http://gcc.gnu.org/

    I cannot comment on which of the libs would a better investment job wise.
     
  15. Jan 21, 2008 #14
    MS Visual Studio Express is not really free...
    it is designed to be a crippled version for educational purpose, for most people what visual studio express has to offer is more then enough, and it doesn't cost you money - but when a tool you have is limited in it's functionality and you have no legal and little technical ability to add the functionality you want - it is not really a free tool.

    You must make the distinction between free software - which means you got access to the source code, and you can change it as you will.
    and "freeware" which you don't pay for, but the only one able to add features is the author, and he is the only one in control over the program.

    there are many "freeware" with spyware, like WhenU SaveNow which comes with BSplayer or with deamonTools - but open source software -NEVER- comes with commercials, nagging screens, spyware and the likes...

    there are also those who claim that if everyone can see the code - then it's easier to spot weaknesses in it and attack it.
    but remember that when everyone sees the code, these weaknesses are being found and fixed faster.
    closed source code can be very insecure, and no one will know about it, except those who are interested in using these weaknesses, and the author (or team).
     
    Last edited: Jan 21, 2008
  16. Jan 26, 2008 #15

    DSR

    User Avatar

    Those are all very good suggestions, but they are all graphics libraries. To use these in the first place I need a compiler. Is there somewhere can I get a good compiler that won't run hundreds of dollars? Are there free compilers that I can download from the internet?
     
  17. Jan 26, 2008 #16
    gcc (or minGW for windows) is NOT a graphics library, and eclipse is NOT a graphics library either...

    have a look at it here:
    minGW how to install
    i recommend the automated installer which will download the required packages and install them for you: here
    and take a look at eclipse for c++ for you IDE needs...
     
  18. Jan 26, 2008 #17
    Read post #13.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?