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 7400439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:15:02+00:00 2026-05-29T04:15:02+00:00

I have an IplImage from openCV, which stores its data in a row-ordered format;

  • 0

I have an IplImage from openCV, which stores its data in a row-ordered format;

image data is stored in a one dimensional array char *data; the element at position x,y is given by

elem(x,y) = data[y*width + x] // see note at end

I would like to convert this image as quickly as possible to and from a second image format that stores its data in column-ordered format; that is

elem(x,y) = data[x*height + y]

Obviously, one way to do this conversion is simply element-by-element through a double for loop.

Is there a faster way?


note for openCV afficionados, the actual location of elem(x,y) is given by data + y*widthstep + x*sizeof(element) but this gives the general idea, and for char data sizeof(element) = 1 and we can make widthstep = width, so the formula is exact

  • 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. Editorial Team
    Editorial Team
    2026-05-29T04:15:02+00:00Added an answer on May 29, 2026 at 4:15 am

    It is called “matrix transposition”
    Optimal methods try to minimise the number of cache misses, swapping small tiles
    with the size of one or a few cache slots. For a multi-level cache this will get difficult.
    start reading here

    this one is a bit more advanced

    BTW the urls deal with “in place” transposition. Creating a transposed copy will be different (it uses twice as many cache slots, duh!)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to exchange data between FreeImage (FIBITMAP) and OpenCV format (IplImage and/or Mat).
I currently have an iplimage that has been modified using opencv. I am needing
I load a binary image in OpenCV using cvLoadImage as follows: IplImage* myImg=cvLoadImage(<ImagePath> ,-1);
So I have a function that receives OpenCV image and turns it into gray-scale.
I have a sequence of IplImage objects coming from a webcam, apply some processing,
I'm dealing with OpenCV and have some memory management questions from their DFT example
I am trying to create a clustered image from data being returned from the
I have an image in Matlab: img = imopen('image.jpg') which returns an uint8 array
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have you refactored from an ActiveRecord to a DataMapper pattern? What conditions prompted the

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.