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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:07:21+00:00 2026-05-17T19:07:21+00:00

CompVision once again, I’m working with jpeg images in my application. Just because I’m

  • 0

CompVision once again, I’m working with jpeg images in my application. Just because I’m a bit familiar with MFC and ATL, I used CImage to access pixel values.

For my needs I calculate brightness matrix for the image during initialization. Function goes like this (Image is the name of my own class, unimportant, bright is float[][]):

 void Image::fillBrightnessMatrix(){
    COLORREF val;
    for(int i=0;i<width;i++){
        for(int j=0; j<height;j++){
          val=src.GetPixel(i,j);
              bright[i][j]=rgb_to_L(val);
        }
    }
}

Where src is an instance of CImage class, rgb_to_L – some function that calculates brightness of the color.

Examining the performance of my app, I discovered that GetPixel is the most expensive operation, and it significantly (really, ~700 times slower than any other operation) slows down the whole initializing of image. The question is, which library can you suggest for fast access to single pixel values? I don’t need any other operations but loading jpeg image and accessing single pixels. Performance is important, because my application works with set of ~3000 images and I can’t wait for hours to get results.

  • 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-17T19:07:21+00:00Added an answer on May 17, 2026 at 7:07 pm

    Use CBitmap::GetBits() to get a raw pointer to the pixel data. You can now directly party on the pixels without going through the expensive GetPixel() method. There are a number of things you need to be careful with when you do this:

    • You have to use CBitmap::GetPitch() to calculate the offset to the start of a line. The pitch is not the same as the width.
    • Lines in the bitmap are stored upside-down
    • You have to deal with the pixel format yourself. A 24bpp image stores 3 bytes per pixel. An indexed format like 8bpp requires looking up the color in the color table. 32bpp is the easy one, 4 bytes per pixel and the pitch is always the same as the width.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just wanted to do some tutorials in WPF but I find that the
i have use delphi xe recently but exe size is very big because of
My problem is the comparision of two objects and the strings that they return
Well, I tested TreeMap but it doesn't take in account IgnoreCase on string comparision.
To be clear, I am not asking for a side by side comparision which
Hai guys, I want to know,is memory management a concern with asp.net mvc.. comparision
I am trying to compare a series of strings like the following rodeo rodas
On Windows Mobile metod InternetSetOption http://msdn.microsoft.com/en-us/library/ms918381.aspx does not support option INTERNET_OPTION_HTTP_DECODING is there some
I am trying to compare two decimal values in Java script. I have two
I want to list (a sorted list) all my entries from an attribute called

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.