GithubHelp home page GithubHelp logo

Comments (3)

sourishg avatar sourishg commented on June 9, 2024

@1gen100 this might help: https://docs.opencv.org/master/d7/d6f/tutorial_kinect_openni.html

You may need to change the argument passed to the VideoCapture constructor for getting the Kinect feed.

from stereo-calibration.

1gen100 avatar 1gen100 commented on June 9, 2024

Hey @sourishg,

Thanks I have tried this but with no succes, I think it's because it uses OPENNI that works for Kinect V1, but not for Kinect V2.

from stereo-calibration.

1gen100 avatar 1gen100 commented on June 9, 2024

I didn't have time to wait so I made this code, but it's not that good and effective.
Could you help me with this?

#!/usr/bin/python

import roslib
import rospy
import** cv2
import sys
from std_msgs.msg import String
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import numpy as np

class PositionTracker:

def __init__(self):
    # subscribe to kinect image messages
    self.sub = rospy.Subscriber("kinect2/hd/image_color", Image, self.image_callback, queue_size=1)
    self.bridge = CvBridge()

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

    cv_image=cv2.resize(cv_image,(640,360))

    cv2.imshow("Image window", cv_image)
    c=cv2.waitKey(10)
    #print(c)
    click=0
    if c ==108:
	    print("Insert left image num:")
	    click= input()
        print("Saving img pair", click)
        filename1 = "%sleft%d.%s" % ("../c-camera/", click, "jpg")
        cv2.imwrite(filename1, cv_image)
    if c ==114:
	    print("Insert right image num:")
	    click= input()
        print("Saving img pair", click)
        filename1 = "%sright%d.%s" % ("../c-camera/", click, "jpg")
        cv2.imwrite(filename1, cv_image)
        #time.sleep(3)

def main(args):
    ic = PositionTracker()
    rospy.init_node('kinect_tracker')
    try:
        rospy.spin()
    except KeyboardInterrupt:
        print("Shutting down")
    cv2.destroyAllWindows()

if __name__ == '__main__':
    main(sys.argv)

from stereo-calibration.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.