|
Well said cederic, but as said by toxcct, she's been a real nonsense
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
VuNic wrote: Yup! Did you check your mail buddy??
Which mail Buddy!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Which "Which mail" buddy ?
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
VuNic wrote: Which "Which mail" buddy ?
Mail you mention in your post
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Cedric Moonen wrote: Everybody is doing mistakes, it's not something to be ashamed of.
You are WRONG! It is something to be ashamed of!
Wait ... no you are correct, my mistake :->
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Hallo guys,with in 12 hrs you r people getting very tensed. Really iam very sorry...Yesterday I posted my question...But within 3 seconds i found out my mistake and i got solution.Thts why i deleted my message.When i deleted my question there was no answer.Thats why i deleted my question.
Just i deleted BOOL in front of the function call.I got solution.
Really Im very sorry, iam not selfish and nonsense...OK...
|
|
|
|
|
Hi,
What is good starting point to learn about RAS API's for Win2k (or) Does MFC contains RAS API's? Suggest me good book which teaches. Is RAS API's differ from OS to OS. I have to work on dial-up networking project which uses RAS API's.
|
|
|
|
|
subramanyeswari wrote: Does MFC contains RAS API's?
No.
The Remote Access Service Reference[^] might help.
also found this codeproject article[^] there may be more. Try Google.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Greetings.
I have modified the code from the Simultaneous Previewing & Video Capture using DirectShow written by Sivasagar K.R in www.codeguru.com (see below). When I run it, it uses the *ptr pointer to render the pixels on screen, but I want to analyse the pixels for each frame, rendering the analysed pixels.
In essence, I want to save the pixels (as I do in the array CurImaArr) and then do some analysis on them, maybe change some values, and then render them. Any ideas on how to do so?
Your help would be very much appreciated.
bool CVMR_Capture::Convert24Image(BYTE *p32Img, BYTE *p24Img,DWORD dwSize32)<br />
{<br />
<br />
if(p32Img != NULL && p24Img != NULL && dwSize32>0)<br />
{<br />
<br />
DWORD dwSize24;<br />
<br />
dwSize24=(dwSize32 * 3)/4;<br />
<br />
BYTE *pTemp,*ptr;<br />
pTemp=p32Img;<br />
<br />
ptr=p24Img + dwSize24-1 ;<br />
<br />
int ival = 0;<br />
int count = 0;<br />
int witth = 1;<br />
int hite = 0;<br />
int hites = 120;<br />
int greens = 0;<br />
for (DWORD index = 0; index < dwSize32/4 ; index++)<br />
{ <br />
unsigned char r = *(pTemp++);<br />
unsigned char g = *(pTemp++);<br />
unsigned char b = *(pTemp++);<br />
(pTemp++);
if ((witth <= 320) && (hite < 240))<br />
{<br />
CurImaArr [witth-1][hite] = g;<br />
}<br />
else<br />
{<br />
return false;<br />
} <br />
<br />
<br />
<br />
<br />
<br />
if (g > 150)<br />
{<br />
greens++;<br />
}<br />
<br />
<br />
*(ptr--)= 0;
*(ptr--)= CurImaArr [witth-1][hite];
*(ptr--)= 0;
<br />
witth++;<br />
<br />
if (witth >= 320)<br />
{<br />
witth = 1;<br />
hite++;<br />
}<br />
<br />
<br />
}<br />
<br />
<br />
}<br />
else<br />
{<br />
return false;<br />
}<br />
<br />
return true;<br />
}
|
|
|
|
|
Lessthannovice wrote: it uses the *ptr pointer to render the pixels on screen
Actually it doesn't. You can't use this method to do what you want. Build a filter graph with the Sample Grabber filter instead.
|
|
|
|
|
Thanks for the clarification.
I have done the following:
int count1;
int count2;
ptr = p24Img + dwSize24-1 ;
for (count2 = 0; count2 < 239 ; count2++)
{
for (count1 = 0; count1 < 319; count1++)
{
*(ptr--) = 0;
*(ptr--) = CurImaArr[count1][count2];
*(ptr--) = 0;
}
}
After the "for" loop, and within the "if" "section". It renders the image fine. I thought I could manipulate the array and then use it to render the image. I expect there is a much better way of doing it (and in better programming way) - any suggestions welcome - but for me, any step I take in this language/project feels like a combination of IQ test and unsolvable puzzle.
"Build a filter graph...instead" : easier said than done. I'll look into it, but any suggestions are welcome.
Finally, I would like to thank you for your continuous help and support.
|
|
|
|
|
I have reread your previous message and perhaps I have misunderstood your problem. If you only need to perform analysis on a particular image capture, and not all the images on your webcam, then this approach would work. And if by render, you mean not by the video renderer, but by displaying as a bitmap in a static control.
You would not want to perform your analysis / manipulation in the Convert24Image function as this only runs when the image is 32-bit, and I can't really find any indication that this is always true. You might want to do it in GrabFrame() instead.
Building filter graphs is much easier when working with the ICaptureGraphBuilder2 interface.
|
|
|
|
|
My aim is to detect if a particular event has occurred in the current frame. If it has then I want to analyse (basically delineate) the event, and clear the picture from "noise".
Thanks for the GrabFrame() suggestion. I had not thought of it and it is a valid point.
I am not familiar with the ICaptureGraphBuilder2 interface, but I will have it in mind for the future.
My aim now is to be able to save an array of an image in which an event has occurred (ideally with a dialogue box offering the user the option of saving or not) and be able to retrieve the array and show the image on screen. Also, I am thinking of doing all the "analysis" in a separate function (instead of GrabFrame() or Convert24Image() ). Any suggestions welcome.
It's a slow and involved process, but I am learning a lot, and every time I achieve a little bit more feels great.
Again, I appreciate your help so far.
|
|
|
|
|
Of course having the analysis in a separate function is better.
I'm not sure what you mean by save an array of an image. The RGB24 image data is saved in m_pFrame after a call to GrabFrame().
Am I understanding correctly that what you want is for the user to click the capture button, capture the image, and click another button to analyse this image? I'm asking because you won't be able to monitor all frames using this method.
His current image capture only saves the RGB24 image data without the header. If you want to save a bitmap you would need to write the BITMAPFILEHEADER and the BITMAPINFOHEADER before you write the image data.
|
|
|
|
|
By array of the image I mean CurImaArr() - the array I save all the pixels in. I am more comfortavle dealing with the array than with bitmaps at the moment.
I;ve already written some code that determines which frames (or, rather, which frame's array) to save. I just don't know (yet) how to actually save the array, or give the user the option of saving it or not...
My apologies if I am not using proper terminology. Also, I may be a bit confusing due to me trying to think within the limited frame of my C++ knowledge. I will endeavour to be more clear in the future.
-- modified at 13:36 Thursday 11th May, 2006
|
|
|
|
|
Instead of working with your pixel data in terms of BYTE*, it would be easier to work with RGBTRIPLE*/RGBQUAD* instead.
It's ok, as long as you understand that you are not monitoring all frames (Unless the frame rate of your webcam is particularly slow). The code is polling using a timer (WM_TIMER message) set to 10 millisecs, to grab a copy of the image data currently in the VMR filter.
The call to GrabFrame() overwrites m_pFrame with the latest copy of image data from the VMR renderer. If you would like to have a copy of m_pFrame you could just do a memory copy before the next call to GrabFrame(). Look at the OnTimer handler in DXCaptureDlg.h line 191.
Your terminology is fine, it's just that with all these technical terms it can be a little ambigious sometimes.
|
|
|
|
|
The reason I am using C++ for this "project" is because of the speed. It is important to monitor as many frames as possible.
Your GrabFrame() comment has clarified a little bit more, and has certainly given me ideas. For the moment I am concentrating on figuring out how to save and retrieve the array I have mentioned.
I appreciate your help. It has made my C++ start a lot smoother than it would otherwise have been.
|
|
|
|
|
If you would like to monitor all the frames, then this isn't the correct approach. You should be building a filter graph with the Sample Grabber instead.
Capture Device -> Sample Grabber -> Video Renderer
The Sample Grabber filter will do a callback for every sample it receives from the upstream filter.
|
|
|
|
|
is it possible to convert the RGBA from the firewire camera into a grayscale image and display it to a CStatic.SetBitmap?? can u help me?
bye
|
|
|
|
|
I am afraid I can't help you with this,but I have a feeling hfry might. Good luck.
|
|
|
|
|
Am I not monitoring all frames with this approach (given the initial frame is 32-bit)?
I'll be leaving for an extended trip next week, so I need to wrap this "project" up today or tomorrow, which doesn't leave me much time to "develope" a new -to me- way of doing this, hence I think I'll stick with it for the time being. I'll be using the time today and tomorrow attempting to build a save image dialogue box. Any help in this area would be welcome.
I hope to benefit from your advice again as of mid-June, when I pick this up again.
Thanks for the advice so far.
|
|
|
|
|
If your webcam captures at a decent framerate, you won't get all the frames as the code is getting the frames by polling at 10 millisecond intervals. This approach isn't suitable anyway if the intent was to get all the frames.
You can just use the file dialog box provided by Windows, look at CFileDialog with bOpenFileDialog = FALSE.
http://www.functionx.com/visualc/controls/filedialog.htm[^]
If you would like to save the RGB24 image data without headers, I don't see much of a problem as the code is already there. If you would like to save it as a bitmap that other applications can read, then you would have to write the appropriate bitmap headers before writing your image data.
|
|
|
|
|
A slight problem has been encountered. I tried the code with several different cameras and it doesn't work with some of them. A friend suggested it's because some do not encode in RGB but encode in IA20 or something akin to that. Any ideas?
|
|
|
|
|
IA20? Are you perhaps referring to some YUV media subtype like I420?
Failed as in? Cannot create the graph? Cannot get the current image off the VMR filter? Use GraphEdit and build the graph and see if it's possible.
|
|
|
|
|
Yes, I am sorry, I420 sounds more like it. The Live Video renders fine, but the Capture window is blanc. I will follow your suggestion. Thanks.
If it is YUV, how do I translate it into RGB?
|
|
|
|