乐视体感三合一奥比中光Astra Pro相机彩色和深度(红外)相机标定

  1. 具体标定过程参考
    乐视体感三合一奥比中光Astra Pro相机彩色和深度(红外)相机标定

  2. 由于在标定过程中IR图像过暗无法进行标定,故对其数据进行放大处理,相关代码如下:

#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

# ----------------------------------- #
# pub topic: /camera/rgb/image_raw
# sub topic: 
# ----------------------------------- #

import rospy 
from sensor_msgs.msg import Image
import ros_numpy
import cv2.cv2 as cv
import numpy as np

def send():
    rospy.init_node("pub_img")
    pub = rospy.Publisher("/camera/ir/image2", Image, queue_size=10)
    loop = rospy.Rate(10)
    while True:
        msg_img = rospy.wait_for_message("/camera/ir/image", Image, timeout=1)
        img = ros_numpy.numpify(msg_img)
        img = (img / 1024) * 255
        img = np.array(img, np.uint8)
        img = cv.merge((img, img, img))
        # print(img.shape, "  ",  np.min(img), "  ", np.max(img))
        # cv.imshow("test", img)
        # cv.waitKey(10)
        # frame = ros_numpy.numpify(img)
        # frame = cv.resize(frame, (640, 480))
        # print(frame.shape)
        # if ret:
        msg = ros_numpy.msgify(Image, img, encoding='rgb8')
        pub.publish(msg)

        # loop.sleep()

if __name__ == "__main__":
    send()

你可能感兴趣的:(ROS,python,计算机视觉,自动驾驶)