Capturing from Webcam without preview to the user
-
And how are you going to switch off the Webcam notification itself? You know, the light that appears on the camera when it's in use.
Since all the webcams are inside the cage the light can not be seen by the user.
-
Since all the webcams are inside the cage the light can not be seen by the user.
-
Since all the webcams are inside the cage the light can not be seen by the user.
Ultimately the webcam image is just a stream of bytes. That's all you need to know to work out the rest.
-
Don't worry, the DropBoxes are generally like this and it does not have any illegal elements. And by the way we are actually looking for something where there is no preview - just capture on demand. So, even if the user sees the light of the webcam it really doesn't matter because it actually strengthens his side in case of any dispute unless he claims anything useless (like claiming transaction without dropping the envelop).
-
Ultimately the webcam image is just a stream of bytes. That's all you need to know to work out the rest.
Yes. But how do I do it without showing it on the image control?
-
Yes. But how do I do it without showing it on the image control?
It's a stream of bytes. The image control just renders the bytes out - it's a convenience for you. You don't need it. Think about how you save a stream of bytes instead - that's the key. Forget that the Image Control ever existed.
-
Ultimately the webcam image is just a stream of bytes. That's all you need to know to work out the rest.
Please find below the extarct of my application where the stream is stored in an image control named frameHolder and function SavePic grabs the current frame and save it to disk. frameHolder is shown on the Main Window. Making it invisible captures blank picture. MainWindow.xaml.cs void MainWindow_Loaded(object sender, RoutedEventArgs e) { LoaclWebCamsCollection = new FilterInfoCollection(FilterCategory.VideoInputDevice); LocalWebCam = new VideoCaptureDevice(LoaclWebCamsCollection[0].MonikerString); LocalWebCam.DesiredFrameSize = new System.Drawing.Size(320, 240); //MessageBox.Show(LocalWebCam.DesiredFrameSize.ToString()); LocalWebCam.NewFrame += new NewFrameEventHandler(Cam_NewFrame); LocalWebCam.Start(); } void Cam_NewFrame(object sender, NewFrameEventArgs eventArgs) { BitmapImage bi = new BitmapImage(); try { img = (Bitmap)eventArgs.Frame.Clone(); MemoryStream ms = new MemoryStream(); img.Save(ms, ImageFormat.Bmp); ms.Seek(0, SeekOrigin.Begin); bi.BeginInit(); bi.StreamSource = ms; bi.EndInit(); bi.Freeze(); Dispatcher.BeginInvoke(new ThreadStart(delegate { frameHolder.Source = bi; })); } catch (Exception ex) { MessageBox.Show(ex.Message, "NW CDM Test of Image Capture Failed"); } } Sultan Uz Zaman at 4 hrs ago Reply Modify the comment. Delete the comment. A button click event does the follwoing to save the pic: public static void SavePic(string imageFile) { //Cam_NewFrame(null,null); //image1.Source = frameHolder.Source; //Image frame = frameHolder.Cam_NewFrame(null,null); // Release any previous buffer MainWindow myWin = Application.Current.MainWindow as MainWindow; RenderTargetBitmap bitmap = new RenderTargetBitmap(320, 240, 96, 96, PixelFormats.Pbgra32); bitmap.Render(myWin.frameHolder); using (FileStream stream = File.Create(Global.xImageLocation+"\\"+imageFile)) // or .png { JpegBitmapEncoder encoder = new JpegBitmapEncoder(); encoder.QualityLevel = 90; encoder.Frames.Add(BitmapFrame.Create(bitmap)); encoder.Save(stream); } }
-
It's a stream of bytes. The image control just renders the bytes out - it's a convenience for you. You don't need it. Think about how you save a stream of bytes instead - that's the key. Forget that the Image Control ever existed.
This is where I failed to implement. Can you please share with me a few codes so I could understand the fact to store the stream anything other than the image control and grab the current from that variable?
-
This is where I failed to implement. Can you please share with me a few codes so I could understand the fact to store the stream anything other than the image control and grab the current from that variable?
You already have the code. All you need to do is use a FileStream instead of a MemoryStream to write the bytes out to a file.
-
You already have the code. All you need to do is use a FileStream instead of a MemoryStream to write the bytes out to a file.
Still cannot figure out. Please help the novice.
-
I would like to know if it is possible to develop an webcam application under WPF C# to capture webcam image and save it to disk without showing the preview (showing the content to the user)?
Didn't you just post a code dump about this the other day? If so, what part of the code doesn't work?
"I've seen more information on a frickin' sticky note!" - Dave Kreskowiak
-
Don't worry, the DropBoxes are generally like this and it does not have any illegal elements. And by the way we are actually looking for something where there is no preview - just capture on demand. So, even if the user sees the light of the webcam it really doesn't matter because it actually strengthens his side in case of any dispute unless he claims anything useless (like claiming transaction without dropping the envelop).
Eddy didn't mean illegal activity, but more of the legality of having a person on camera. You may need to have consent from the person or some notification that they are being filmed.
"I've seen more information on a frickin' sticky note!" - Dave Kreskowiak