Anyone tried the DCT and IDCT code?

Hi,
I was linked to the following link which provides a DCT and IDCT code:
http://forum.java.sun.com/thread.jsp?forum=426&thread=482368&start=15&range=15&hilite=false&q=
However, when I tried to run it, the resulting (IDCT-ed) array seems to be very different from the origianl array.
For example, the first array element is 1.0, but after the DCT-IDCT process, it becomes 259.99997. And many other become 0.0 or -ve numbers.
I would like to ask if anyone has tried to use that? Does it work....? If not, is there any way to correct it? Or are there any other links to DCT-IDCT with Java source code? I really need it.....
Thanks.

Hi there,
I guess I have made a mistake in using the methods.
The code CAN IDCT the FDCT data it creates. Just take care of which float array in the IDCT method is the output array (the 3 argument).
Sorry about the misunderstand of the code and any confusion caused.

Similar Messages

  • Hi, I need to activate my Adobe CS3 on a new computer because my old one died and I'm having difficulty. Tried the normal registration way and then logged in with my Adobe ID and can see the software and activation code already registered. How to get it o

    Hi, I need to activate my Adobe CS3 on a new computer because my old one died and I'm having difficulty. Tried the normal registration way and then logged in with my Adobe ID and can see the software and activation code already registered. How to get it on my computer registered?

    If your two activation are in use you need to call Adobe. Install CS3 to to point of activation and call Adobe at that point.  They have help me in cases like your My Disk crashed and I replaced it. Could not deactivate the crash activation.  I done that twice over the years I've been using  PS for around 20 years
    To see your key you need to click on the product in your Adobe products and services page.

  • DCT and IDCT - strage phenomenon?

    Hello everyone,
    Applying the dct (discrete cosine transformation) and then the idct to a PlanarImage should return the original picture before the transformation, shouldn't it?
    implementing it the following way:
    ParameterBlock pb = null;
    PlanarImage image = null;
    image = JAI.create("fileload", "d:\\rainbow.jpg");
    // Calculate the DCT of the picture
    pb = (new ParameterBlock()).addSource(image);
    image = JAI.create("dct", pb);
    // ... and back again
    pb = (new ParameterBlock()).addSource(image);
    image = JAI.create("idct", pb);
    delivers an almost white area with the size of the original picture and a black border to fill up the dimension to a 2^n square instead of the original picture (with or without border).
    I get the same result when I extract the DCT Data into an Array (where I plan to do some modifications on the coefficients) putting it back into a DataBuffer, to a WriteableRaster and finally to a BufferedImage before applying the idct.
    I am totally confused since 'idct(dct(image))' should deliver 'image'.
    Any ideas?
    sprossi

    Hi sprossi,
    Thanks for your reply.
    I think I'm facing the problem you faced previously about the JAI would "reset" the image dimension to powers of 2 upon DCT and IDCT.... and as far as I know is to use Rectangle class to "chop" it back...
    The JAI is a bit too difficult for me to use.... meanwhile I'm looking for codes that directly perfrom DCT and IDCT without using JAI. I've seen the code in the replies, but it's for 8X8, and I would like to to work on a 1-D double array which I get from:
    bufferedImage.getData().getPixels(0, 0, bufImage.getWidth(), bufImage.getHeight(),(double[])null);
    have you seen any DCT and IDCT that can work on 1-D array?
    Also, I'm looking for a way to transform the watermarked 1-D double array back to a BufferedImage. There is a link telling how this is done on a 2-D double array.
    http://archives.java.sun.com/cgi-bin/wa?A2=ind9907&L=jai-interest&P=R1637
    I've tried to modify it for 1-D array, but it didn't success. An ArrayIndexOutOfBoundException is raised when I tried to do a setData()... here is the code I wrote, may be you can have a look on that....
    public BufferedImage double2BufImage(int width, int height, int numBands, double[] imgData) {
              * Step 1:
              * create a SampleModel to accomdate the double data
              SampleModel sampleModel = RasterFactory.createBandedSampleModel(DataBuffer.TYPE_DOUBLE, width, height, numBands);
              System.out.println("sample model created with sample data type: " + sampleModel.getDataType());
              * Step 2:
              * create a ColorModel to accomdate the double data
              ColorModel colorModel = PlanarImage.createColorModel(sampleModel);
              System.out.println("color model created with transfer type: " + colorModel.getTransferType());
              * Step 3:
              * create a TiledImage using the SampleModel just created
              Point origin = new Point(0,0);
              TiledImage tiledImage = new TiledImage(origin, sampleModel, width, height);
              * Step 4:
              * create a DataBufferDouble to hold the pixel data
              DataBufferDouble dbuf = new DataBufferDouble(imgData, imgData.length);
              System.out.println("data buffer double created with size " + dbuf.getSize());
              * Step 5:
              * create a WritableRaster from the DataBufferDouble
              WritableRaster raster = Raster.createWritableRaster(sampleModel, dbuf, null);
              System.out.println("raster created." + raster.getWidth() + "X" + raster.getHeight());
              * Step 6:
              * set the TiledImage data to that of the Raster
              *     and create a RenderedImageAdapter
    // ***** This is where the exception is raised ***********
              tiledImage.setData((Raster)raster);
              System.out.println("TiledImage set.");
              RenderedImageAdapter ria = new RenderedImageAdapter((RenderedImage)tiledImage);
              * Step 7:
              * create a BufferedImage from the WritableRaster and other stuff
              // BufferedImage bufImg = new BufferedImage(colorModel, raster, false, null);
              BufferedImage bufImg = ria.getAsBufferedImage();
              System.out.println("BufferedImage created with width X height: " + bufImg.getWidth() + "X" + bufImg.getHeight());
    // **** this block is supposed ot test whether I can write the image out to a file, but I can't even reach that because of the exception*******     
              File outFile = null;
              try
                   outFile = new File("result.jpg");
              ImageIO.write(bufImg ,"jpg", outFile);
              } catch (IOException e)
                   System.out.println("error in writing out file");
                   e.printStackTrace();
                   System.exit(0);
              return bufImg;
         } // end fof double2BufImage
    I'm desperate for the code to perform digital watermarking.... which is only a part of my course project.... would you (anyone is welcome) provide me some light on this area...?
    Thanks again.
    Best,
    Victor

  • Has anyone tried the Normalizer app?

    Has anyone tried the Normalizer app?  We are looking for something that will normalize job level for us.  The only app I have found was the normalizer and a lot of the links on their website don't work and it doesn't look like they have has any activity on their site for over 6 months.

    Great!! Thanks LB
    From: Leigh Burke
    Sent: Sunday, January 04, 2015 2:14 PM
    To: Thomas Reyto
    Subject: You have been mentioned by Leigh Burke in Re: Has anyone tried the Normalizer app? in Topliners
    http://topliners.eloqua.com/
    You have been mentioned
    by HYPERLINK "http://topliners.eloqua.com/people/lburke?et=notification.mention"Leigh Burke in Re: Has anyone tried the Normalizer app? in Topliners - HYPERLINK "http://topliners.eloqua.com/message/56819?et=notification.mention#56819"View Leigh Burke's reference to you

  • Has anyone tried the new MS Oracle DataProvider ?

    Hi all.
    Has anyone tried the Microsoft issued Oracle .Net data provider? I am not fond of switching horses in midstream (have been struggling with ODP for a few weeks). I do not like the ODP for these reasons...
    1) Documentation is really non-existant/useless especially where hueristics and 'gotchas' are concerned
    2) it is a HUGE install (why I have no idea)
    3) some things simply do not work (like my recent rants on trying to return varchar2's from stored procs and functions).
    Is the MS any better ?
    Thanks

    Hi,
    1) There is a pdf doc and integrated help which comes with the ODP.NET. There are a few gotchas which could cause some hair-pulling moments. Sometimes it helps to read the same doc several times to really know what to do.
    But instead of wasting time reading the doc, the samples cover most of the typical cases. (i think it includes your varchar2 output bind case).
    2) The huge install is due to Oracle Client 9. The provider needs several dlls beyond Oracle.DataAccess.dll and OraOps9.dll. There are some other oracle standard dependencies also. MS provider for oracle will have the same issue (I think they need oracle client install also).
    There a few post where the `Instant client install` is going to solve that.
    But the thin client (like JDBC thin driver for oracle) is still (IMHO) the best solution for the huge install problem.
    3) See my reply in the other post. (try the sample also)
    Finally, which some other posters have mentioned before: Good luck looking for help for MS's provider when you are stuck.
    Arnold

  • Has anyone tried the Yosemite beta?

    Has anyone tried the Yosemite beta?  Or shall I just wait for the official version to come out?

    Beta OS software should only be installed on a test machine, NEVER a primary device, and honestly only by someone with a compelling reason (testing, development).
    Yes, wait for final version this fall.

  • Anyone tried the new BIOS 1.4 for K8N Neo4 Plat?

    Has anyone tried the new 1.4 BIOS for nVidia K8N Neo4 Platinum? Does it fix the 220Mhz bug? Does it worth it at all? I am currently with ver.1.1 and running at 2453Mhz at HTT=4, Multi=11, FSB=223, V.Core 1.375v +3.3%, Memory 2.7v at 2-3-3-6-1T
    AMD 64 3500+ Winchester
    K8N Neo4 Platinum
    Corsair Twinx 2x512
    NEC ND-3520a
    Sapphire Radeon X850XT
    Enermax 485W
    WD Raptor 74GB

    Bios 1.4 Final Works fine on my system....
    HTT=2, Mult=11, FSB=237, VCore 1.425 + 9.9%, Memory 2.8V at 2.5-3--3-7-2T 4x 512 (2 x 512 Corsair C2Pros)+(2 x 512 Crucial Ballistix Tracer) 2 Gig Total....
    Psygnosi

  • I'm new to Mac, have had for approx.  I put my iPhone and iPad and my wifes in iTunes and now when i start my system on.  I now have a Guest user show up at the log on screen.  Is this normal.  And how can I take it off.   Tried the help and no luck

    I'm new to Mac, have had for approx.  I put my iPhone and iPad and my wifes in iTunes and now when i start my system on.  I now have a Guest user show up at the log on screen.  Is this normal.  And how can I take it off.   Tried the help and no luck

    Tatanka11 wrote:
    I'm new to Mac,...
    Then...  You may find these Links of Interest and Value...
    Show me how to set up my Mac.
    http://www.apple.com/support/mac101/
    http://www.apple.com/support/switch101/     Switching from PC
    http://www.apple.com/findouthow/mac/
    Enjoy your Mac...

  • My ipod touch screen is totally unresponsive and i have been using it under normal conditions. ihave tried the reset and restore but to no avail.everything works as it would normally do  on the screen.help pls????

    my ipod touch screen is totally unresponsive and i have been using it under normal conditions. ihave tried the reset and restore but to no avail.everything works as it would normally do  on the screen.help pls????

    Might want to post your question in the correct forum.  This is the iPHONE forum.

  • I have a cracked screen, does anyone know the cost and time it take apple to repair?

    I have a cracked screen, does anyone know the cost and time it take apple to repair?

    I'd like to know too for my MacBook Pro Retina (Late 2013). Having spoken to some Apple Stores here in Sydney, I need to bring in the computer for them to tell me. I'll know more tomorrow.

  • How do i unfreeze my ipod when ive already tried the menu and select button and that didnt help?

    how do i unfreeze my ipod when ive already tried the menu and select button and that didnt help?

    How long did you press and hold both the Select (Center) and Menu buttons together?  Have you tried doing this procedure more than once?  Is the hold switch in the Off position?
    If nothing else, let the iPod's battery fully drain. Then charge it back up again.
    B-rock

  • Hello I have a IMac OS X 10.9. 4 serial number is: YM*****ZE2 and I can not install the admin password I have tried the system and typed: appeared what I do?

    Hello I have a IMac OS X 10.9. 4 serial number is: YM*****ZE2 and I can not install the admin password I have tried the system and typed:
    root # mount -uw/
    launchctl load /System/Libary/LaunchDaemons/com.apple.Directoryservice.plist
    appeared: launchctl: Couldn´t stat(''/Sytem/Libary/Launchdaemons/com.apple.DirectoryServices.plist''): No such file or directory
    ls /User
    decl . -passwd/Users/usarname password
    appeared:operation failed with error: eServerError
    What I do?
    <Edited by Host>

    If the user account is associated with an Apple ID, and you know the Apple ID password, then maybe the Apple ID can be used to reset your user account password.
    Otherwise*, start up in Recovery mode. When the OS X Utilities window appears, select
              Utilities ▹ Terminal
    from the menu bar at the top of the screen—not from any of the items in the OS X Utilities window.
    In the window that opens, type this:
    res
    Press the tab key. The partial command you typed will automatically be completed to this:
    resetpassword
    Press return. A Reset Password window opens. Close the Terminal window to get it out of the way.
    Select your startup volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Follow the prompts to reset the password. It's safest to choose a password that includes only the characters a-z, A-Z, and 0-9.
    Select
               ▹ Restart
    from the menu bar.
    You should now be able to log in with the new password, but your Keychain will be reset (empty.) If you've forgotten the Keychain password (which is ordinarily the same as your login password), there's no way to recover it.
    *Note: If you've activated FileVault, this procedure doesn't apply. Follow instead these instructions.

  • When I try to start up my macbook, it makes the startup noise, but won't go any farther than the white/grey screen. I've tried the commands and nothing has worked. Please help

    When I try to start up my macbook, it makes the startup noise, but won't go any farther than the white/grey screen. I've tried the commands and nothing has worked. Please help

    Hey marleyrose,
    Thanks for the question. I understand that you are experiencing issues with your MacBook. The following resource may provide a solution:
    Mac OS X: Gray screen appears during startup
    http://support.apple.com/kb/ts2570
    Thanks,
    Matt M.

  • I have an Iphone 5c that wont power on, I have tried the chargers and cables and they work fine so I now beleive it is the phone

    My iphone 5c has no battery life left and is unable to charge, there for unable to power on, I have tried the chargers and cables which all work fine in other devices, I am now stuck with a dead iphone5c that I need fixed

    Am also having this problem. Daughter's iPhone 5c failed completely the other week after experiencing the same problem. We had a replacement phone provided that I picked up on Friday, and still have exactly the same issue with charging.
    Have bought a brand new Apple Lightening cable but no joy - when switching on the phone the battery is showing as dead with an image of the lightening cable (assume this means it wants a cable plugging on). No joy with any other cables, all of which incidentally work on my own iPad Air.
    Strange as well that this started happening once the IOS8.3 upgrade was loaded. With my iPad, I have not upgraded the IOS and it works fine.
    So unsure if it is a software or a hardware issue. I've tried rebooting by holding the Home and On-Off switches, tried connecting it to iTunes which doesn't show the phone nor does the computer recognise it as an external device.
    Really am tearing what's left of my hair out with this one - have already had three visits to the Apple Store at the Trafford Centre and can't face another......help!!!!!

  • I am trying the expdp and impdp utility getting error

    I am trying the expdp and impdp utility, as per the documentation I logged in as sys and created a directory datapumpt in the location 'C:\oracle\odp' , i did grant the read and write privilege to my user_id.
    when i tried the expdp command in the prompt its throwing errors:
    Ora:39002 invalid operation
    ora: 39070 unable to open the log file
    ora: 29283 invalid file operation
    ora:06512 : at sys.utl_file line 475
    ora: 29283 invalid file operation.
    Operating system : windows / oracle version : 10.1.0.3.0
    Operating system : Linux AS4
    please help me on this.

    I'm afraid there is a big problem...
    C:\oracle\odp is a windows path
    If the Oracle server is running under Linux, your directory is invalid.
    A directory is an "alias" for a folder on the server, not on the client !!!
    The expdp/utl_file/... won't access folder on the client !

Maybe you are looking for

  • Acrobat XI Pro install errors 1935 &1603

    Hi, I have just upgraded from CS3 and run the Creative Cloud installer app but am having problems with Acrobat (whereas Indesign and Photoshop installed fine) on my workstation that is running Win 7 64-bit. I have therefore uninstalled all Adobe prod

  • Unable to view Inbox sub-folders in Mail on OSX Mavericks

    Hello, I'm working with two Exchange accounts that have the same problem.  Both accounts have sub-folders underneath the Inbox folder.  After upgrading to OSX Mavericks, the sub-folders are no longer visible within Mail. If I go on the web and mark a

  • JHS 10.1.3.1.26 - FileUpLoad problem

    Hi , I got a FileUpLoad problem.Here are the error messages. It works on local oc4j , but failed after deploying to Application Server 10.1.3. Any ideas ? Thanks. Eron Yang. java.lang.NoSuchFieldError: conn at oracle.ord.im.OrdDocDomain.create(OrdDoc

  • P E 13 download error, (Windows) 32 bit arrives, 64 bit needed -- how to get? thanks

    PE 13  download to   Windows 64 bit OS came as 32 bit  version! ( I tried twice, took 2 hours ).  How to get  64 bit version of  PE 13  to download?

  • Does Firefox 6 work with Billeo?

    I had to reinstall Firefox 4 because 5 did not work with Billeo. Does Firefox 6 work with Billeo?