Fix QR recognition test

This commit is contained in:
Oleg Kalachev
2021-06-01 20:45:57 +03:00
parent a378506313
commit e9a9e57bce
4 changed files with 9 additions and 6 deletions

View File

@@ -20,13 +20,16 @@ export ROS_DISTRO='noetic'
export ROS_IP='127.0.0.1'
source /opt/ros/${ROS_DISTRO}/setup.bash
source /home/pi/catkin_ws/devel/setup.bash
systemctl start roscore
cd /home/pi/catkin_ws/src/clover/builder/test/
./tests.sh
./tests.py
./tests_py3.py
./test_qr.py
[[ $(./test_qr.py) == "Found QRCODE with data Проверка Unicode with center at x=66.0, y=66.0" ]]
[[ $(./tests_clever.py) == "Warning: clever package is renamed to clover" ]] # test backwards compatibility
systemctl stop roscore
echo "Move /etc/ld.so.preload back to its original position"
mv /etc/ld.so.preload.disabled-for-build /etc/ld.so.preload

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

BIN
builder/test/qr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -23,17 +23,17 @@ def image_callback(data):
xc = x + w/2
yc = y + h/2
print("Found {} with data {} with center at x={}, y={}".format(b_type, b_data, xc, yc))
rospy.signal_shutdown()
rospy.signal_shutdown('done')
image_sub = rospy.Subscriber('main_camera/image_raw', Image, image_callback, queue_size=1)
# ==============================================================================
# Publish test image
print('Testing QR code recognition')
rospy.sleep(2)
import cv2
img = cv2.imread('qr.gif')
image_pub = rospy.Publisher('main_camera/image_raw', Image)
image_pub.publish(bridge.cv2_to_imgmsg(img))
img = cv2.imread('qr.png')
image_pub = rospy.Publisher('/main_camera/image_raw', Image, queue_size=1, latch=True)
image_pub.publish(bridge.cv2_to_imgmsg(img, 'bgr8'))
rospy.spin()