-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKameraTreiberSys.py
executable file
·73 lines (57 loc) · 2.04 KB
/
KameraTreiberSys.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python3
#AI_Model_Creator; an easy to use AI cumputer vision model creator.
#Copyright (C) 2020 Jonas Mayer
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program. If not, see <https://www.gnu.org/licenses/>.
#You can contact me by mail: [email protected]
import sys,time
syspath0=sys.path[0]
exec(open(sys.path[0]+"/../../../../VirtualPython3/bin/activate_this.py").read(), {'__file__': sys.path[0]+"/../../../../VirtualPython3/bin/activate_this.py"})
sys.path.append(sys.path[0])
sys.path[0] = syspath0
import rospy,roslib
from sensor_msgs.msg import Image
"""
from torchvision import transforms
import os
from PIL import Image
import numpy as np
import torch
from sensor_msgs.msg import Image as imageMsg
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torch.optim as optim
import sys
import timeit
"""
from cv_bridge import CvBridge, CvBridgeError
"""
import topic_names
import std_msgs
from torch import nn,optim,utils,exp,stack,autograd,save,load
from torchvision import transforms,models,datasets
import os
import time
from PIL import Image """
import cv2
capture = cv2.VideoCapture(0)
bridge = CvBridge()
rospy.init_node('VideoSysPublisher')
VideoRaw = rospy.Publisher('kamera_bilder', Image, queue_size=10)
for i in range(1000000):
ret, frame = capture.read()
image_message = bridge.cv2_to_imgmsg(frame, encoding="passthrough")
VideoRaw.publish(image_message)
#time.sleep(0.1)
#print(frame)
capture.release()
cv2.destroyAllWindows()