Results 1 to 7 of 7
Like Tree1Likes
  • 1 Post By DarrylBurke

Thread: Java Translation

  1. #1
    hello_world is offline Member
    Join Date
    Feb 2012
    Posts
    3
    Rep Power
    0

    Default Java Translation

    Could somebody please translate the following code which can be used on a 2d array of pixel values to do the fast fourier t and get the magnitude of the image. I wonder can anyone translate this code to its Java equivalent?

    *Problem solved*


    Thanks in advance for any help you can offer
    Last edited by hello_world; 02-09-2012 at 07:43 PM.

  2. #2
    Kuttappu's Avatar
    Kuttappu is offline Member
    Join Date
    Aug 2011
    Location
    Kerala, India
    Posts
    40
    Rep Power
    0

    Default Re: Java Translation

    Am not familiar with FFT. But i believe complete translation is not possible without giving cpp code for your class "TAnalysis" and the "main()". Still i shall give some tips

    Tip 1 : All 3 functions are coded inside the class like

    public class TAnalysis {
    //variable declarations (eg: private float im;)

    // Fn 1 code (eg:public void FFT() { } )

    //Fn 2 code

    //Fn 3 code

    // Also code of main if this class contain main. Unlike cpp main() in java should be inside a class.

    }

    Tip 2 : In Java pointers are not used like cpp. So u will have to change arguement types of functions.

    Tip 3 : For anyone to translate this from cpp to java, complete cpp code is required.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: Java Translation

    1. Attempting to 'translate' code from one programming language to another usually produces code that is less than optimal, both in terms of performance and maintainability. A far better approach is to understand the functionality of the code, and to write new code that adopts the idiom of the other language while using the same or similar inputs and providing tha same or similar outputs/results.

    2. This is a forum not a code factory. If you've come here to learn enough Java to do the conversion yourself, you'll get good help here. If however you were hoping that someone would hand you the code on a platter, without requiring you to make the effort to do it yourself, you're in the wrong place.

    To others responding to this thread: note that any full code solution (aka spoonfeeding) will be removed by a moderator. Tips and guidance that further the OP's understanding are welcome.

    db
    Tolls likes this.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    hello_world is offline Member
    Join Date
    Feb 2012
    Posts
    3
    Rep Power
    0

    Default Re: Java Translation

    ok thanks for your help
    Last edited by hello_world; 02-09-2012 at 07:42 PM.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: Java Translation

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default Re: Java Translation

    As Darryl says, you need to understand what the code is doing and then write it in Java.
    Just transferring the methods one-to-one will likely not work.

  7. #7
    hello_world is offline Member
    Join Date
    Feb 2012
    Posts
    3
    Rep Power
    0

Similar Threads

  1. Language translation
    By archanaanbu in forum Java Applets
    Replies: 13
    Last Post: 02-19-2011, 06:56 PM
  2. Language translation
    By archanaanbu in forum Java Applets
    Replies: 0
    Last Post: 02-09-2011, 05:21 AM
  3. Idea for Meaning Translation
    By OmerHalit in forum AWT / Swing
    Replies: 5
    Last Post: 07-08-2010, 07:19 PM
  4. WORD Translation HELP PLZ :(
    By sammypants in forum New To Java
    Replies: 2
    Last Post: 11-24-2009, 01:46 PM
  5. X / Y Translation Problem
    By SkinnyK in forum New To Java
    Replies: 4
    Last Post: 01-16-2009, 12:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •