New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add modified version of draw rects for non ascii characters #2648
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I do the following command,
roslaunch jsk_perception sample_draw_rects_for_non_ascii_labels.launch
I got error.
Traceback (most recent call last):
File "/home/leus/ros/melodic/src/jsk-ros-pkg/jsk_recognition/jsk_perception/node_scripts/draw_rects.py", line 10, in <module>
from jsk_recognition_utils.color import labelcolormap
File "/home/leus/ros/melodic/devel/lib/python2.7/dist-packages/jsk_recognition_utils/__init__.py", line 34, in <module>
exec(__fh.read())
File "<string>", line 8, in <module>
File "/home/leus/ros/melodic/src/jsk-ros-pkg/jsk_recognition/jsk_recognition_utils/python/jsk_recognition_utils/mask.py", line 5, in <module>
from skimage.morphology import binary_closing
File "/usr/lib/python2.7/dist-packages/skimage/__init__.py", line 158, in <module>
from .util.dtype import *
File "/usr/lib/python2.7/dist-packages/skimage/util/__init__.py", line 7, in <module>
from .arraycrop import crop
File "/usr/lib/python2.7/dist-packages/skimage/util/arraycrop.py", line 8, in <module>
from numpy.lib.arraypad import _validate_lengths
ImportError: cannot import name _validate_lengths
[draw_rects-5] process has died [pid 19319, exit code 1, cmd /home/leus/ros/melodic/src/jsk-ros-pkg/jsk_recognition/jsk_perception/node_scripts/draw_rects.py ~input:=image_publisher/output ~input/rects:=mask_rcnn_73b2_kitchen/output/rects __name:=draw_rects __log:=/home/leus/.ros/log/9748f09c-631e-11ec-9e
7f-0242c7226360/draw_rects-5.log].
log file: /home/leus/.ros/log/9748f09c-631e-11ec-9e7f-0242c7226360/draw_rects-5*.log
Traceback (most recent call last):
File "/home/leus/ros/melodic/src/jsk-ros-pkg/jsk_recognition/jsk_perception/node_scripts/draw_rects.py", line 10, in <module>
from jsk_recognition_utils.color import labelcolormap
File "/home/leus/ros/melodic/devel/lib/python2.7/dist-packages/jsk_recognition_utils/__init__.py", line 34, in <module>
exec(__fh.read())
File "<string>", line 8, in <module>
File "/home/leus/ros/melodic/src/jsk-ros-pkg/jsk_recognition/jsk_recognition_utils/python/jsk_recognition_utils/mask.py", line 5, in <module>
from skimage.morphology import binary_closing
File "/usr/lib/python2.7/dist-packages/skimage/__init__.py", line 158, in <module>
from .util.dtype import *
File "/usr/lib/python2.7/dist-packages/skimage/util/__init__.py", line 7, in <module>
from .arraycrop import crop
File "/usr/lib/python2.7/dist-packages/skimage/util/arraycrop.py", line 8, in <module>
from numpy.lib.arraypad import _validate_lengths
ImportError: cannot import name _validate_lengths
[draw_rects_with_classification_result-6] process has died [pid 19332, exit code 1, cmd /home/leus/ros/melodic/src/jsk-ros-pkg/jsk_recognition/jsk_perception/node_scripts/draw_rects.py ~input:=image_publisher/output ~input/rects:=mask_rcnn_73b2_kitchen/output/rects ~input/class:=mask_rcnn_73b2_kitchen/output/class __name:=draw_rects_with_classification_result __log:=/home/leus/.ros/log/9748f09c-631e-11ec-9e7f-0242c7226360/draw_rects_with_classification_result-6.log].
log file: /home/leus/.ros/log/9748f09c-631e-11ec-9e7f-0242c7226360/draw_rects_with_classification_result-6*.log
Maybe related to scikit-image/scikit-image#3906 ?
My environment is
$ pip show scikit-image
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Name: scikit-image
Version: 0.13.1
Summary: Image processing routines for SciPy
Home-page: http://scikit-image.org
Author: Stefan van der Walt
Author-email: stefan@sun.ac.za
License: Modified BSD
Location: /usr/lib/python2.7/dist-packages
Requires: PyWavelets, networkx, pillow, six
Required-by: imgaug, fcn
$ pip show numpy
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Name: numpy
Version: 1.16.6
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: None
License: BSD
Location: /home/leus/.local/lib/python2.7/site-packages
Requires:
Required-by: scipy, numpy-quaternion, pandas, matplotlib, imgaug, fcn, cupy-cuda101, chainer
I think draw_rects for non ascii characters is great, but can't this feature be merged into draw_rects.cpp? |
I got the following error.
My environment is
|
@708yamaguchi @tkmtnt7000 |
That is the best solution. However, the old opencv doesn't support utf-8 in putText. The good thing about this PR is that the put_text_to_image function has been added to jsk_recognition_utils, so it can be easily used in other python programs. Replacing the put_text_to_image function with a program that uses putText internally, such as LabelImageDecomposer, is a future direction. |
Sorry, I understand. This error is not related to this PR.
I see. Thank you for your explanation. |
It seems that |
OK. I added it.
What is the result of running the following program?
|
I fixed the problem. 4f6c797 |
It works, too! Thank you. I think |
I am sorry, I put jsk_recognition in a clean environment and I confirmed
|
which function depends on numpy>=1.16
--
◉ Kei Okada
2021年12月23日(木) 13:47 Naoto Tsukamoto ***@***.***>:
… ***@***.**** approved this pull request.
—
Reply to this email directly, view it on GitHub
<#2648 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADYNXHCOYB5IJTSYT4MKXTUSKSSNANCNFSM5KR6ZBRQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
cc:@708yamaguchi labelcolormapの内部で行われていること
numpy/numpy#12785
|
#2648 requires jsk_data package
What is this?
The current
draw_rects
node cannot draw non-accii chracters such as Japanese.This PR adds a new node to draw text using the PIL feature to draw non-ascii characters.
The sample program (
sample_draw_rects_for_non_ascii_labels.launch
) needs to buildjsk_recognition_utils
in order to install Japanese fonts.