473,382 Members | 1,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

jpg from ip camera D-Link DCS-900

Hello,

This code give jpg from a MJPEG stream from an IP camera DCS-900 in the
folder "c:\_bin". The only and probably the most important part is I
can't see the JPG. It is probably an encoding error. So having spent
the best part ofthe last 5 days trying to fix it, can somebody please
help me find the problem?
Imports System.Net.WebRequest
Imports System.Net.WebResponse
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Diagnostics
Imports System.Data.SqlClient
Module Module1

Sub Main()

Dim myWebRequest As Net.WebRequest =
Net.WebRequest.Create("http://192.168.2.10/video.cgi")

' Send the 'WebRequest' and wait for response.
Dim myWebResponse As Net.WebResponse =
myWebRequest.GetResponse()

' Call method 'GetResponseStream' to obtain stream associated
with the response object
Dim ReceiveStream As IO.Stream =
myWebResponse.GetResponseStream()

' Pipe the stream to a higher level stream reader with the
required encoding format.
Dim encode As System.Text.UTF8Encoding =
CType(System.Text.Encoding.GetEncoding("utf-8"),
System.Text.UTF8Encoding)

' Pipe the stream to a higher level stream reader with the
required encoding format.
Dim readStream As New StreamReader(ReceiveStream, encode)
'Console.WriteLine(ControlChars.Cr + "Response stream
received")
Dim read(1) As [Char]

Dim count As Integer = readStream.Read(read, 0, 1)

Dim b_doTheJpg As Boolean = False
Dim s_jpg As String = ""
Dim s_string As String = ""
Dim s_fileToSave As String = ""

Dim i_line As Integer = 0
Dim i_file As Integer = 0
Dim i_whereToStart As Integer = 0
Dim i_lenOfTheChar As Integer = 0
Dim b_byte() As Byte

While count 0

Dim str As New [String](read, 0, count)

count = readStream.Read(read, 0, 1)

s_string = s_string & str

If Len(s_string) 18 Then
s_string = Mid(s_string, 2, Len(s_string) - 1)
End If

If CBool(InStr(s_string, "--video boundary--",
CompareMethod.Text)) Then

If CBool(Len(s_fileToSave) 0) Then

s_fileToSave = Mid(s_fileToSave, 1,
Len(s_fileToSave) - 18)

Dim strFilename As String = "C:\_bin\" & i_file &
".jpg"

i_file = i_file + 1

Dim fsStream As StreamWriter

fsStream = File.CreateText(strFilename)

fsStream.WriteLine(Trim(s_fileToSave))
fsStream.Close()

b_doTheJpg = False
s_fileToSave = ""

End If

End If

If b_doTheJpg = True Then
s_fileToSave = s_fileToSave & str

End If

If CBool(InStr(s_string, "t-type: image/jpeg",
CompareMethod.Text)) Then

b_doTheJpg = True

End If

End While
'Console.WriteLine("")

' Release the resources of stream object.
readStream.Close()

' Release the resources of response object.
myWebResponse.Close()
End Sub

End Module

Jul 19 '06 #1
0 1340

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Newbie | last post by:
I am doing some robotics projects but my main area of interest is trying out several algorithms for the processing of the stream of data coming from the video. I am wondering what type of camera...
1
by: Pola | last post by:
I am working with IIS. I am using ISAPI Extension dll, that runs on the web server. I am working on the appl that have to receive images(jpeg from video camera) in the real time. the client...
0
by: Manas Mittal | last post by:
Hi I have made a application that uses the Microsoft's old VisSDK software libraries. The software works fine with a Logitech Camera attached. However, I am unable to get it to work using when...
5
by: Brian | last post by:
Hello, I was wondering if anyone knows of an easy way to capture an image from a digital camera and put it into a picturebox. I need to be able to view the video feed and click a capture button...
3
by: Brad Rogers | last post by:
Ive got a project needing to establish a video stream from a camera connected to a USB port. Is there an established way to call out a camera connection dialog box and assign the stream to the...
2
by: Stupid48 | last post by:
I have this Pentax Optio camera and I want to access it via vb.net. I would like to write something where I can snap the picture from the application and it automatically acquires the image from...
2
by: MDausmann | last post by:
Hi I have a camera that mounts as a folder when I plug it in and is available in explorer. I thought it would be possible to access the images on the camera using normal file operations but I...
6
by: ink | last post by:
Hi I am developing on a Symbol MC70 devices and in the past they have always realised an SDK for development including Symbol.Camera Wrapper. However it seems that for the MC35 they are not, or...
2
by: dcblair | last post by:
Hi guys and girls. I can't seem to figure this one out. Here is my setup: Speedtouch 536 DSL Modem, Nexxt 4 Port Wireless Router, CNET CIC 920W Wireless IP Camera. The camera is set up in...
3
by: Jajjo | last post by:
Hey there. I have made a new camera system and I'm having a sort-of issue. The attached image (Untitled.jpg) will be the image I refer to when I say pink, orange, green or whatever. The black...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.