|
can you tell me the company name of your webcam you are using as might be its bot working with Logitech and Creative Webcam...here is the link which uses Directx Library to interact with webcam and seems to be working with any webcam....hope it will work for you
http://www.developersdex.com/gurus/code/563.asp
|
|
|
|
|
Don't forget to register with regsvr32.exe the AxCamClient.dll in the 'COM Components' directory. How do you do this?
|
|
|
|
|
<a href="" rel="nofollow"></a>
|
|
|
|
|
run/cmd, go to the directory and type regsvr32.exe AxCamClient.dll
|
|
|
|
|
I have two usb webcams, i there any way to specify from which the frame is to be grabbed?
|
|
|
|
|
With the current code it is not possible. But you might change the CamServer.dll to handle that case.
Best Regards,
Laurent Kempé [Microsoft .NET MVP]
Visit my web site Tech Head Brothers.
---
Old programmers never die, they just branch to a new address.
|
|
|
|
|
oh..i have tested recently with xp pro, vsnet2003 and logitech quickcam.
when i press invoke, with value 15, the below coding appear.
<base64binary xmlns="http://tempuri.org/">/9j/4AAQSkZJRgABAQEAYABgAAD/4QBZRXhpZgAASUkqAAgAAAABAGmHBAABAAAAGgAAAAAAAAAB AIaSAgApAAAAKAAAAEludGVsKFIpIEpQRUcgTGlicmFyeSwgdmVyc2lvbiAxLDUsNCwzNgAA/9sA QwAIBgYHBgUIBwcHCQkICgwUDQwLCwwZEhMPFB0aHx4dGhwcICQuJyAiLCMcHCg3KSwwMTQ0NB8n OT04MjwuMzQy/9sAQwEJCQkMCwwYDQ0YMiEcITIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy MjIyMjIyMjIyMjIyMjIyMjIyMjIy/8AAEQgA8AFAAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAA AAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQy gZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVm Z2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS 09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYH CAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1Lw FWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5 eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj 5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A838P2+gX5a2vtP1Np4rS5uXmg1CONW8qKSUK EMDEZCBc7j1z7U+DQ7XXNIvr7RrO4tvstxbxOLy/iaNFdZyzvIUjVBmONRnHLYySwAytGv4tOu55 pVdlksbu3AQDO6W3kjXqRxucZ9s9aI76JPDV3prI5mnvra4VsDaFjjnU55znMq447Gv0CtCuqsnT k/s26rWT5vkl9xypq2o6PQNUkuLW3Fm6z3V41jFHIQjGdSgZCCQVIMiDnA59jh8XhvVprSxu0tR9
Anyone got idea why is this happen? How to solve it?>
|
|
|
|
|
Excuse me..
My Englsih is not excellent.I am korean and beginer for programing ^^
What i want to ask is this....
First of all, i made an application by "WebForm" based on C#~~~ and i put on "UserControl"on the Webform.
When i connected to the service at the explore of the other computer, i couldn't see the "UserControl" .....
Do you know how to putout the "UserControl" ?
Although it's hard to understand my saying, could you give me some advice?
Have a good time bye...
|
|
|
|
|
Does anyone know where can I get some documentation or information about CamServer? I´m using this dll and until now I didn´t have any problems. I proved with Logitech and Creative webcams, but now I´m using a Creative WebCam Pro and I can´t get an image (The image is all black). I´m trying to figure out why, so I´ve been reading about graphics and images in .NET, but I think some documentation about the dll can help too.
Thanks.
Balu
|
|
|
|
|
Hi Balu,
I am using the Logitech webcam, but the image is all black (just like your problem with the creative webcam). Have you found any solution for your Creative Webcam yet?
Thanks,
Tang
|
|
|
|
|
Hi tang,
I couldn´t find a solution for that problem using de CamServer.dll. I found something that helped me.
http://www.developersdex.com/gurus/code/563.asp
This project uses DirectX to get a picture from a webcam (seems to be any webcam). I had some problems usign this, because I couldn´t get a second picture from the webcam without closing the application. I couldn´t find a solution to the problem so I raise an application that takes the picture, saves it to a file an closes, I know that´s not the way it has to be, but I had a little hurry to solve the camara problem.
I hope this information helps you. Any comments feel free to reply.
Thanx and happy coding...
Balu.
|
|
|
|
|
Hi am trying to capture image using GrabFrame () using VB in ASP.NET. I am also using logitech camera to capture image .it blinks for 1 o2 sec then it gives me following error.
I did not find solution for this problem. suggest me if u find something
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: ERROR GrabFrame().
Source Error:
Line 22: Dim cam As CAMSERVERLib.Camera = New CAMSERVERLib.CameraClass()
Line 24: Dim picture As Byte() = cam.GrabFrame(nQuality)
Line 25:
Line 26: 'Add the hour to the jpeg picture
Line: 24
Here is my code
Imports System
Imports System.IO
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Imports System.Net
Imports System.Diagnostics
Imports DirectShowLib
Imports System.Runtime.InteropServices.ComTypes
Partial Class CapturePhoto
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Jpeg compression quality
Dim nQuality As Short = 45
'Shout a picture from my webcam
Dim inval As Object
Dim obj As Object
inval = New System.Runtime.InteropServices.DispatchWrapper(Nothing)
Dim cam As CAMSERVERLib.Camera = New CAMSERVERLib.CameraClass()
Dim picture As Byte() = cam.GrabFrame(nQuality)
'Add the hour to the jpeg picture
Dim ms = New MemoryStream(picture)
Dim bmp As New Bitmap(ms)
Dim g As Graphics = Graphics.FromImage(bmp)
Dim strDate As String = DateTime.Now.ToLongDateString() + " - " + DateTime.Now.ToLongTimeString()
Dim drawFormat As New StringFormat()
drawFormat.Alignment = StringAlignment.Center
g.DrawString(strDate, New Font(FontFamily.GenericSansSerif, 12), New SolidBrush(Color.Black), New RectangleF(1, 1, 320, 240), drawFormat)
g.DrawString(strDate, New Font(FontFamily.GenericSansSerif, 12), New SolidBrush(Color.White), New RectangleF(0, 0, 320, 240), drawFormat)
'Get codecs
Dim icf As ImageCodecInfo() = ImageCodecInfo.GetImageEncoders()
Dim encps As New EncoderParameters(1)
Dim encp As New EncoderParameter(System.Drawing.Imaging.Encoder.Quality, CLng(nQuality))
'Set quality
encps.Param(0) = encp
bmp.Save(Response.OutputStream, icf(1), encps)
g.Dispose()
bmp.Dispose()
End Sub
End Class
|
|
|
|
|
Hi
may I know how to add a reference to 'CamServer 1.0 Type Library' on the COM tab'. i cant find the com tab.
Thanks alot..
Good day
grazie
|
|
|
|
|
Hi
I'm wondering if C# .NET can create a webcam web service, is it achievable for other languages such as Java? Does anyone know of any website which consists of the source code which I can reference from?
Thanks alot!
Good Day!
Grazie
|
|
|
|
|
Hola Necesito para mi proyecto de fin de carrera una funcion, rutina o lo que sea q me capture imagenes de la camara web y me la convierta en una matriz d informacion en c# Muchas gracias a quien pueda ayudarme mi mail es lnacv@everyday.com
|
|
|
|
|
Lo siento, pero este foro es en inglés. Es educado escribir en inglés para todo el mundo se puede beneficiar del intercabio de la información.
Sorry, but this forum is in English. It is polite to write in English so that everyone can take advantage of the exchange of information.
Lnacv wrote:
Hola Necesito para mi proyecto de fin de carrera una funcion, rutina o lo que sea q me capture imagenes de la camara web y me la convierta en una matriz d informacion en c# Muchas gracias a quien pueda ayudarme mi mail es lnacv@everyday.com
Broad translation: Hello. I need, in order to finish my (University?) project, a function, routine or something that captures images from a webcam and converts it into a information matrix (bitmap?) in C#. Many thanks to those who can help me. My email is lnacv@everyday.com
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
Hola! Talvez tu queiras dizer um Bitmap? Eu escrevi alguns métodos para tratar imagens JPEG, caso te ajude baixe-as em www.inf.ufrgs.br/~rrferreira/inf01046/SourceCodeTwo.zip. Olhe a classe JPEG. Me desculpe por não falar espanhol.
Ronaldo R Ferreira
Porto Alegre, Brazil
|
|
|
|
|
When ==>
CAMSERVERLib.Camera cam = new CAMSERVERLib.CameraClass();
a exception hold...
{D6BA1539-8473-497C-92C3-8ECF63DAC0F3} is either not valid or not registered.
but i have add all depandence, and the solution was build normally..
anyone know y?
thank you.
|
|
|
|
|
Hello,
I had problems with the COM CamServ too.
Firstly, i got "Access Denied" error wich i could correct. But now i have gotten a COM exception, the number error is 80040001, in microsoft.com i found out that this number means "Invalid advise flags", but that doesn't tell me anything.
The error raised in this code line:
byte[] picture = (byte[])cam.GrabFrame( nQuality );
By the way, What does nQuality do?
___________________
Leer es Saber, REEL
|
|
|
|
|
Hi,
I ' ve the same problem, My OS is Win XP SP2,
I use VS .Net 2003,
.Net Framework 1.1.
If anyone solves this prb., pls inform me...
Tnx
|
|
|
|
|
It seems I am the only one having problems.
The web service is running and I see the XML and the image base64-coded.
I don't know how to put that image on my web site.
What should I do ?
Insert and image and specify the address of the web service as source of the image ???
I wrote the URL you wrote in the client section inserting my IP but i get an empty image.
Am I missing something ??
Thanks
|
|
|
|
|
My Question: Can multiple WebCams of the same model run on a PC?
I have successfully previewed video and grabbed images from one Logitech’s QuickCam Express with the following code.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Runtime.InteropServices;
using System.Text;
using System.IO;
namespace NETCaptureWindow
{
public class MainCls
{
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button2;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button button1;
private System.ComponentModel.Container components = null;
//user variables
private Form3 CaptureWindow;
public IntPtr hWndC;
public CAPDRIVERCAPS CapDrvCaps;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, System.EventArgs e)
{
CaptureWindow = new Form3();
CaptureWindow.Show();
hWndC = AVICap.capCreateCaptureWindow("My Capture Window", AVICap.WS_CHILD|AVICap.WS_VISIBLE,
0, 0, 352, 288, CaptureWindow.Handle, 1);
AVICap.capDriverConnect(hWndC, 0);
AVICap.capPreviewRate(hWndC, 40);
AVICap.capPreview(hWndC, true);
//AVICap.capCaptureSequence(hWndC);
}
private void button2_Click(object sender, System.EventArgs e)
{
AVICap.capEditCopy(hWndC);
IDataObject iData = Clipboard.GetDataObject();
if(iData.GetDataPresent(DataFormats.Bitmap))
{
pictureBox1.Image = (Bitmap) iData.GetData(DataFormats.Bitmap);
}
}
}
public class Form3 : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
public Form3()
{
InitializeComponent();
}
}
internal class AVICap
{
public const int WS_CHILD = 0x40000000;
public const int WS_VISIBLE = 0x10000000;
public const int WM_USER = 0x0400;
public const int WM_CAP_START = WM_USER;
public const int WM_CAP_DRIVER_CONNECT = (WM_CAP_START+ 10);
public const int WM_CAP_SEQUENCE = (WM_CAP_START+ 62);
public const int WM_CAP_SET_PREVIEWRATE = (WM_CAP_START+ 52);
public const int WM_CAP_SET_PREVIEW = (WM_CAP_START+ 50);
public const int WM_CAP_DRIVER_GET_CAPS = (WM_CAP_START+ 14);
public const int WM_CAP_SET_OVERLAY = (WM_CAP_START+ 51);
public const int WM_CAP_SET_SCALE = (WM_CAP_START+ 53);
public const int WM_CAP_EDIT_COPY = (WM_CAP_START+ 30);
private const string vfwdll = "avicap32.dll";
[DllImport(vfwdll)]
public static extern bool capGetDriverDescription(int wDriverIndex, byte[] lpszName, int cbName, byte[] lpszVer, int cbVer);
[DllImport(vfwdll)]
public static extern IntPtr capCreateCaptureWindow(string lpszWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWnd, int nID);
[DllImport("user32.dll")]
public static extern bool IsWindow(IntPtr hWnd /* handle to window*/);
//[DllImport("user32.dll")]
//public static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, ref long lParam);
[DllImport("user32.dll")]
public static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, long lParam);
public static bool capDriverConnect(IntPtr hwnd, int i)
{
return ((bool)AVICapSM(hwnd, WM_CAP_DRIVER_CONNECT, (int) i, 0L));
}
public static bool capCaptureSequence(IntPtr hwnd)
{
return ((bool)AVICapSM(hwnd, WM_CAP_SEQUENCE, (int) 0, (long) 0L));
}
public static bool capPreviewRate(IntPtr hwnd, int wMS)
{
return ((bool)AVICapSM(hwnd, WM_CAP_SET_PREVIEWRATE, (int)(wMS), 0));
}
public static bool capPreview(IntPtr hwnd, bool f)
{
return ((bool)AVICapSM(hwnd, WM_CAP_SET_PREVIEW, Convert.ToInt32(f), 0L));
}
//#define capDriverGetCaps(hwnd, s, wSize) ((BOOL)AVICapSM(hwnd, WM_CAP_DRIVER_GET_CAPS, (WPARAM)(wSize), (LPARAM)(LPVOID)(LPCAPDRIVERCAPS)(s)))
public static bool capDriverGetCaps(IntPtr hwnd, CAPDRIVERCAPS s, int wSize)
{
return ((bool)AVICapSM(hwnd, WM_CAP_DRIVER_GET_CAPS, (int) wSize, Convert.ToInt64((CAPDRIVERCAPS) s)));
}
//#define capOverlay(hwnd, f) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_OVERLAY, (WPARAM)(BOOL)(f), 0L))
public static bool capOverlay(IntPtr hwnd, bool f)
{
return ((bool)AVICapSM(hwnd, WM_CAP_SET_OVERLAY, Convert.ToInt32(f), 0L));
}
//#define capPreviewScale(hwnd, f) ((BOOL)AVICapSM(hwnd, WM_CAP_SET_SCALE, (WPARAM)(BOOL)f, 0L))
public static bool capPreviewScale(IntPtr hwnd, bool f)
{
return ((bool)AVICapSM(hwnd, WM_CAP_SET_SCALE, Convert.ToInt32(f), 0L));
}
//#define capEditCopy(hwnd) ((BOOL)AVICapSM(hwnd, WM_CAP_EDIT_COPY, 0, 0L))
public static bool capEditCopy(IntPtr hwnd)
{
return ((bool)AVICapSM(hwnd, WM_CAP_EDIT_COPY, 0, 0L));
}
public static bool AVICapSM(IntPtr hwnd, int m, int w, long l)
{
/*
bool iswin = IsWindow(hwnd);
int sm = SendMessage(hwnd, m, w, l);
return Convert.ToBoolean(sm);
*/
//return (IsWindow(hwnd)) ? Convert.ToBoolean(SendMessage(hwnd, Convert.ToUInt32(m), w, ref l)) : Convert.ToBoolean(0);
return (IsWindow(hwnd)) ? Convert.ToBoolean(SendMessage(hwnd, Convert.ToUInt32(m), w, l)) : Convert.ToBoolean(0);
}
}
[StructLayout(LayoutKind.Sequential)]
public struct CAPDRIVERCAPS
{
public UInt32 wDeviceIndex; // Driver index in system.ini
public Int16 fHasOverlay; // Can device overlay?
public Int16 fHasDlgVideoSource; // Has Video source dlg?
public Int16 fHasDlgVideoFormat; // Has Format dlg?
public Int16 fHasDlgVideoDisplay; // Has External out dlg?
public Int16 fCaptureInitialized; // Driver ready to capture?
public Int16 fDriverSuppliesPalettes; // Can driver make palettes?
// following always NULL on Win32.
public IntPtr hVideoIn; // Driver In channel
public IntPtr hVideoOut; // Driver Out channel
public IntPtr hVideoExtIn; // Driver Ext In channel
public IntPtr hVideoExtOut; // Driver Ext Out channel
}
}
Teh Joo Peng
|
|
|
|
|
With VFW you might have up to 10 webcams connected, and use all of them.
Best Regards,
Laurent Kempé [Microsoft .NET MVP]
Visit my web site Tech Head Brothers.
---
Old programmers never die, they just branch to a new address.
|
|
|
|
|
Dear Sir,
Thank you for reading my previous message.
First
I have connect two webcams on one PC. The OS allows two webcams to run simultaneously but the USB bandwidth limit will be exceeded.
Second
I found out that I cannot select capture device using capDriverConnect(hWndc,n) by specifying n.
Instead, I must call capDriverConnect(hWndc,0) twice. The second time I call capDriverConnect(hWndc,0), a video source dialog box with a ComboBox appeared allowing me to select the second capture device.
Also, when I enumerate installed capture device using capGetDriverDescription function, I get
Driver 0 Device Name: Microsoft WDM Image Capture (Win32)
Device Version: Version: 5.1.2600.1106
Driver 1 Device Name:
Device Version:
Driver 2 Device Name:
Device Version:
Driver 3 Device Name:
Device Version:
Driver 4 Device Name:
Device Version:
Driver 5 Device Name:
Device Version:
Driver 6 Device Name:
Device Version:
Driver 7 Device Name:
Device Version:
Driver 8 Device Name:
Device Version:
Driver 9 Device Name:
Device Version:
I later found in Windows Base Services General Technical Articles "VfW-to-WDM Video Capture Mapper on Windows 98 and Windows 2000" which says that
"...
Mapper Limitations:
There is a compatibility issue in allowing a VfW application to programmatically open a specific capture device without using the video source dialog box. However, because most VfW client applications allow a user to bring up the video source dialog, this issue has a workaround.
..."
Sir, it seems that the program is accessing VFM through WDM. And WDM does not allow programmatically opening a specific capture device.
What should I do to specify a capture device? Will it be through registry? Or Should I program using DirectShow instead? Sigh... I am stuck.
Thank you for spending your time to read this long message.
Yours sincerely,
Teh Joo Peng
|
|
|
|
|
Dear Teh Joo Peng,
Thanks for sharing your experience. I knew only according to the documentation that it was possible to have up to 10 webcams: capDriverConnect(hWndc,n). I don't really know what to recommend. I made a second version of this using DirectShow, but I am not a DirectShow expert.
Best Regards,
Laurent Kempé [Microsoft .NET MVP]
Visit my web site Tech Head Brothers.
---
Old programmers never die, they just branch to a new address.
|
|
|
|
|