GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 21-Jul-2004, 14:10
yuhui yuhui is offline
New Member
 
Join Date: Jul 2004
Location: London
Posts: 2
yuhui is on a distinguished road
Question

how to do basic image processing using MFC


hello, I am doing a project about medical image processing now. I have implemented Active Shape Model (ASM) using MatLab, but my supervisor wants me to transfer the codes into C++. The difficulties are image processing and matrix computation. How can I load an BMP image and choose one color channel to make it into gray-level image? And I also need to know the gray-level value for each pixel. Is it possible to do it? Or any library you introduce?

Thanks a lot!!!
  #2  
Old 21-Jul-2004, 19:54
surgio surgio is offline
New Member
 
Join Date: Apr 2004
Posts: 5
surgio will become famous soon enough
hey..

i used VFW library (Video for Windows) in my project. there are heaps of sample code out there using VFW. i suggest u take a look at sample vfw c++ code so u basically know what u need to do to connect to driver, set-up the device.. create bitmap etc.

basically a bitmap consist of pixels (say 320 by 240) and each pixel has 3 colour values - blue green red. These RGB values are put together in a string to form a bitmap.

so say you have got an image called "picture".

then
picture[0] is the blue colour value of first pixel
picture[1] is the green colour value of first pixel
picture[2] is the red colour value of first pixel
picture[3] is the blue colour value of second pixel
and so forth.

so a 320 by 240 bitmap starts from picture[0] and ends at picture[320*240*3 - 1]. if you want to create a grayscale picture, u'd probably need to go through each pixel, average the rgb values and set all 3 values to the average.

ie
picture[0] = (picture[0] + picture [1] + picture[3]) / 3;
picture[1] = (picture[0] + picture [1] + picture[3]) / 3;
picture[2] = (picture[0] + picture [1] + picture[3]) / 3;

picture[3] = (picture[3] + picture [4] + picture[5]) / 3;
picture[4] = (picture[3] + picture [4] + picture[5]) / 3;
picture[5] = (picture[3] + picture [4] + picture[5]) / 3;

and the same for every other pixel..

go on google and search for Video for Windows, Video Capture sample codes in vc++. There should be quite a few. I had heaps of trouble learning vfw.. even now. but sample codes help me understand quite a bit.

vfw commands are on the microsoft msdn website.. so that sorta helps a bit.

also try searching TRIPOD image processing (uses logitech commands (?) not vfw but useful to see how the author deals with pixels) and Lego Mindstorm Video Capture (this one searches for red objects in a bitmap). these probably give u an idea on how to manipulate pixels.

hope what i said was relevant somewhat.. ahaha..
  #3  
Old 22-Jul-2004, 05:34
yuhui yuhui is offline
New Member
 
Join Date: Jul 2004
Location: London
Posts: 2
yuhui is on a distinguished road
Hi, Surgio, thanks so much for your reply... especially the details you give me... u so nice...
I will tell you how I go with it... Thanks a again...
  #4  
Old 22-Jul-2004, 10:43
surgio surgio is offline
New Member
 
Join Date: Apr 2004
Posts: 5
surgio will become famous soon enough
haha.. no worries.
  #5  
Old 07-Aug-2004, 10:19
Teck Wee Teck Wee is offline
New Member
 
Join Date: Aug 2004
Location: Malaysia
Posts: 2
Teck Wee is on a distinguished road

Here you are


Hi, i think u shoud visit this websitehttp://carol.wins.uva.nl/~ghebreab/projects.html
most probably u could find ur things there.
  #6  
Old 08-Aug-2006, 05:43
wilson_asdf wilson_asdf is offline
New Member
 
Join Date: Aug 2006
Posts: 1
wilson_asdf is on a distinguished road

Re: how to do basic image processing using MFC


Hi Yuhui,

As seen from your first email that you have been implemented ASM in matlab. I am currently looking into research on ASM as well. And still confuse on the implementation. Would you mind sharing your idea on ASM? As I am targetting on using it to track person under an open environment, typically the video is of 320x240 size, which means that the person is quite small. Thank you

Wilson
 
 

Recent GIDBlogObservations of Iraq by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing image to folder misunderstood MySQL / PHP Forum 4 17-Jun-2004 07:18
[CONTEST?]Data Structure Test dsmith C Programming Language 2 06-Jun-2004 15:13
Google Adsense introduces targetted image ads Div Advertising & Affiliates Forum 5 23-May-2004 10:59
Problem with image eRIC MySQL / PHP Forum 1 08-Apr-2004 06:22
professional quality image generator jrobbio Graphics Forum 0 27-May-2003 04:45

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 06:01.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.