Ask Your Question
0

Error with drone_cat_mouse

asked 2018-02-15 02:58:47 -0500

r.rodriguz gravatar image

Hello,

Im trying to filter the mouse with a filter that im using the practice color_filter (it works perfectly in that practice) but i have an error when i execute. Part of the code is:

        73. frame = self.camera.getImage()
        74. blur = cv2.GaussianBlur(frame,(5,5),0)
        75. hsv = cv2.cvtColor(blur, cv2.COLOR_RGB2HSV)

The error that i have is:

      Exception in thread Thread-4:
      Traceback (most recent call last):
      File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
      self.run()
      File "/home/ramon/JdeRobot/Academy/src/drone_cat_mouse/cat_py/MyAlgorithm.py", line 39, in run
      self.execute()
      File "/home/ramon/JdeRobot/Academy/src/drone_cat_mouse/cat_py/MyAlgorithm.py", line 74, in execute
      blur = cv2.GaussianBlur(frame,(5,5),0)

     TypeError: src is not a numpy array, neither a scalar

Can someone help me? Thank you.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2018-02-16 02:17:29 -0500

aitormf gravatar image

updated 2018-02-16 02:19:33 -0500

I just saw the problem, self.camera.getImage() return a Image class that contains:

  • height: Image height [px]
  • width: Image width [px]
  • timeStamp: Timestamp [s]
  • format: Image format string (RGB8, BGR,...)
  • data: Opencv Image

your image is in self.camera.getImage().data

edit flag offensive delete link more
0

answered 2018-02-15 04:19:49 -0500

aitormf gravatar image

This error occur because sometime gazebo takes a time to lauch all interfaces. If you launch client before drone camera is ready, you don't receive a image.

Wait to see the following before to launch client (In this moment, Drone's camera is ready):

[ardrone-red] Ice adapter listening at 
[ardrone-red]   tcp -h 0.0.0.0 -p 9900 -t 60000
[ardrone-black]     boostrap quadrotor state as Landed (altitude=0.102177)
[ardrone-red]   boostrap quadrotor state as Landed (altitude=0.102177)
Constructor CameraIBase
[ardrone-red] Ice booststrap done.
[ardrone-black] Ice adapter listening at 
[ardrone-black]     tcp -h 0.0.0.0 -p 9000 -t 60000
Constructor CameraIBase
[ardrone-black] Ice booststrap done.
[ardrone-black]     bootstrap cam[0]
PushCameraI::onCameraSensorBoostrap()
[ardrone-black]     bootstrap cam[1]
[ardrone-red]   bootstrap cam[0]
PushCameraI::onCameraSensorBoostrap()
[ardrone-red]   bootstrap cam[1]
edit flag offensive delete link more

Comments

Hello, I've just tried what you told me, but i still have the same error and i dont know why

r.rodriguz gravatar imager.rodriguz ( 2018-02-15 16:42:46 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2018-02-15 02:58:47 -0500

Seen: 67 times

Last updated: Feb 16