Click here to Skip to main content
15,894,291 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Remove Pin
David Crow21-Jan-04 6:55
David Crow21-Jan-04 6:55 
GeneralRe: Remove Pin
Anonymous21-Jan-04 7:28
Anonymous21-Jan-04 7:28 
GeneralRe: Remove Pin
David Crow21-Jan-04 7:56
David Crow21-Jan-04 7:56 
GeneralDrag and Drop from Outlook Pin
Steve Thresher21-Jan-04 5:47
Steve Thresher21-Jan-04 5:47 
GeneralShellOpen Pin
Gary Kirkham21-Jan-04 5:45
Gary Kirkham21-Jan-04 5:45 
GeneralRe: ShellOpen Pin
Antti Keskinen21-Jan-04 5:55
Antti Keskinen21-Jan-04 5:55 
GeneralRe: ShellOpen Pin
Gary Kirkham21-Jan-04 5:59
Gary Kirkham21-Jan-04 5:59 
QuestionHow to threshold an image? Pin
uus9921-Jan-04 5:41
uus9921-Jan-04 5:41 
Hi there, i'm doing image processing in VC++6. How can i perform thresholding (converting color to b&w) on an image, as fast as possible? I'm able to do using GetPixel & SetPixel but it is too slow. Anyway i can access the pixels directly??

Here is the code

//Image width=height=Big=360 px
int Big=360;

//Create a DC for buffering image
CDC MemDC,*pDC;
CBitmap MemBitmap;

// Get Current DC from dialog box,
pDC = myDlg->GetDC();

MemDC.CreateCompatibleDC(pDC);
//
MemBitmap.CreateCompatibleBitmap(pDC,Big,Big);
CBitmap *pOldBitmap = MemDC.SelectObject(&MemBitmap);


//------------custom hardware function that draws image from camera to DC-----------//
imgPlot ((GUIHNDL)MemDC.GetSafeHdc(), (void *)ImaqBuffer, 0, 0, Big, Big, 410, 10, plotFlag));
//-------------------------------------------

//My thresholding function, which is very slow!!!
//check every pixel, if it is bigger than threshold then turn it black
//and white otherwise
//**********
for(int i=0;i<360;i++)
for(int j=0;j<360;j++)
{

if(MemDC->GetPixel(i,j)<=RGB(64,128,255))
MemDC->SetPixel(i,j,RGB(0,0,0));
else
MemDC->SetPixel(i,j,RGB(255,255,255));
}

pDC->BitBlt(10,10,Big,Big,&MemDC,0,0,SRCCOPY); //See Note 3
MemDC.SelectObject(pOldBitmap);


//---------------------------


The code is too slow for real time. How can i do thresholding faster?
AnswerRe: How to threshold an image? Pin
J. Eric Vaughan21-Jan-04 6:24
J. Eric Vaughan21-Jan-04 6:24 
GeneralRe: How to threshold an image? Pin
uus9921-Jan-04 23:25
uus9921-Jan-04 23:25 
GeneralRe: How to threshold an image? Pin
J. Eric Vaughan22-Jan-04 6:01
J. Eric Vaughan22-Jan-04 6:01 
GeneralRe: How to threshold an image? Pin
uus9922-Jan-04 8:42
uus9922-Jan-04 8:42 
GeneralRe: How to threshold an image? Pin
J. Eric Vaughan22-Jan-04 10:58
J. Eric Vaughan22-Jan-04 10:58 
GeneralRe: How to threshold an image? Pin
uus9922-Jan-04 18:12
uus9922-Jan-04 18:12 
GeneralRe: How to threshold an image? Pin
J. Eric Vaughan23-Jan-04 3:59
J. Eric Vaughan23-Jan-04 3:59 
GeneralRe: How to threshold an image? Pin
uus9923-Jan-04 23:00
uus9923-Jan-04 23:00 
AnswerRe: How to threshold an image? Pin
John M. Drescher21-Jan-04 9:51
John M. Drescher21-Jan-04 9:51 
AnswerRe: How to threshold an image? Pin
cmk21-Jan-04 9:51
cmk21-Jan-04 9:51 
AnswerRe: How to threshold an image? Pin
uus9921-Jan-04 16:30
uus9921-Jan-04 16:30 
AnswerRe: How to threshold an image? Pin
Ryan Binns21-Jan-04 17:28
Ryan Binns21-Jan-04 17:28 
Questionthe system protect in 2k and xp ?? Pin
Anonymous21-Jan-04 4:47
Anonymous21-Jan-04 4:47 
AnswerRe: the system protect in 2k and xp ?? Pin
Matt Newman21-Jan-04 5:40
Matt Newman21-Jan-04 5:40 
AnswerRe: the system protect in 2k and xp ?? Pin
Antti Keskinen21-Jan-04 5:42
Antti Keskinen21-Jan-04 5:42 
GeneralBest way to display a text file as a resource Pin
doctorpi21-Jan-04 4:06
doctorpi21-Jan-04 4:06 
GeneralRe: Best way to display a text file as a resource Pin
Roger Allen21-Jan-04 4:42
Roger Allen21-Jan-04 4:42 

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.