|
A couple of data blocks with BITMAPHEADER (40,176,144,1,24,0,76032,0,0,0,0)and (40,176,144,1,12,808596553,38016,0,0,0,0) . How should I display this two blocks ?
Thanks
|
|
|
|
|
Mmmm,
First thing... Do you mean BITMAPHEADER or BITMAPINFOHEADER???
One way is to get the parameters of the structures one per one and formating a CString to have the value in. Then display as you want. I.E:
BITMAPINFOHEADER bmi;
CString szSize = "", szWidth = "", szHeight = "";
szSize.Format (_T("%d"), bmi.biSize);
szWidth.Format (_T("%d"), bmi.biWidth);
Now you can put the parameters on the screen, AfxMessageBox (), save them...
Hope it helps (and it is what you were asking for, if not... explain it better :P )
Edit: I forgot to close a () in the code
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Oh,thanks.But I know the format,these are two different format DIB(from the header). What I want to do is display the two different images.
|
|
|
|
|
That mode is supported on pretty much all video capture drivers.
An example how to set that mode:
LONG lWidth = 176
LONG lHeight = 144;
WORD wBitsPerPixel = 24;
BITMAPINFO BitmapInfo;
memset(&BitmapInfo, 0, sizeof(BITMAPINFO));
BitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
BitmapInfo.bmiHeader.biWidth = lWidth;
BitmapInfo.bmiHeader.biHeight = lHeight;
BitmapInfo.bmiHeader.biPlanes = 1;
BitmapInfo.bmiHeader.biBitCount = wBitsPerPixel;
BitmapInfo.bmiHeader.biCompression = BI_RGB;
BitmapInfo.bmiHeader.biSizeImage = (DWORD)((((lWidth * (long)wBitsPerPixel + 31L) & (~31L)) / 8L) * lHeight);
capSetVideoFormat(m_capwnd, &BitmapInfo, sizeof(BITMAPINFO));
To display an image (or a video frame) in that format, the easiest way is with a StretchDIBits.
You have the format (BITMAPINFO) - all you need to do is call StretchDIBits passing as the lpBits
parameter a pointer to the bitmap/video frame pixel data.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I am sorry,that codes could not work remainly. It would fail at capSetVideoFormat function.
My video seems doesn't surport such format,it using I420 biCompression.
|
|
|
|
|
kcynic wrote: it using I420 biCompression
What kind of device is it? You'll need a decompressor to view it then, right?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
biCompression=808596553
biSizeImage=38016
and other values are equal to your given/
|
|
|
|
|
Right - you need to display that bitmap data? If so, it needs to be decompressed to a
displayable format.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Yes,I should display it.Because one divece on a computer capture such data and translate to another to show.
But I don't know how to decompress the data.
|
|
|
|
|
Since you are using VFW, probably the easiest way to decompress the frames is with the
Video Compression Manager[^]. The section "Using the Video Compression Manager[^]"
documents the necessary steps and has sample code for each step.
I'm not sure if an I420 codec comes with Windows or if you need a third-party one. If you have a
codec that isn't a VCM codec you could use that of course
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
If I declaration a string like this:
<br />
char str[8] = {0};<br />
<br />
cout << sizeof(str) << endl;
But if I use new expression created a string in heap, for example
<br />
char* s = new char[8];<br />
<br />
cout << sizeof(s) << endl; <br />
So, how can get the size of string by use the new expression? Thanks!
|
|
|
|
|
try _msize() function.
nave
|
|
|
|
|
_msize is not standard. This may or may not be an issue.
Steve
|
|
|
|
|
not standard?Why you say so?Can u pls explain?
nave
|
|
|
|
|
Probably because of the leading underscore.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Do a Google search for _msize standard[^] and you'll find plenty of info. Essentially it's not officially part of C++.
Steve
|
|
|
|
|
hi steve,
None of them specifies about the _msize() implementation in vc++. And I know how this is implemented in vc++ 6( you can find it out just by steping into the CRT codes ). Please check it and then tell me is there any thing wrong in using it.
nave
|
|
|
|
|
As far as I know there is no problem with using it. I don't use it myself and never would so I can't guarantee this. If all you care about is MSVC then the fact that it’s non-standard will not concern you.
Steve
|
|
|
|
|
Why not simply use strlen ? If this is a standard NULL terminated string, that's the way to go.
EDIT: I just saw the answer of Naveen and I'm wondering what you want to know exactly: the number of characters in the string (it will stop at the NULL termination wihtout counting it) or the size of the memory block allocated ? For the latter, then check the post of Naveen.
|
|
|
|
|
My compiler is Visual C++ 6.0. This compiler can use the _msize function.
Now, my problem has been solved.
|
|
|
|
|
hanlei0000000009 wrote: So, how can get the size of string by use the new expression? Thanks!
One possibility is to look at the 32 bits preceding the address returned from new . This may be what _msize() is doing internally but with some extra stuff.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I want to capture and translate video data from one computer to another.I use VFW,but different computers and drivers surport different fomats and mode. How should I deal such difference?
BEST REGARDS
|
|
|
|
|
A couple of data blocks with BITMAPHEADER (40,176,144,1,24,0,76032,0,0,0,0)and (40,176,144,1,12,808596553,38016,0,0,0,0) . How should I display this two blocks ?
Thanks
|
|
|
|
|
See here[^]
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi,
I created a shell extension that shows a dialog(MFC). The dialog have a list control and i tried to implement the sort functionality in it. The problem is when I call the ListView_SortItems or ListView_SortItemsEx of the list control, after the first call back returned from my application an exception is coming.
Any solution for this?
Thanks
Naveen
|
|
|
|