I'd like to publish the webcam. Here is my code following the tutorials. Now I'm using webcam server using "webcam-server" with Logitech webcam. (I'm wondering whether they have some restriction to implement general webcam server)
When I run this code, I got the error at "camera.getImage()".
Could you give me the spec of this object (CameraDriver) and idea how to publish the image after capture and to publish the video stream?
Thank you in advance. Seungweon.
------ error code message ------ Unhandled Exception: System.Net.WebException: The server committed a protocol vi olation. Section=ResponseStatusLine at System.Net.WebClient.OpenRead(Uri address) at System.Net.WebClient.OpenRead(String address) at MSRSense.Sensors.WebCamDriver.getImage() at CameraPublisher.Program.Main(String args) in C:\Documents and Settings\S eungWeon Park\My Documents\Visual Studio 2005\Projects\CameraPublisher\CameraPub lisher\Program.cs:line 222
------a part of source code---- CameraDriver camera = new WebCamDriver("http://xxx.xxx.xxx.xxx");
I would first make sure the camera provides only the image as a jpeg (and not a video or a webpage with the image) when one points a browser to "http://xxx.xxx.xxx.xxx" (For instance, the URL may have to modified to something like "http://xxx.xxx.xxx.xxx/yyy.jpg" - depends on your camera.)
More detailed spec of the camera driver will be released soon but the part of source code most relevant to your error string (from the WebCamDriver object) is:
Bitmap webcamImg = new Bitmap(Image.FromStream(webclient.OpenRead(url))); //fetch the image from the camera image URL
where webclient is an instantiation of System.Net.WebClient()
Also, Bitmap img = new Bitmap(320, 240); is unnecessary as camera.GetImage creates a new Bitmap object.