Thanks for the reply.
As far as ItmmCapture, I do need both the original size (1600x1200) and the smaller size. I create two separate, compressed data stream that I use elsewhere in the program. Not sure that zoom will allow me to do this?
Also, I tried using the RasterImage constructor but I get the following error:
System.AccessViolationException was caught
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Source="Leadtools"
StackTrace:
at L_MemoryCopy(Void* , Void* , UInt32 ) at LT_Namespace.L_CopyMemory(Byte* dest, Byte* src, UInt32 count) at L_ResizeBitmap(_BITMAPHANDLE* , _BITMAPHANDLE* , UInt32 ) at Leadtools.ImageProcessing.ResizeCommand.RunCommand(RasterImage image, IntPtr bitmap, RasterImageChangedFlags& changedFlags) at Leadtools.ImageProcessing.RasterCommand.Run(RasterImage image) at SoVideoConf2.VideoConference.GrabDxFrame() in C:\Documents and Settings\User\Desktop\ALL NEW\My Projects\SoVideoConf2\SoVideoConf2\VideoConference.vb:line 724
InnerException:
Here is the code that is capturing the image (simplified and error handling removed). Can you tell me if I am doing something wrong here?
== Capture code (Managed C++) ==
System::IntPtr hBitmap
void *Hbuffer;
Hbuffer = NULL;
// Get a pointer to the video header.
VIDEOINFOHEADER *pVideoHeader = (VIDEOINFOHEADER*)DX.MediaType.pbFormat;
// The video header contains the bitmap information.
// Copy it into a BITMAPINFO structure.
BITMAPINFO BitmapInfo;
ZeroMemory(&BitmapInfo, sizeof(BitmapInfo));
CopyMemory(&BitmapInfo.bmiHeader, &(pVideoHeader->bmiHeader), sizeof(BITMAPINFOHEADER));
// Create a DIB from the bitmap header, and get a pointer to the buffer.
HBITMAP hBitmap = CreateDIBSection(0, &BitmapInfo, DIB_RGB_COLORS, &Hbuffer, NULL, 0);
// Copy the image into the buffer.
long Size = (DX.cbBuffer);
DX.pSampleGrabber->GetCurrentBuffer(&Size, (long *)Hbuffer);
long Width = pVideoHeader->bmiHeader.biWidth;
long Height = pVideoHeader->bmiHeader.biHeight;
== Try to use it (VB.NET) ==
Dim ltRaster As Leadtools.RasterImage = Nothing
ltRaster = New Leadtools.RasterImage(Leadtools.RasterMemoryFlags.User, Width, Height, 24, RasterByteOrder.Rgb, RasterViewPerspective.BottomLeft, Nothing, hBitmap, Size)
Dim resizeCommand As New Leadtools.ImageProcessing.ResizeCommand
resizeCommand.Flags = RasterSizeFlags.Resample
resizeCommand.DestinationImage = New RasterImage(RasterMemoryFlags.Conventional, 320, 240, ltRaster.BitsPerPixel, ltRaster.Order, ltRaster.ViewPerspective, ltRaster.GetPalette, IntPtr.Zero, 0)
resizeCommand.Run(ltRaster)
-- Run throws the exception