473,383 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Image processing

Hi,
I'm working with images in Visual C++ and I need a fast method to access to individual pixels of an image. Actually I'm using the GetPixelAddress method of the Image class, but it's too slow.
Thanks for all.

Nov 17 '05 #1
2 1063
Hi,

Look at LockBits - it allows you to get a BitmapData object which has a
property called Scan0, which refers to the address of the first pixel in the
section of the image you've specified. Then you can happily iterate through
the data.

HTH,

Steve

"Antonio Gómez" <An*********@discussions.microsoft.com> wrote in message
news:5C**********************************@microsof t.com...
Hi,
I'm working with images in Visual C++ and I need a fast method to access to individual pixels of an image. Actually I'm using the GetPixelAddress
method of the Image class, but it's too slow. Thanks for all.

Nov 17 '05 #2
This is indeed true. You can work this out by looking at the PixelFormat,
though if you cast the pointer when you get it it isn't an issue, e.g.

// case when it's 8 bit
uint8 *data = (uint8 *)bitmapData->Scan0;

// 16 bit
uint16 *data = (uint16 *)bitmapData->Scan0;

Then data++ iterates properly whatever you do. As another note,
BitmapData::Stride returns a number in bytes, not in pixels, so watch for
that.

Note: How you iterate though the bytes will be different for 8 bit versus 16 bit images.
"Steve McLellan" wrote:
Hi,

Look at LockBits - it allows you to get a BitmapData object which has a
property called Scan0, which refers to the address of the first pixel in the section of the image you've specified. Then you can happily iterate through the data.

HTH,

Steve

"Antonio Gómez" <An*********@discussions.microsoft.com> wrote in message
news:5C**********************************@microsof t.com...
Hi,
I'm working with images in Visual C++ and I need a fast method to
access to individual pixels of an image. Actually I'm using the GetPixelAddress
method of the Image class, but it's too slow.
Thanks for all.


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Deepa | last post by:
Hi All, I'm facing problem displaying image of size 5000X5000 .My window size is smaller than image size so i'm not able to see the complete image.i can use scroll bars to view the image but i...
1
by: jasonshohet | last post by:
I read recently that: "if a before-image was made before an interruption in database processing, you use the before-image dump & simply begin processing again from just before the last...
5
by: Jigar Mehta | last post by:
Hye Friends!!, Happy New Year!! I am Jigar Mehta from India. Currently I am working on a project in which I need to compress some images on the harddisk... I want to make an engine that reads...
2
by: | last post by:
Hi, we are planning to rewrite an extisting C++ image processing application/library in C#. Now several question arouse where I hope you can help me: So far we allocated a block of memory as...
10
by: stonny | last post by:
Hi, I am converting my matlab program into C/C++. I need to change some image processing toolbox functions into C/C++, such as edge detection, mathematical morphology. Is there any place that I...
10
by: Enrique Cruiz | last post by:
Hello all, I am currently implementing a fairly simple algorithm. It scans a grayscale image, and computes a pixel's new value as a function of its original value. Two passes are made, first...
3
by: birensubudhi | last post by:
hey guys,can anyone tell me what is image processing, how to do it using C. IN KSHITIJ 2007 held at IIT kgp a que by INFOSYS is asked, they hav given an image then cut in different orientation...
2
by: Peter Oliphant | last post by:
The Image class allows loading a bitmap from a graphic file. So far I've gotten it to work with JPG and BMP files. What other graphic file formats are supported in this way? Is this fixed based...
5
by: whisk3rs | last post by:
Hello, I have a conceptual question. I need to write a program that will take as input a list of images and then process each image individually (extract useful features from the image) ...
0
by: tavares | last post by:
(Our apologies for cross-posting. We appreciate if you kindly distribute this information by your co- workers and colleagues.) ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.