Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Translation to Java?

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Translation to Java?

    I have the following code which can be used on a 2d array of pixel values to do the fft and get the magnitude of the image. I wonder can anyone translate this code to its Java equivalent:


    Thanks in advance for any help you can offer
    Last edited by java_novice; February 9th, 2012 at 01:39 PM.


  2. #2
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    987
    Thanks
    6
    Thanked 206 Times in 182 Posts

    Default Re: Translation to Java?

    I wonder can anyone translate this code to its Java equivalent
    Almost certainly, yes, as the code isn't particularly involved.

    The pointer arguments are most simply expressed in Java as (possibly double) arrays.

    But before you start to translate it, first get a clear and precise idea of what each of the methods *does*. That is, don't get too hung up on the Java code you write until you have a clear idea of what that code should be doing. Also where the C++ code makes reference to other quantities (like the limit nFFT2 or the Sin and Cos arrays) find out what those quantities are supposed to represent.

    If you find the C++ code mysterious, then my advice would be to forget it and write your own implementation in Java.

  3. #3
    Junior Member
    Join Date
    Jan 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Translation to Java?

    Quote Originally Posted by pbrockway2 View Post
    But before you start to translate it, first get a clear and precise idea of what each of the methods *does*. That is, don't get too hung up on the Java code you write until you have a clear idea of what that code should be doing. Also where the C++ code makes reference to other quantities (like the limit nFFT2 or the Sin and Cos arrays) find out what those quantities are supposed to represent..
    The nFFT and nFFT2 are the number of fft points eg in a 256x256 image, nFFT=256 and nFFT2=158.
    Last edited by java_novice; February 9th, 2012 at 01:39 PM.

  4. #4
    Junior Member
    Join Date
    Jan 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Translation to Java?

    Problem solved, thanks
    Last edited by java_novice; February 9th, 2012 at 01:40 PM.

  5. #5
    Super Moderator pbrockway2's Avatar
    Join Date
    Jan 2012
    Posts
    987
    Thanks
    6
    Thanked 206 Times in 182 Posts

    Default Re: Translation to Java?

    Does that compile?

    You are accessing Sin and Cos as double arrays.

Similar Threads

  1. Language translation
    By archanaanbu in forum Member Introductions
    Replies: 1
    Last Post: February 9th, 2011, 07:01 AM