From: Jochen F. <Fra...@gm...> - 2008-12-01 08:03:47
|
Hi there again, so, almost a new topic. I try to read an Image, and store the image-data in an array. Then I want to display it on Screen, I use the "CreateBitmap" function. Ok, enough theory, here is the code: //****************************************************************************** vil_image_view<vxl_byte> img2 = vil_load("minivan.tif"); vxl_byte* pixel = new vxl_byte[img2.ni()*img2.nj()*4]; unsigned int nplanes=img2.nplanes(); unsigned int ii=0; // for(int p=0; p<nplanes; p+=1) { for (unsigned int nj=0; nj<img2.nj(); nj+=1) { for(unsigned int ni=0; ni<img2.ni(); ni+=1) { vxl_byte val; val = img2(ni,nj,0); pixel[ii] = val; ii++; val = img2(ni,nj,1); pixel[ii] = val; ii++; val = img2(ni,nj,2); pixel[ii] = val; ii++; } } } int ni = img2.ni(); int nj = img2.nj(); CBitmap bmp; bmp.CreateCompatibleBitmap(pDC,ni,nj); bmp.SetBitmapBits(ni*nj*4,pixel); CDC dcMemory; dcMemory.CreateCompatibleDC(pDC); dcMemory.SelectObject(&bmp); pDC->BitBlt(0, 0, ni, nj, &dcMemory, 0, 0, SRCCOPY); delete [] pixel; //****************************************************************************** (This code runs under MFC) I know it looks a not very fine, cause its the test! The result is not that what I want do have. When I read only Plane <1> and <2> the Bitmap looks a bit nicer, but it's not original, and the new Image has the size of the (1/4) of Original. What's my mistake? How are the RAW-data stored in the "vil_image_view"? Tanks, Ciao Jochen -- Sensationsangebot nur bis 30.11: GMX FreeDSL - Telefonanschluss + DSL für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a |