Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 160107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:58:35+00:00 2026-05-11T10:58:35+00:00

See also: Why is my image rotation algorithm not working? This question isn’t language

  • 0

See also: Why is my image rotation algorithm not working?

This question isn’t language specific, and is a math problem. I will however use some C++ code to explain what I need as I’m not experienced with the mathematic equations needed to express the problem (but if you know about this, I’d be interested to learn).

Here’s how the image is composed:

ImageMatrix image; image[0][0][0] = 1; image[0][1][0] = 2; image[0][2][0] = 1; image[1][0][0] = 0; image[1][1][0] = 0; image[1][2][0] = 0; image[2][0][0] = -1; image[2][1][0] = -2; image[2][2][0] = -1; 

Here’s the prototype for the function I’m trying to create:

ImageMatrix rotateImage(ImageMatrix image, double angle); 

I’d like to rotate only the first two indices (rows and columns) but not the channel.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:58:36+00:00Added an answer on May 11, 2026 at 10:58 am

    The usual way to solve this is by doing it backwards. Instead of calculating where each pixel in the input image ends up in the output image, you calculate where each pixel in the output image is located in the input image (by rotationg the same amount in the other direction. This way you can be sure that all pixels in the output image will have a value.

    output = new Image(input.size())  for each pixel in input: {   p2 = rotate(pixel, -angle);   value = interpolate(input, p2)   output(pixel) = value } 

    There are different ways to do interpolation. For the formula of rotation I think you should check https://en.wikipedia.org/wiki/Rotation_matrix#In_two_dimensions

    But just to be nice, here it is (rotation of point (x,y) angle degrees/radians):

     newX = cos(angle)*x - sin(angle)*y  newY = sin(angle)*x + cos(angle)*y 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 118k
  • Answers 118k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer NSString and CFString support reorderable/positional arguments. NSString *string = [NSString… May 11, 2026 at 11:40 pm
  • Editorial Team
    Editorial Team added an answer I just read this Action Script is a dynamic language,… May 11, 2026 at 11:40 pm
  • Editorial Team
    Editorial Team added an answer I think you could replace the \n\n with (\r?\n){2} this… May 11, 2026 at 11:40 pm

Related Questions

See also: Why is my image rotation algorithm not working? This question isn't language
ASP.NET 2.0, testing in FF3 and IE7. When I hit the 'enter' button from
I have a panel sitting in a div, and I want to use that
I'm currently working on posting a file from a C# application to an image
As I mention in an earlier question, I'm refactoring a project I'm working on.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.