Ask Your Question
0

I am getting Segmentation fault (core dumped)

asked 2020-02-19 05:33:18 -0600

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

LBerger gravatar image

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)
edit retag flag offensive close merge delete

Comments

1

Well, now you need to find out where that happens and how the variables look at that point. That's just elementary debugging

mvuori gravatar imagemvuori ( 2020-02-19 07:05:55 -0600 )edit

@muvori , The script is working, but after a while the video stops and it gives me this error, not sure if it is still can be debugged from the script?

eslamelgourany gravatar imageeslamelgourany ( 2020-02-19 08:08:14 -0600 )edit

cv2.release() -- seriously ? where did you find that ?

(kps, descs) = detector.detectAndCompute(cv_image, 0) -- 0 is for sure wrong as a 'mask', try None instead

please try without ros first, we cannot help you with that, anyway.

berak gravatar imageberak ( 2020-02-19 08:10:47 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
-1

answered 2020-06-15 12:06:36 -0600

matinh gravatar image

use (kps, descs) = detector.detectAndCompute(cv_image, auto)

edit flag offensive delete link more

Comments

please explain usage of auto

berak gravatar imageberak ( 2020-06-15 12:10:54 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-02-19 05:32:44 -0600

Seen: 2,382 times

Last updated: Feb 19 '20