User Tools

Site Tools


rocnet:cam-en

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rocnet:cam-en [2019/08/01 12:16] rjversluisrocnet:cam-en [2020/01/15 17:18] (current) – [Text] rjversluis
Line 1: Line 1:
-======CAM======+======Camera Streaming====== 
 +[[:english#rocview|{{  :viewer.png}}]][[:english|{{  :rocrail-logo-35.png}}]] 
 +[[:english|Content]] -> [[:english#rocview|Rocview ]] -> **[[:rocnet:cam-en|Camera Streaming]]** 
 +  * [[:rocnet:headless-cam-en|Headless Setup]] 
 +  
 +|< >| 
 +^  [[https://en.wikipedia.org/wiki/Headless_computer|Wikipedia explains "headless"]] 
 + \\ 
 + \\
 {{:rocnet:cam-v21.jpg}} {{:rocnet:cam-v21.jpg}}
 +
 +=====Demos=====
 +  * https://youtu.be/6A57b-VoOSw
  
  
Line 24: Line 35:
 <html> <html>
 <head> <head>
-<title>Raspberry Pi - Surveillance Camera</title>+<title>V200 Camera</title>
 </head> </head>
 <body> <body>
-<img src="stream.mjpg" width="32" height="240">+<img src="stream.mjpg" width="320" height="240">
 </body> </body>
 </html> </html>
Line 92: Line 103:
     daemon_threads = True     daemon_threads = True
  
-with picamera.PiCamera(resolution='640x480', framerate=24) as camera:+with picamera.PiCamera(resolution='320x240', framerate=12) as camera:
     output = StreamingOutput()     output = StreamingOutput()
     #Uncomment the next line to change your Pi's Camera rotation (in degrees)     #Uncomment the next line to change your Pi's Camera rotation (in degrees)
Line 121: Line 132:
 <html> <html>
 <head> <head>
-<title>Raspberry Pi - Surveillance Camera</title>+<title>V200 Camera</title>
 </head> </head>
 <body> <body>
-<center><h1>Raspberry Pi - Surveillance Camera</h1></center> +<img src="stream.mjpg" width="320" height="240">
-<center><img src="stream.mjpg" width="640" height="480"></center>+
 </body> </body>
 </html> </html>
Line 133: Line 143:
 \\ \\
 =====Viewers===== =====Viewers=====
-====wxWidgets==== +====Text==== 
-  * https://docs.wxwidgets.org/trunk/classwx_web_view.html+To enable MJPEG streaming in a text object, the text content must be set to: 
 +<code> 
 +mjpg:<host>:<port>:<type>:<file> 
 +</code> 
 +For example: 
 +<code> 
 +mjpg:192.168.100.167:8081:tcp:stream.mjpg 
 +</code>
  
 +====Loco Throttle====
 +Set the camera host and port on the Interface Tab of the loco properties.\\
  \\  \\
 =====Links===== =====Links=====
   * https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspivid.md   * https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspivid.md
   * https://forum.rocrail.net/viewtopic.php?f=132&t=18345   * https://forum.rocrail.net/viewtopic.php?f=132&t=18345
 +  * https://en.wikipedia.org/wiki/Motion_JPEG
 ====IE Solutions==== ====IE Solutions====
 MS IE does not support mjpg video streaming. MS IE does not support mjpg video streaming.
   * https://www.yawcam.com/forum/viewtopic.php?t=3592   * https://www.yawcam.com/forum/viewtopic.php?t=3592
 +
 + \\
 +=====Splitting=====
 +<code>
 +    00000130: 55 E6 9D 09 E3 78 60 4E 31 81 BB 05 94 12 A3 38 |U....x`N1......8|
 +    00000140: 27 6B 74 23 D3 03 35 B5 2E 6E 58 B6 BF AD 46 D3 |'kt#..5..nX...F.|
 +    00000150: B6 FB 7E 07 FF D9 0D 0A 2D 2D 46 52 41 4D 45 0D |..~.....--FRAME.|
 +    00000160: 0A 43 6F 6E 74 65 6E 74 2D 54 79 70 65 3A 20 69 |.Content-Type: i|
 +    00000170: 6D 61 67 65 2F 6A 70 65 67 0D 0A 43 6F 6E 74 65 |mage/jpeg..Conte|
 +    00000180: 6E 74 2D 4C 65 6E 67 74 68 3A 20 31 32 35 32 34 |nt-Length: 12524|
 +    00000190: 33 0D 0A 0D 0A FF D8 FF DB 00 84 00 01 01 01 01 |3...............|
 +    000001A0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................|
 +    000001B0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 02 02 |................|
 +    
 +    
 +    00000120: 8D B9 66 EE EF AD 96 DD 74 E4 76 DF FA 63 FA AD |..f.....t.v..c..|
 +    00000130: 29 2D 62 AD A6 AA FA FC B9 B4 F9 9F FF D9 0D 0A |)-b.............|
 +    00000140: 2D 2D 46 52 41 4D 45 0D 0A 43 6F 6E 74 65 6E 74 |--FRAME..Content|
 +    00000150: 2D 54 79 70 65 3A 20 69 6D 61 67 65 2F 6A 70 65 |-Type: image/jpe|
 +    00000160: 67 0D 0A 43 6F 6E 74 65 6E 74 2D 4C 65 6E 67 74 |g..Content-Lengt|
 +    00000170: 68 3A 20 34 37 30 37 37 0D 0A 0D 0A FF D8 FF DB |h: 47077........|
 +    00000180: 00 84 00 01 01 01 01 01 01 01 01 01 01 01 01 01 |................|
 +    00000190: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................|
 +    000001A0: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................|
 +
 +
 +</code>
 +
 +
 +Source: https://stackoverflow.com/questions/21702477/how-to-parse-mjpeg-http-stream-from-ip-camera
 +<code python>
 +import cv2
 +import urllib 
 +import numpy as np
 +
 +stream = urllib.urlopen('http://localhost:8080/frame.mjpg')
 +bytes = ''
 +while True:
 +    bytes += stream.read(1024)
 +    a = bytes.find('\xff\xd8')
 +    b = bytes.find('\xff\xd9')
 +    if a != -1 and b != -1:
 +        jpg = bytes[a:b+2]
 +        bytes = bytes[b+2:]
 +        i = cv2.imdecode(np.fromstring(jpg, dtype=np.uint8), cv2.CV_LOAD_IMAGE_COLOR)
 +        cv2.imshow('i', i)
 +        if cv2.waitKey(1) == 27:
 +            exit(0)   </code>
rocnet/cam-en.1564654571.txt.gz · Last modified: 2019/08/01 12:16 by rjversluis