Ask Your Question

Revision history [back]

I am getting Segmentation fault (core dumped)

I am running ubuntu, python and trying to use AKAZE features on my camera.

here is my code

!/usr/bin/python

from __future__ import print_function import roslib import sys import rospy import cv2 from std_msgs.msg import String from sensor_msgs.msg import Image from cv_bridge import CvBridge, CvBridgeError import matplotlib.pyplot as plt import numpy as np

class image_converter:

def __init__(self):

#self.image_pub = rospy.Publisher("pylon_camera_node/image_raw",Image)
self.bridge = CvBridge()
self.image_sub = rospy.Subscriber("pylon_camera_node/image_raw", Image, self.callback)

def callback(self,data): try: cv_image = self.bridge.imgmsg_to_cv2(data, "bgr8") except CvBridgeError as e: print(e)

#Detector >>> AKAZE
detector = cv2.AKAZE_create()

#keypoints and descriptor
(kps, descs) = detector.detectAndCompute(cv_image, 0)

#Draw keypoints and show image(stream)
cv2.drawKeypoints(cv_image, kps, cv_image, (0, 1000, 0))
cv2.imshow("Image window", cv_image)
cv2.waitKey(3)

def main(args): ic = image_converter() rospy.init_node('image_converter', anonymous = True) try: rospy.spin() except KeyboardInterrupt: print("Shutting down") #cv2.destroyAllWindows() cv2.release() if __name__ == '__main__': main(sys)

click to hide/show revision 2
None

updated 2020-02-19 06:38:05 -0600

berak gravatar image

I am getting Segmentation fault (core dumped)

I am running ubuntu, python and trying to use AKAZE features on my camera.

here is my code

!/usr/bin/python

#!/usr/bin/python

from __future__ import print_function
import roslib
import sys
import rospy
import cv2
from std_msgs.msg import String
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import matplotlib.pyplot as plt
import numpy as np

np class image_converter:

image_converter: def __init__(self):

__init__(self):

    #self.image_pub = rospy.Publisher("pylon_camera_node/image_raw",Image)
 self.bridge = CvBridge()
 self.image_sub = rospy.Subscriber("pylon_camera_node/image_raw", Image, self.callback)

def callback(self,data): try: cv_image = self.bridge.imgmsg_to_cv2(data, "bgr8") except CvBridgeError as e: print(e)

print(e)


    #Detector >>> AKAZE
 detector = cv2.AKAZE_create()

 #keypoints and descriptor
 (kps, descs) = detector.detectAndCompute(cv_image, 0)

 #Draw keypoints and show image(stream)
 cv2.drawKeypoints(cv_image, kps, cv_image, (0, 1000, 0))
 cv2.imshow("Image window", cv_image)
 cv2.waitKey(3)

def main(args): ic = image_converter() rospy.init_node('image_converter', anonymous = True) try: rospy.spin() except KeyboardInterrupt: print("Shutting down") #cv2.destroyAllWindows() cv2.release() if __name__ == '__main__': main(sys)

main(sys)

I am getting Segmentation fault (core dumped)

I am running ubuntu, python and trying to use AKAZE features on my camera.

here is my code

#!/usr/bin/python

from __future__ import print_function
import roslib
import sys
import rospy
import cv2
from std_msgs.msg import String
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import matplotlib.pyplot as plt
import numpy as np




class image_converter:

  def __init__(self):

    #self.image_pub = rospy.Publisher("pylon_camera_node/image_raw",Image)
    self.bridge = CvBridge()
    self.image_sub = rospy.Subscriber("pylon_camera_node/image_raw", Image, self.callback)

  def callback(self,data):
    try:
      cv_image = self.bridge.imgmsg_to_cv2(data, "bgr8")
    except CvBridgeError as e:
      print(e)


    #Detector >>> AKAZE
    detector = cv2.AKAZE_create()

    #keypoints and descriptor
    (kps, descs) = detector.detectAndCompute(cv_image, 0)

    #Draw keypoints and show image(stream)
    cv2.drawKeypoints(cv_image, kps, cv_image, (0, 1000, 0))
    cv2.imshow("Image window", cv_image)
    cv2.waitKey(3)

def main(args):
  ic = image_converter()
  rospy.init_node('image_converter', anonymous = True)
  try:
    rospy.spin()
  except KeyboardInterrupt:
    print("Shutting down")
  #cv2.destroyAllWindows()
  cv2.release()
if __name__ == '__main__':
    main(sys)