[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how to convert a jpeg file into a c++ matrix ?

Posted on 2003-12-01
5
Medium Priority
?
1,292 Views
Last Modified: 2012-05-04
hi, i need to convert a jpeg file into a c++ 2D matrix, with each value representing the pixel's greyscale value of the jpeg file. Please help ? Thank you in advance ! =P
0
Comment
Question by:Shifeng
4 Comments
 
LVL 4

Accepted Solution

by:
skypalae earned 252 total points
ID: 9856241
what about http://www.smalleranimals.com/jpegfile.htm ?? is it suitable enough?
S.
0
 
LVL 2

Assisted Solution

by:JensUniweb
JensUniweb earned 248 total points
ID: 9856612
Unother alternative is http://www.ijg.org/. It's a widly spread library first made for for UNIX systems. But are now available on Windwos and other platforms to.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9856663
Convert the JPG into a Bitmap (DIB Section).  Then you can access the pixel data:

    C++ Q&A: Displaying a JPG in your MFC Application -- MSDN Magazine, October 2001
    http://msdn.microsoft.com/msdnmag/issues/01/10/c/default.aspx
    http://msdn.microsoft.com/msdnmag/issues/01/10/c

    OleLoadPicture API call
    http://msdn.microsoft.com/library/en-us/com/htm/ofn_ol2z_0k4l.asp

    SAMPLE: How to Load and Display Graphics Files with LOADPIC.EXE
    http://support.microsoft.com/support/kb/articles/Q218/9/72.ASP

After you have converted it (in memory) and have an HBITMAP, I'll show you how to access the grayscale pixels as (X,Y) of a 2-D array.

-- Dan
0
 
LVL 5

Expert Comment

by:migoEX
ID: 10331438
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split between skypalae,  JensUniweb and DanRollins.

Please leave any comments here within the next four days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

migoEX
EE Cleanup Volunteer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question