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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:19:39+00:00 2026-05-19T04:19:39+00:00

My goal is to create a texture from a webcam image. I get the

  • 0

My goal is to create a texture from a webcam image. I get the image via OpenCV’s new VideoCapture interface from a Logitech QuickCam for Notebooks webcam. The problem is that I get non-continuos data this way, which means that each row of the matrix holding my image data has a gap at the end.

The layout of my image data is as following:

width = frame.cols * frame.elemSize(); // 640 * 3 = 1920 byte
step = frame.step[0]; // 2560 byte
gap = step - width; // 640 byte

However, I did not find a way to tell OpenGL to skip the last 640 byte of every row when loading the texture. I wonder if there is a way doing that? If I just load the data as texture anyway, the image does not show correct (no surprise here). See http://picasaweb.google.com/103165673068768416583/Opencv#5562843683120979026

The best solution would be to get continuos data in the first place, but again I could not find out how to do this (with OpenCV). If I copy the data to a continuos matrix, it is displayed correctly (see http://picasaweb.google.com/103165673068768416583/Opencv#5562843692435711522).

However, I don’t want to copy data if I dont have to. Any ideas?

  • 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-19T04:19:40+00:00Added an answer on May 19, 2026 at 4:19 am

    You could try a combination of GL_UNPACK_ALIGNMENT and GL_UNPACK_ROW_LENGTH.

    In your specific case, this would give :

    glPixelStorei(GL_UNPACK_ALIGNMENT, 4)         // as 2560 is a multiple of 4
    glPixelStorei(GL_UNPACK_ROW_LENGTH, 2560/3)   // to consider each row having this number of pixels
    

    But all in all, are you sure that each pixel have 3 bytes ?

    I’ve noticed that your step is frame.cols * 4, I would not be surprised if each pixel had a padding byte to have an alignment that is a multiple of 4.

    Have you tried instructing OpenGL that your source data is GL_RGBA or GL_BGRA, while leaving the texture internal format to GL_RGB ?

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

Sidebar

Related Questions

The goal: To create a .NET dll i can reference from inside SQL Server
my goal: create an image gallery with each image having a description, name, title,
My goal is to create a custom TextBlock control that has a new dependency
Goal: Create Photomosaics programmatically using .NET and C#. Main reason I'd like to do
My goal here is to create a very simple template language. At the moment,
For example my table is here>> CREATE TABLE tProject( name nvarchar(1000), Goal ntext, Activities
My goal is to maintain a web file server separately from my main ASP.NET
My goal is to recognize simple gestures from accelerometers mounted on a sun spot.
Duplicate: PHP validation/regex for URL My goal is create a PHP regex for website
My goal is to create a generic function that selects a value in a

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.