Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
Drone ROS Packages
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Larkin Heintzman
Drone ROS Packages
Commits
d74296e6
Commit
d74296e6
authored
Feb 08, 2022
by
Larkin Heintzman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed image node and clean up
parent
aff503f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
imageActivation.py
Onboard-SDK-ROS/scripts/imageActivation.py
+0
-0
imageNode.py
Onboard-SDK-ROS/scripts/imageNode.py
+56
-0
No files found.
Onboard-SDK-ROS/scripts/image
_a
ctivation.py
→
Onboard-SDK-ROS/scripts/image
A
ctivation.py
View file @
d74296e6
File moved
Onboard-SDK-ROS/scripts/imageNode.py
0 → 100755
View file @
d74296e6
#! /usr/bin/python3
import
rospy
,
sys
,
math
,
cv2
,
numpy
as
np
,
std_msgs
.
msg
from
sensor_msgs.msg
import
Image
from
std_msgs.msg
import
Header
import
os.path
,
getpass
from
cv_bridge
import
CvBridge
,
CvBridgeError
class
ImageViewer
():
def
__init__
(
self
):
self
.
bridge
=
CvBridge
()
self
.
subscriber
=
rospy
.
Subscriber
(
"usb_camera/image_raw"
,
Image
,
self
.
imageCallback
)
self
.
params
=
None
self
.
image
=
None
self
.
seq
=
None
def
imageCallback
(
self
,
frame
):
# self.params = self.getParams()
try
:
self
.
image
=
self
.
bridge
.
imgmsg_to_cv2
(
frame
,
"bgr8"
)
self
.
seq
=
frame
.
header
.
seq
except
CvBridgeError
as
err
:
rospy
.
loginfo
(
"there was error!"
)
rospy
.
loginfo
(
err
)
def
main
():
iv
=
ImageViewer
()
rospy
.
init_node
(
"imageSaver"
)
windowFlag
=
rospy
.
get_param
(
"~visualize"
)
saveFlag
=
rospy
.
get_param
(
"~save"
)
folderName
=
rospy
.
get_param
(
"~folderName"
)
# folderName = "/home/" + getpass.getuser() + "/imageDump"
if
windowFlag
:
cv2
.
namedWindow
(
"image window"
)
cv2
.
waitKey
(
200
)
while
not
rospy
.
is_shutdown
():
if
iv
.
image
is
not
None
:
# cv2.imshow("image window", iv.image)
if
np
.
mod
(
iv
.
seq
,
32
)
==
0
:
if
os
.
path
.
isdir
(
folderName
):
# print ("File exist")
if
windowFlag
:
cv2
.
imshow
(
"image window"
,
iv
.
image
)
rospy
.
loginfo
(
"publishing image to window seq: "
+
iv
.
seq
)
if
saveFlag
:
cv2
.
imwrite
(
"/home/"
+
getpass
.
getuser
()
+
"/"
folderName
+
"/camera_image_{seq}.jpeg"
.
format
(
seq
=
iv
.
seq
),
iv
.
image
)
rospy
.
loginfo
(
"saving image to folder: home-> "
+
folderName
+
"-> camera_image_{seq}.jpeg"
.
format
(
seq
=
iv
.
seq
)
+
" seq: "
+
str
(
iv
.
seq
))
cv2
.
waitKey
(
10
)
else
:
rospy
.
loginfo
(
"camera dir missing!"
)
# cv2.destroyAllWindows()
if
__name__
==
"__main__"
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment