Image rotation - mapping the image into the center of the new image

        for (int x = 1; x < imageOne.getWidth()-1 ; x++) {
            for (int y = 1; y < imageOne.getHeight()-1 ; y++) {
                /* Get the values from imageOne */
                int red = imageOne.getRed(x, y);
                int green = imageOne.getGreen(x, y);
                int blue = imageOne.getBlue(x, y);
                         * x' = a0x + a1y + a2
                         * y' = b0x + b1y + b2
                double x2 = Math.round(a0 * x + a1 * y);
                double y2 = Math.round(b0 * x + b1 * y);
                if (x2 > imageOne.getWidth()-1 || x2 < 0 || y2 < 0 || y2 > imageOne.getHeight()-1){
                    //Do Nothing
                }else{
                    imageTwo.setRGB((int)x2, (int)y2, red, green, blue);
        }Using the above algorithm, the image will rotate, but the rotation will start from the corner of the image (coordinate 1,1). For example, if I do a >90 degree angle rotation, the image will diappear.
I want my image to rotate and appear in the middle of the new image output.
Any idea?

Hi,
As part of my courseowrk, where we can't use the Java's API, im trying ot do the rotation manually...
Say my image is always 512x 512, and I've tried "translate" -> "rotate" -> "translate" below:
        for (int x = 1; x < imageOne.getWidth()-1 ; x++) {
            for (int y = 1; y < imageOne.getHeight()-1 ; y++) {
                /* Get the values from imageOne */
                int red = imageOne.getRed(x, y);
                int green = imageOne.getGreen(x, y);
                int blue = imageOne.getBlue(x, y);
                         * x' = a0x + a1y + a2
                         * y' = b0x + b1y + b2
                //1st transform
                x2 = x+256;
                y2 = y+256;
                 double rad = Math.toRadians(m);
        double cos = Math.cos(rad);
        double sin = Math.sin(rad);
        int newX = (int)Math.round(cos * getX() - sin * getY());
        int newY = (int)Math.round(sin * getX() + cos * getY());
        setX(newX);
        setY(newY);
                //2nd transform
                x2 = x2-256;
                y2=y2-256;
                if (x2 > imageOne.getWidth()-1 || x2 < 0 || y2 < 0 || y2 > imageOne.getHeight()-1){
                    //Do Nothing
                }else{
                    imageTwo.setRGB((int)x2, (int)y2, red, green, blue);
        }setX and setY will update the value in x2 and y2.
The concept is to move the pointer to the mid of the image (midHeight and midWidth) which is "x2 = x+256;" and "y2 = y+256;", rotate and translate again - but the output is still nto in the middle..
Any idea?

Similar Messages

  • ECC6.0 upgrade and BW steps for mapping the new ECC6.0 source system

    Hello gurus
    We are upgrading from R3 4.6C to ECC6.0. We use BW 7.0 SP 18. We will create the new ECC6.0 source system in BW, replicate metadata and everything. The question is how do we copy or reassign the existing objects pointing to our current 4.6c dev system (transfer rules, transformations, infopackages, process chains) to point to the new ECC6.0 dev system ? As a note,  we also need to keep the current 4.6c source system objects until go-live o ECC6.0.
    What is the common practice in such a case ? I am sure we are not unique...
    A prompt response would be appreciated.
    Thank you all.

    So the plan is to copy dev R3 and upgrade that - then Q r3 copied and upgrade that - then upgrade directly prod R3?
    If so - then if it were me - I would firstly prove all this in a sandbox environment where BW dev points at an upgraded sandbox R3 ecc
    ie same logical system
    Then once that is proved I would organise downtime of BW development for a few months whilst the d-q-p ecc happens
    Then when they copy dev r43 to ecc r3 i would then just point BW dev at the new ecc box and go from there (ie clear the deltas - change the logical system name to the new ecc box - replicate meta data - transtru all the datasources - run the process chains nothign to worry about)
    However if you cant afford the down time - you may have to have an alternative transport route - ie copy dev BW to a another dev bw box and have an alternative path to production for issues
    Then once everything is upgraded redo the changes through d-q-p to get the transports back in line (thats what we did)

  • Why won't the new keynote allow me to center images?

    Since the new download it has taken away the yellow lines that allow you to center the item. Please help me know how to get these back. Thanks

    Apple might include this as an  update this next year, were all waiting to find out

  • How can I attach an image without the image is in the email body? (using the new mail the Lion)

    How can I attach an image without the image is in the email body? (using the new mail the Lion)
    I want in attachment, not in the body mail.

    I think your only solution is to zip the image files first and then attach them.
    Read this from a site I found:
    Sending Graphical Attachments -- When you attach a graphical image to your message, the recipient of your message sees the image inline (that is, in the body of the message) if her email client supports inline display. ("Take Control of Email with Apple Mail" contains a table listing the capabilities of popular Mac and PC email clients.) If a client does not support inline display (or the recipient has turned off the inline display option), the file appears as an attachment that must be opened in a separate program.
    On the one hand, an inline image is easier for the recipient to see - all she has to do is look at it. On the other hand, inline images can be frustrating to scroll through. If you do not wish to send a graphical image inline, you must compress the file before attaching it - Mail, sadly, lacks a built-in compression option, though fortunately for Panther users, the Finder offers Zip compression without requiring a separate application.
    Note that when you compose a new message, Mail always shows attachments in the body of your message. You can manually drag them somewhere else, but many email clients display all attachments in a separate list, regardless of where you place them in the message body.
    If you paste an image into a message or drag & drop an image from another window (say, a Web browser), Mail converts the raw image data to an attachment in TIFF format. On the other hand, if you drag & drop the icon of an image file (or use the Attach button to locate the file using the file browser), Mail leaves the attached image in its original format. This difference is significant, because although most email clients can display JPEG images just fine, support for TIFF - especially in non-Mac email clients - is less common. If possible, I suggest attaching image files as opposed to pasting or dragging in raw image data.

  • Is it possible to change the automatically set image on the new iMovie Theater title screen?

    I made a few movies on the new iMovies 2013 then uploaded into iTheater. I love the software and its ease of use. However, I noticed iTheater automatically sets the title image. Similar to youtube, iTheater probably uses the video mid point image as default. Is it possible to change the set image on iTheater?

    Unfortunately, no.

  • When I use Export Project to New Library in Aperture does it create a copy of the images in the new Library?

    I am going through my only library now and trying to better organize everything.  I am grouping my images into projects by year then cleaning up each year.  As I finish a year I use the Export to New Library option to create a library for each year.  My question is when I do this and I tell it to Consolidate Masters into exported library does it create copies of the images in the new library as well as leaving a copy in the original library?  My goal once I get this completed is to delete the original library but I certainly don't want to lose any of my images.  Just looking at file sizes for the libraries I can see that the main library never gets smaller and the new libraries don't really seem large enough to contain everything.
    Thanks.

    To be honest a 6 year old machine with 4gb of memory and 300gb of disk running Lion and Aperture  is not going to give you the greatest performance no matter how you split the library.
    You're going to need more disk, What's your backup procedure now? The best performance will be had by getting an external disk putting the masters on it as referenced and having the library on the internal drive.
    More memory would be nice but a 6 year old iMac, I think, is maxed out at 4. You'll need to keep other programs running to a minimum when you're working with Aperture.
    How much free space is on the internal drive? That will be an issue also. If even with the masters relocated to an external drive cause the internal drive to fill up you'll need to move the library off the internal. If you do that you'll want to go with a FW drive. As long as only the masters are on the external you can get by with a USB but once the library goes out there you're really want to look at FW.
    Hope this helps, post back if you have more questions
    regards

  • Did Adobe forget to include the new "Preserve Details" algorithm in Preferences General Image Interpolation?

    In Photoshop CC 2014, if I open the "Image Size" dialog, using CTRL-I, I can choose which resample algorithm to use such as Automatic, and the new "Preserve Details" among others.
    But when I go into:  Preferences > General > Image Interpolation
    The new "Preserve Details" algorithm is not listed.  Did Adobe forget to include this?  How do I tell Photoshop CC to use the new algorithm when using tools such as Crop?

    That's about it, DP.
    I still say that an adaptation of the "Preserve Details" function to be a general purpose image resampling tool (e.g., for use in crops, transforms, etc.) would be WELL worth Adobe doing.
    -Noel

  • I have noticed that the images on the iPhone 6 look painted because of the new image stabilization. Can we have the option to turn it off?

    I like the new iPhone, but the images are starting to concern me.  I am an iPhone Photographer, and I use my iPhone everyday to capture memories and create art.  I am use to zooming into an image if I want to eliminate unwanted scenery or objects.  Can we have the option to turn off the Stabilization feature on our iphones?

    This is not Apple.  We are users like you.  If you want to contact Apple:
    http://www.apple.com/feedback/iphone.html

  • With the new update has gone the option to blend the edges of the images. An indispensable tool

    With the new update has gone the option to blend the edges of the images. An indispensable tool.

    Ibán,
    Apply the Picture Frame effect in Pages V4, then paste into Pages V5.
    It's inconvenient, but then many things are in Pages V5.
    J.

  • Transform implementation goes wrong when I try transforming a image through script and save the new image using a HTML to canvas plugin.

    Transform implementation goes wrong when I try transforming a image through script and save the new image using a HTML to canvas plugin. The rotation comes up fine, but the origin of the transformation is faulty (compared to other browsers like Chrome & IE)

    A good place to ask advice about web development is at the mozillaZine "Web Development/Standards Evangelism" forum.
    *http://forums.mozillazine.org/viewforum.php?f=25
    The helpers at that forum are more knowledgeable about web development issues.
    You need to register at the mozillaZine forum site in order to post at that forum.

  • HT4007 Does Aperture support Images and videos from the new 3D cameras?

    Does Aperture support Images and videos from the new 3D cameras?

    If the camera is listed here OS X Lion: Supported digital camera RAW formats or here Mac OS X v10.6: Supported digital camera RAW formats then the raw image file is supported by Aperture.
    If the camera is not listed then as Keith wrote if it produces JPG's they can be imported into Aperture.
    If you told us what camera you were interested in it might help.
    regards

  • Is it still possible to soften an image in the new Keynote?

    Hi all,
    The 'adjust image' panel used to have a 'sharpen' filter which ranged -100 to +100. This made it possible to soften (blur) an image.
    In the new Keynote, the range is 0-100. Is there a new way to soften images or is this another 'missing feature'?
    Thanks,
    M

    Hi Gary, thanks for your reply.
    When moving the slider, the image does change sharpness.
    However, I can only make the image sharper, not smoother, since the slider no longer goes into minus.
    Smoothing an image was really useful before adding it to the background.

  • Why aren't my images sent from my contacts appearing in iChat/Messages in the new Maverick?

    I updated to the new OS (Yosemite 10.10.2) and my Messages app is no longer showing the images in the feed that are being sent to me from my contacts. Here's an example:
    In the examples above, I've tried clicking on the images (or grey dots that symbolize PNG files) and I am unable to view them unless i look on my iphone. I've searched through all of the preferences and can't find a way to view the images on my computer. Any ideas on how to fix this?
    Thank you!

    Quit Messages if it's running.
    Triple-click the line below on this page to select it, then copy the text to the Clipboard by pressing the key combination  command-C:
    ~/Library/Messages
    In the Finder, select
              Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return. A folder should open. Inside it, there should be a subfolder named "Attachments" (without the quotes.) If that subfolder doesn't exist, create it. Launch Messages and test.

  • How do you get your old scores on your games when you transfer the games between devices ive signed into game center and my scores are there but when I open the games Im at 0 again

    how do you get your old scores on your games when you transfer the games between devices ive signed into game center and my scores are there but when I open the games Im at 0 again

    Did you do this?
    iOS: Transferring information from your current iPhone, iPad, or iPod touch to a new device

  • After the new 10.9.2 Maverick upgrade, my Photosmart C4480 3 in 1 printer can not scan and save the file to desktop or documents.  You can only see the image in the print preview area. Does anyone know how to fix this or when a fix will be out?

    After Aple support downloaded the new 10.9.2 Maverick upgrade on my MacBook Air, my Photosmart C4480 3 in 1 printer can not scan a document and load the file on to my desktop or document file. (You can see the doc image in the preview but it doesn't save it.) Does anyone know an Apple fix for this or when the fix will be out?  After hours of trying reloading, and the usual fixes, etc. Apple told me to call HP, and HP told me they don't support Mac.  It does not seem honorable of Apple to put out an upgrade and not tell people it will destroy their scanning ability, and that the only thing to do is to buy another printer/scanner.

    Have you tried using Applications/Image Capture to scan.
    Vuescan often works.
    VueScan
    VueScan FAQ

Maybe you are looking for