Error when roslaunch a package:

asked 2019-11-02 21:45:28 -0500

fatimah nizam gravatar image

updated 2019-11-03 01:43:51 -0500

I am new with ROS and I am not very familiar with python. I am trying to execute roslaunch with this opencv_object_tracking package:

# import all the related packages
import rospy
import argparse
import roslib
import sys
import imutils
import time
import cv2
from import VideoStream
from import FPS


        # Extract the OpenCV version info
        #(major, minor) = cv2.__version__.split(".")[:2]

        OPENCV_OBJECT_TRACKERS = {"mosse": cv2.TrackerMOSSE_create

        #grab the appropriate object tracker
        tracker = OPENCV_OBJECT_TRACKERS[args["tracker"]]()

        # initialize the bounding box coordinates
        initBB = None

        # if grab the reference to the web cam
            print("[INFO] starting video stream...")
            vs = VideoStream(src=0).start()

        # initialize the FPS throughput estimator
        fps = None

        # loop over frames from the video stream
        while True:
        # grab the current frame, then handle if we are using VideoStream
        frame =
        frame = frame[1]

        # check to see if we have reached the end of the stream
        if frame is None:

        # resize the frame (so we can process it faster) and grab the
        # frame dimensions
        frame = imutils.resize(frame, width=700)
        (H, W) = frame.shape[:2]

        # check to see if we are currently tracking an object
        if initBB is not None:
        # grab the new bounding box coordinates of the object
        (success, box) = tracker.update(frame)

        # check to see if the tracking was a success
            if success:
                (x, y, w, h) = [int(v) for v in box]
                cv2.rectangle(frame, (x, y), (x + w, y + h),
                (0, 255, 0), 2)

        # update the FPS counter

        # initialize the set of information we'll be displaying on
        # the frame
            info = [
            ("Tracker", args["tracker"]),
            ("Success", "Yes" if success else "No"),
            ("FPS", "{:.2f}".format(fps.fps())),

        # loop over the info tuples and draw them on our frame
            for (i, (k, v)) in enumerate(info):
            text = "{}: {}".format(k, v)
            cv2.putText(frame, text, (10, H - ((i * 20) + 20)),
                cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 0, 255), 2)

        # show the output frame
        cv2.imshow("Frame", frame)
        key = cv2.waitKey(1) & 0xFF

        # if the 's' key is selected, we are going to "select" a bounding
        # box to track
        if key == ord("s"):
        # make sure you press ENTER or SPACE after selecting the ROI)
            initBB = cv2.selectROI("Frame", frame, fromCenter=False,

        # start OpenCV object tracker using the supplied bounding box
        # coordinates, then start the FPS throughput estimator as well
            tracker.init(frame, initBB)
            fps = FPS().start()

        # if the `q` key was pressed, break from the loop
        elif key == ord("q"):

        # if we are using a webcam, release the pointer
        if not args.get("video", False):

        # otherwise, release the file pointer


        # close all windows

And this is the roslaunch that I have made (start.launch):

    <node pkg="opencv_object_tracking" type="" name="opencv_object_tracking" output="screen">
    <param name="opencv" value="True"/>

can anyone help me to troubleshoot this?

The error is:

process[opencv_object_tracking-1]: started with pid ... (more)

edit retag flag offensive close merge delete


The error is:

this is very likely only the very end of the error message. Please make sure to show us all parts of the error, or board members will not be able to help you.

gvdhoorn gravatar image gvdhoorn  ( 2019-11-02 22:19:19 -0500 )edit

The other parts of the error:

process[opencv_object_tracking-1]: started with pid [2579] File "/home/fatimahnizam/catkin_ws/src/opencv_object_tracking/nodes/", line 28 OPENCV_OBJECT_TRACKERS = {"mosse": cv2.TrackerMOSSE_create ^ IndentationError: unexpected indent [opencv_object_tracking-1] process has died [pid 2579, exit code 1, cmd /home/fatimahnizam/catkin_ws/src/opencv_object_tracking/nodes/ __name:=opencv_object_tracking __log:=/home/fatimahnizam/.ros/log/d945255a-fe04-11e9-9255-b886875b468d/opencv_object_tracking-1.log]. log file: /home/fatimahnizam/.ros/log/d945255a-fe04-11e9-9255-b886875b468d/opencv_object_tracking-1*.log all processes on machine have died, roslaunch will exit shutting down processing monitor... ... shutting down processing monitor complete done

fatimah nizam gravatar image fatimah nizam  ( 2019-11-03 01:43:28 -0500 )edit

Please do not post updates like this as comments, they are too limited for this type of content.

Edit your original question, appending the new information. Use the edit button/link for that.

gvdhoorn gravatar image gvdhoorn  ( 2019-11-04 01:53:27 -0500 )edit