Click here to Skip to main content
15,887,676 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Loading bitmap in Dialog in OnPaint() Pin
CPallini2-Jun-10 21:36
mveCPallini2-Jun-10 21:36 
Questionconverting visual c++ 6 to visual studio 2010 error message error C1083: Cannot open source file No such file or directory Pin
ywimmer2-Jun-10 15:46
ywimmer2-Jun-10 15:46 
AnswerRe: converting visual c++ 6 to visual studio 2010 error message error C1083: Cannot open source file No such file or directory Pin
Anthony Mushrow2-Jun-10 17:00
professionalAnthony Mushrow2-Jun-10 17:00 
GeneralRe: converting visual c++ 6 to visual studio 2010 error message error C1083: Cannot open source file No such file or directory Pin
ywimmer2-Jun-10 19:52
ywimmer2-Jun-10 19:52 
QuestionHow to get another process Debug Registers of content Pin
notediy2-Jun-10 11:13
notediy2-Jun-10 11:13 
AnswerRe: How to get another process Debug Registers of content Pin
Garth J Lancaster2-Jun-10 12:46
professionalGarth J Lancaster2-Jun-10 12:46 
AnswerRe: How to get another process Debug Registers of content Pin
Stephen Hewitt2-Jun-10 17:05
Stephen Hewitt2-Jun-10 17:05 
QuestionGDI: Create 8bit grayscale bitmap from raw pixel intensity data problem Pin
vkinra2-Jun-10 10:49
vkinra2-Jun-10 10:49 
Hi,

I am reading some image data out of a camera pixels and have extracted the raw pixel intensity. Each "pixel" on the Camera sensor has either a R,G, or B filter that gives the intensity of the 'R', 'G', or 'B' 'pixel'. I read this data and then extract and store the individual R, G, or B pixel intensities into 3 separate 2d unsigned char arrays called m_ptrRed2DPostDecimationArray. m_ptrGreen2DPostDecimationArray, and m_ptrBlue2DPostDecimationArray. Now I can use SetPixel to display the extracted R, G, and B in 3 separate 'R', 'G', or 'B' window areas. I can display them either in color or grayscale through:
For grayscale: dc.SetPixel(j, i, RGB(theApp.m_ptrRed2DPostDecimationArray[i][j], theApp.m_ptrRed2DPostDecimationArray[i][j], theApp.m_ptrRed2DPostDecimationArray[i][j]));
For color: dc.SetPixel(j, i, RGB(theApp.m_ptrRed2DPostDecimationArray[i][j], 0, 0));

However, I realize SetPixel is very ineffecient so looking at other ways to display. I only need the 8 bit grayscale image so was hoping that I could achieve it using CreateBitmap. m_ptrRed2DPostDecimationArray is a BYTE array (actually unsigned char) that holds the 8 bit raw pixel intensities from the camera pixels that have a red filter on them. Here is my current code (that does not work):
void CVC_ExampleDlg::OnPaint()
{
CDC *pDC = GetDC();

BOOL retval = m_redBitmap.CreateBitmap(600, 200, 1, 8, theApp.m_ptrRed2DPostDecimationArray);

CDC memDC;
memDC.CreateCompatibleDC(pDC);
memDC.SelectObject(&m_redBitmap);
retVal = pDC->BitBlt(0, 0, 600, 200, &memDC, 0, 0, SRCCOPY);
memDC.DeleteDC();
ReleaseDC(pDC);
CDialog::OnPaint();
}

Now I know I can create a grayscale palette and use the raw data as an index to that palette but it seems to me that CreateBitmap has that built in functionality. I mean it seems like that when I give it 1 color plane and 8bpp, it should automatically create a grayscale 8bit bitmap, no?

Can anyone see what I'm doing wrong. I mean all I want is that I already have the pixel intensity from 0-255 (8 bit) in a byte array. Since I just only want a grayscale bitmap, creating a grayscale palette and indexing it seems overkill especially when CreateBitmap seems to (theoretically) encapsulate that functionality.

I guess, if my question is clear enough, what is the easiet and/or most efficiect way to create a 8bit grayscale image from the raw pixel intensity value from 0-255?

Thank you,

-Vivek Kinra
AnswerRe: GDI: Create 8bit grayscale bitmap from raw pixel intensity data problem Pin
John R. Shaw2-Jun-10 11:34
John R. Shaw2-Jun-10 11:34 
GeneralRe: GDI: Create 8bit grayscale bitmap from raw pixel intensity data problem Pin
vkinra2-Jun-10 11:57
vkinra2-Jun-10 11:57 
GeneralRe: GDI: Create 8bit grayscale bitmap from raw pixel intensity data problem Pin
John R. Shaw2-Jun-10 13:29
John R. Shaw2-Jun-10 13:29 
QuestionShort Circuit Evaluation Pin
bob169722-Jun-10 6:47
bob169722-Jun-10 6:47 
AnswerRe: Short Circuit Evaluation PinPopular
Luc Pattyn2-Jun-10 7:39
sitebuilderLuc Pattyn2-Jun-10 7:39 
GeneralRe: Short Circuit Evaluation Pin
bob169722-Jun-10 9:57
bob169722-Jun-10 9:57 
GeneralRe: Short Circuit Evaluation Pin
Luc Pattyn2-Jun-10 10:00
sitebuilderLuc Pattyn2-Jun-10 10:00 
GeneralRe: Short Circuit Evaluation Pin
Tim Craig2-Jun-10 16:46
Tim Craig2-Jun-10 16:46 
GeneralRe: Short Circuit Evaluation Pin
Stephen Hewitt2-Jun-10 17:07
Stephen Hewitt2-Jun-10 17:07 
QuestionHow much Memory my App uses? Pin
Software20072-Jun-10 5:00
Software20072-Jun-10 5:00 
AnswerRe: use GetProcessMemoryInfo Pin
Software_Developer2-Jun-10 5:09
Software_Developer2-Jun-10 5:09 
AnswerRe: How much Memory my App uses? Pin
Maximilien2-Jun-10 5:09
Maximilien2-Jun-10 5:09 
AnswerRe: How much Memory my App uses? Pin
Nuri Ismail2-Jun-10 5:12
Nuri Ismail2-Jun-10 5:12 
GeneralRe: How much Memory my App uses? [modified] Pin
Software20073-Jun-10 6:01
Software20073-Jun-10 6:01 
QuestionRe: How much Memory my App uses? Pin
David Crow3-Jun-10 7:32
David Crow3-Jun-10 7:32 
GeneralRe: How much Memory my App uses? Pin
Nuri Ismail3-Jun-10 7:54
Nuri Ismail3-Jun-10 7:54 
GeneralRe: How much Memory my App uses? Pin
Software20073-Jun-10 9:56
Software20073-Jun-10 9:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.