This repository has been archived by the owner on Jun 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
13,493 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea | ||
*.pyc |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
""" | ||
Calibration constants for a portrait mode webcam | ||
Calibration constants for a webcam | ||
""" | ||
|
||
FRAME_HEIGHT = 1024 | ||
FRAME_WIDTH = 768 | ||
FRAME_WIDTH = 640 | ||
FRAME_HEIGHT = 480 | ||
FPS = 120 | ||
|
||
FOCAL_LENGTH = 1100 | ||
FOCAL_LENGTH = 1170 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
import config | ||
|
||
config.networktables_server_ip = '127.0.0.1' | ||
|
||
# when using static ip for robot | ||
#config.networktables_server_ip = '10.26.1.11' | ||
|
||
config.video_source_number = 0 | ||
config.networktables_table = 'SmartDashboard' | ||
|
||
config.gstreamer_bitrate = '3500000' | ||
config.gstreamer_client_ip = '10.26.1.5' | ||
config.gstreamer_client_port = '5805' | ||
config.gstreamer_pipeline = 'appsrc ! videoconvert ! omxh264enc bitrate=%s ! video/x-h264, stream-format=(string)byte-stream ! h264parse ! rtph264pay ! udpsink host=%s port=%s' % (config.gstreamer_bitrate, config.gstreamer_client_ip, config.gstreamer_client_port) | ||
|
||
# config.gstreamer_pipeline = 'appsrc ! videoconvert ! omxh265enc bitrate=%s ! video/x-h265, stream-format=(string)byte-stream ! h265parse ! rtph265pay ! udpsink host=%s port=%s' % (config.gstreamer_bitrate, config.gstreamer_client_ip, config.gstreamer_client_port) | ||
|
||
tornado_server_port="8080" | ||
tornado_server_port="8080" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import cv2 | ||
import config | ||
import time | ||
|
||
from imagezmq import imagezmq | ||
from processing import filters | ||
|
||
def main(): | ||
|
||
cap = cv2.VideoCapture(config.video_source_number) | ||
|
||
sender = imagezmq.ImageSender(connect_to="tcp://{}:5555".format('192.168.1.25')) | ||
|
||
while(True): | ||
|
||
_, frame = cap.read() | ||
|
||
frame = filters.resize(frame, 640, 480, interpolation=cv2.INTER_CUBIC) | ||
|
||
sender.send_image('testImage', frame) | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
""" | ||
collect all known GStreamer methods here | ||
""" | ||
|
||
import logging | ||
|
||
logger = logging.getLogger('gst') | ||
|
||
def get_udp_streamer_pipeline2(host, port, bitrate): | ||
|
||
# config.gstreamer_pipeline = 'appsrc ! videoconvert ! omxh264enc bitrate=%s ! video/x-h264, stream-format=(string)byte-stream ! h264parse ! rtph264pay ! udpsink host=%s port=%s' % (config.gstreamer_bitrate, config.gstreamer_client_ip, config.gstreamer_client_port) | ||
|
||
pipeline = ' ! '.join( [appsrc(), | ||
videoconvert(), | ||
omxh264enc(bitrate=bitrate), | ||
video_x264(byteStream=True), | ||
h264parse(), | ||
rtph264pay(), | ||
udpsink(host,port)]) | ||
logger.info(pipeline) | ||
return pipeline | ||
|
||
def get_udp_sender(host, port): | ||
'appsrc ! queue ! videoconvert ! video/x-raw ! x264enc tune=zerolatency ! h264parse ! rtph264pay ! udpsink host="192.168.1.10" port="5000" sync=false' | ||
pipeline = ' ! '.join( [appsrc(), | ||
queue(), | ||
videoconvert(), | ||
video_x_raw(), | ||
x264enc(zerolatency=True), | ||
h264parse(), | ||
rtph264pay(), | ||
udpsink(host,port)]) | ||
|
||
print(pipeline) | ||
return pipeline | ||
|
||
## PIPELINES | ||
def omxh264enc(bitrate=None): | ||
if bitrate is not None: | ||
return 'omxh264enc bitrate=%s' % bitrate | ||
return 'omxh264enc' | ||
|
||
def appsrc(): | ||
return 'appsrc' | ||
|
||
def queue(): | ||
return 'queue' | ||
|
||
def videoconvert(): | ||
return 'videoconvert' | ||
|
||
def video_x_raw(): | ||
return 'video/x-raw' | ||
|
||
def video_x264(byteStream=False): | ||
if byteStream: | ||
return 'video/x-h264 stream-format=(string)byte-stream' | ||
return 'video/x-h264' | ||
|
||
def x264enc(zerolatency=True): | ||
if zerolatency: | ||
return 'x264enc tune=zerolatency' | ||
return 'x264enc' | ||
|
||
def h264parse(): | ||
return 'h264parse' | ||
|
||
def rtph264pay(): | ||
return 'rtph264pay' | ||
|
||
def udpsink(host, port, sync=False): | ||
if sync is False: | ||
return 'udpsink host="%s" port="%s" sync=false' % (host,port) | ||
return 'udpsink host="%s" port="%s"' % (host,port) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
""" | ||
imagezmq: transport OpenCV images via ZMQ. | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
A pair of Python classes that transport OpenCV images from one | ||
computer to another. For example, OpenCV images gathered by | ||
a Raspberry Pi camera could be sent to another computer | ||
for displaying the images using cv2.imshow() or for further image processing. | ||
Copyright (c) 2017 by Jeff Bass. | ||
License: MIT, see LICENSE for more details. | ||
""" | ||
# populate fields for >>>help(imagezmq) | ||
from .__version__ import __title__, __description__, __url__, __version__ | ||
from .__version__ import __author__, __author_email__, __license__ | ||
from .__version__ import __copyright__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# populates fields for >>>help(imagezmq) | ||
__title__ = 'imagezmq' | ||
__description__ = 'Transporting OpenCV images via ZMQ' | ||
__url__ = 'https://github.com/jeffbass/imagezmq' | ||
__version__ = '0.3.0' | ||
__author__ = 'Jeff Bass' | ||
__author_email__ = '[email protected]' | ||
__license__ = 'MIT 1.0' | ||
__copyright__ = 'Copyright 2019 Jeff Bass' |
Oops, something went wrong.