Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Dec 13, 2019 9:16 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: MBS StringtoPictureMBS question
PostPosted: Sun May 30, 2010 4:30 pm 
Offline
User avatar

Joined: Sat Nov 11, 2006 2:43 pm
Posts: 1221
Location: This poster has left the forums
I'm grabbing an image from an IP camera like so:

Dim http as new HTTPSocket
Dim mPhoto as string
Dim feed as Picture
mPhoto = http.get("http://192.168.200.80/cgi-bin/viewer/video.jpg",1)
if mPhoto <> "" then
feed = StringtoPictureMBS(mPhoto,"mypicture.jpg","Image/jpeg")
if feed <> nil then return feed
end if
return nil


Which works fine if the camera returns a complete JPEG file.
Occasionally an image may not be received in its entirety because we either didn't wait long
enough or because the camera dropped the connection mid stream.
The problem arises in that StringtoPictureMBS still returns a Picture even if its incomplete.
This then throws an exception if I try to access the Graphics portion of the picture to draw
to it (I'm adding text). How can I tell whether the picture is valid or not?

I can send this invalid picture on to a client connecting to my application via HTTP and the
clients browser displays the image (albeit incomplete).

I'm working around the problem by recreating the image using this
feed = feed.ScaleMBS (feed.Width,feed.height,false)



It would be nice if StringtoPictureMBS returned a boolean that told me whether it was valid or not,
or if when it returned a Picture it did its own stuff to make it valid - an invalid picture will still
have an image in it that at least on Mac OS I'm able to view the parts that are valid.
Below is an example of an incomplete picture sent from my IP camera:
Image

_________________
%Invalidforumsignatureexception% user signature not found


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS StringtoPictureMBS question
PostPosted: Sun May 30, 2010 4:49 pm 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Please use this function:

JPEGStringToPictureMBS(buf as string,allowdamaged as Boolean) as picture

even more control gives the JPEGImporterMBS class.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS StringtoPictureMBS question
PostPosted: Sat Aug 13, 2011 8:20 pm 
Offline

Joined: Mon Dec 06, 2010 7:21 pm
Posts: 7
Would this be the same if I wanted to stream our video feed from our camera url to a real studio application that shows three videos? Is this possible. What is the best code to use?


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS StringtoPictureMBS question
PostPosted: Sun Aug 14, 2011 3:58 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
well, for a jpeg stream, you'd download that stream. You separate pictures and pass each picture to a function to decode and display the picture.

But I don't know your camera.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS StringtoPictureMBS question
PostPosted: Sun Aug 14, 2011 8:26 am 
Offline

Joined: Mon Dec 06, 2010 7:21 pm
Posts: 7
Here is the code that I have for the html.

<script language=javascript>function OpenPTZWindow(cameraNum) {
window.open("++ptz/controls?cameraNum="+cameraNum,"PTZ"+cameraNum,"toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=230,height=190");
}</script>
</head>
<body onLoad="moveTo(0,0); resizeTo(432,898);">

<body>


<p align="center"><b><font size="3">Camera's &ndash; Live Video</font></b></p>

<div align="center">


<p><img src="http://10.10.1.14:8000/++video?cameraNum=2&64729" width=406 height=250 alt="Front Door"></p>

<p><img src="http://10.10.1.14:8000/++video?cameraNum=1&64729" width=406 height=250 alt="Front Steps"></p>
<img src="http://10.10.1.14:8000/++video?cameraNum=0&37316" width=406 height=250 alt="Basement"><br>


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS StringtoPictureMBS question
PostPosted: Sun Aug 14, 2011 9:01 am 
Offline
User avatar

Joined: Sat Nov 11, 2006 2:43 pm
Posts: 1221
Location: This poster has left the forums
Which bit are you stuck on?
What does "http://10.10.1.14:8000/++video?cameraNum=2&64729" return; an image, an MPEG stream, a H264 stream, or?
What have you tried so far?

_________________
%Invalidforumsignatureexception% user signature not found


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS StringtoPictureMBS question
PostPosted: Sun Aug 14, 2011 9:20 am 
Offline

Joined: Mon Dec 06, 2010 7:21 pm
Posts: 7
I know real basic is easy. I am not which built in control to use and how to write the code. I have found examples, but none of them seem to work. I currently have people use a HTML file, an application would be a little better. Its for use with a non-profit. I cannot seem to find a good book to learn how to use real studio either. And the ones I see are from 2006 and not to at least 2010.


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS StringtoPictureMBS question
PostPosted: Sun Aug 14, 2011 9:25 am 
Offline
User avatar

Joined: Sat Nov 11, 2006 2:43 pm
Posts: 1221
Location: This poster has left the forums
The first step is to find out what the camera returns with the request "http://10.10.1.14:8000/++video?cameraNum=2&64729".

_________________
%Invalidforumsignatureexception% user signature not found


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS StringtoPictureMBS question
PostPosted: Sun Aug 14, 2011 10:19 am 
Offline

Joined: Mon Dec 06, 2010 7:21 pm
Posts: 7
here is the full HTML code:

<html><head><title>Alliance Security Cameras</title><style type="text/css">
<!--
p {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px}
-->
</style>
<style type="text/css">
<!--
body {
&nbsp; &nbsp;margin-left: 0px;
&nbsp; &nbsp;margin-top: 0px;
&nbsp; &nbsp;margin-right: 0px;
&nbsp; &nbsp;margin-bottom: 0px;
}
.community0 .style2 {
&nbsp; &nbsp;text-decoration: blink;
}
-->

<!--
.style2 {color: #FF0000}
.style3 {font-size: 12px; line-height: 20px; font-variant: normal; font-family: Arial, Helvetica, sans-serif;}
-->
</style>

<script language=javascript>function OpenPTZWindow(cameraNum) {
window.open("++ptz/controls?cameraNum="+cameraNum,"PTZ"+cameraNum,"toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=230,height=190");
}</script>
</head>
<body onLoad="moveTo(0,0); resizeTo(432,898);">

<body>


<p align="center"><b><font size="3">Camera's &ndash; Live Video</font></b></p>

<div align="center">


<p><img src="http://10.10.1.14:8000/++video?cameraNum=2&64729" width=406 height=250 alt="Front Door"></p>

<p><img src="http://10.10.1.14:8000/++video?cameraNum=1&64729" width=406 height=250 alt="Front Steps"></p>
<img src="http://10.10.1.14:8000/++video?cameraNum=0&37316" width=406 height=250 alt="Basement"><br>





</div>

</body>
</html>


The ones with the IP addresses for the images which is the streaming of the video. The are boxes on top of each other in list format. if i can do it as html using the built-in controls that would be good to. Just as long as it is in a mac application. Does that make sense?


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS StringtoPictureMBS question
PostPosted: Sun Aug 14, 2011 11:00 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Do you see this:


<p><img src="http://10.10.1.14:8000/++video?cameraNum=2&64729" width=406 height=250 alt="Front Door"></p>


There is a link to the image. Simply use a httpsocket to download the url "http://10.10.1.14:8000/++video?cameraNum=2&64729" and pass the data to Picture.OpenFromData to get the picture.

Or use our JPEG plugin functions if you need more control about the details (and the camera gives JPEG pictures).

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS StringtoPictureMBS question
PostPosted: Sun Aug 14, 2011 11:08 am 
Offline

Joined: Mon Dec 06, 2010 7:21 pm
Posts: 7
Ok now it sounds like i am getting some where. Is there any documentation on how to do it online? sorry for all the questions. I do not see it in the built-in controls. Do i need to download or purchase the controls?


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS StringtoPictureMBS question
PostPosted: Sun Aug 14, 2011 11:36 am 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
You find HTTPSocket and Picture classes in the language reference. Take a look, please.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS StringtoPictureMBS question
PostPosted: Sun Aug 14, 2011 11:54 am 
Offline

Joined: Mon Dec 06, 2010 7:21 pm
Posts: 7
Will do. I found an app for windows and it seems to work using mjpeg. Is this the same what you are referring to? just want to make sure. sorry for all the questions.


Top
 Profile  
Reply with quote  
 Post subject: Re: MBS StringtoPictureMBS question
PostPosted: Sun Aug 14, 2011 3:44 pm 
Offline
User avatar

Joined: Sat Nov 11, 2006 2:43 pm
Posts: 1221
Location: This poster has left the forums
http://en.wikipedia.org/wiki/Motion_JPE ... _over_HTTP
You receive a header with a boundary identifier, then a JPEG, then a boundary identifier, then another JPEG, then another boundary identifier, etc
Read the stream, parse the stream to pull out each JPEG.

OR, simply use a HTML Viewer to show the stream 'live'. See the language reference for HTMLViewer, pass it the address of the stream.

My cameras support H264 streams, MJPEG streams, and static images. Rather than listen to the MJPEG stream and pull out the images I pull a single image directly. I repeat the process to create my own MJPEG stream.

_________________
%Invalidforumsignatureexception% user signature not found


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group