Shape Index example not working
![](https://secure.gravatar.com/avatar/cf9ea3641a4e5ca694a8efa33198aad8.jpg?s=120&d=mm&r=g)
Hi everybody, first of all I wish you a happy new year :) I have a problem with the Shape Index <http://scikit-image.org/docs/dev/auto_examples/features_detection/plot_shape_index.html#sphx-glr-auto-examples-features-detection-plot-shape-index-py>example. When I try with my image (shape (778, 1802, 3)) I am getting the following error message: Traceback (most recent call last): File "C:/Users/stefanie/PycharmProjects/BluVision/Testing/shape_index.py", line 16, in <module> s = shape_index(image) File "D:\Anaconda\lib\site-packages\skimage\feature\corner.py", line 419, in shape_index l1, l2 = hessian_matrix_eigvals(H) ValueError: too many values to unpack (expected 2) System: scikit-image 0.14.1 Windows 10 Python 3.6 Any suggestions? Thanks Stefanie
![](https://secure.gravatar.com/avatar/36b04adcdce59af3ecbdec908fa4158f.jpg?s=120&d=mm&r=g)
Hi Stefanie, happy new year to you too :-). I had a quick look at the code of feature.shape_index, and the function requires a 2D (hence grayscale image). Can you check that the function works on color.rgb2gray(image)? This also means that the docstring is incorrect, we should say image: 2D array instead of image : ndarray Would you mind opening an issue for this? (or even submitting a pull request?) All the best Emma On Tue, Jan 01, 2019 at 08:48:52PM +0100, Stefanie Lück wrote:
Hi everybody,
first of all I wish you a happy new year :)
I have a problem with the Shape Index example. When I try with my image (shape (778, 1802, 3)) I am getting the following error message:
Traceback (most recent call last): File "C:/Users/stefanie/PycharmProjects/BluVision/Testing/shape_index.py", line 16, in <module> s = shape_index(image) File "D:\Anaconda\lib\site-packages\skimage\feature\corner.py", line 419, in shape_index l1, l2 = hessian_matrix_eigvals(H) ValueError: too many values to unpack (expected 2)
System: scikit-image 0.14.1 Windows 10 Python 3.6
Any suggestions? Thanks Stefanie
_______________________________________________ scikit-image mailing list -- scikit-image@python.org To unsubscribe send an email to scikit-image-leave@python.org
![](https://secure.gravatar.com/avatar/cf9ea3641a4e5ca694a8efa33198aad8.jpg?s=120&d=mm&r=g)
Hi Emma, thanks for you reply, I tried already to load the image as gray scale and after your suggestion to convert the image (should be the same) but I got the following error message: RuntimeWarning: divide by zero encountered in true_divide return (2.0 / np.pi) * np.arctan((l2 + l1) / (l2 - l1)) D:\Anaconda\lib\site-packages\skimage\feature\corner.py:421: RuntimeWarning: invalid value encountered in true_divide return (2.0 / np.pi) * np.arctan((l2 + l1) / (l2 - l1)) C:/Users/stefanie/PycharmProjects/BluVision/Testing/shape_index.py:27: RuntimeWarning: invalid value encountered in less point_y, point_x = np.where(np.abs(s - target) < delta) C:/Users/stefanie/PycharmProjects/BluVision/Testing/shape_index.py:36: RuntimeWarning: invalid value encountered in less point_y_s, point_x_s = np.where(np.abs(s_smooth - target) < delta) Traceback (most recent call last): File "C:/Users/stefanie/PycharmProjects/BluVision/Testing/shape_index.py", line 59, in <module> ax2.plot_surface(x, y, image, linewidth=0, alpha=0.5) File "D:\Anaconda\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line 1612, in plot_surface X, Y, Z = np.broadcast_arrays(X, Y, Z) File "D:\Anaconda\lib\site-packages\numpy\lib\stride_tricks.py", line 252, in broadcast_arrays shape = _broadcast_shape(*args) File "D:\Anaconda\lib\site-packages\numpy\lib\stride_tricks.py", line 187, in _broadcast_shape b = np.broadcast(*args[:32]) ValueError: shape mismatch: objects cannot be broadcast to a single shape I would love to open an issue or even to try a pull request. Since this would be the first time, I would need some help and might come back to you if it is OK for you. I notice quite often an uncertainty in the documentation about loading images, so I am glad to help to improve it. Cheers Stefanie Am Di., 1. Jan. 2019 um 22:50 Uhr schrieb Emmanuelle Gouillart < emmanuelle.gouillart@normalesup.org>:
Hi Stefanie,
happy new year to you too :-). I had a quick look at the code of feature.shape_index, and the function requires a 2D (hence grayscale image). Can you check that the function works on color.rgb2gray(image)?
This also means that the docstring is incorrect, we should say
image: 2D array
instead of
image : ndarray
Would you mind opening an issue for this? (or even submitting a pull request?)
All the best Emma
On Tue, Jan 01, 2019 at 08:48:52PM +0100, Stefanie Lück wrote:
Hi everybody,
first of all I wish you a happy new year :)
I have a problem with the Shape Index example. When I try with my image (shape (778, 1802, 3)) I am getting the following error message:
Traceback (most recent call last): File "C:/Users/stefanie/PycharmProjects/BluVision/Testing/shape_index.py", line 16, in <module> s = shape_index(image) File "D:\Anaconda\lib\site-packages\skimage\feature\corner.py", line 419, in shape_index l1, l2 = hessian_matrix_eigvals(H) ValueError: too many values to unpack (expected 2)
System: scikit-image 0.14.1 Windows 10 Python 3.6
Any suggestions? Thanks Stefanie
_______________________________________________ scikit-image mailing list -- scikit-image@python.org To unsubscribe send an email to scikit-image-leave@python.org
scikit-image mailing list -- scikit-image@python.org To unsubscribe send an email to scikit-image-leave@python.org
![](https://secure.gravatar.com/avatar/cf9ea3641a4e5ca694a8efa33198aad8.jpg?s=120&d=mm&r=g)
As Emma pointed out, an image and the code would be helpful to solve the problem. I can't sent the image because of confidentiality reasons but I have the problem with other images too... Cheers Stefanie Am Mi., 2. Jan. 2019 um 12:11 Uhr schrieb Stefanie Lück <luecks@gmail.com>:
Hi Emma,
thanks for you reply, I tried already to load the image as gray scale and after your suggestion to convert the image (should be the same) but I got the following error message:
RuntimeWarning: divide by zero encountered in true_divide return (2.0 / np.pi) * np.arctan((l2 + l1) / (l2 - l1)) D:\Anaconda\lib\site-packages\skimage\feature\corner.py:421: RuntimeWarning: invalid value encountered in true_divide return (2.0 / np.pi) * np.arctan((l2 + l1) / (l2 - l1)) C:/Users/stefanie/PycharmProjects/BluVision/Testing/shape_index.py:27: RuntimeWarning: invalid value encountered in less point_y, point_x = np.where(np.abs(s - target) < delta) C:/Users/stefanie/PycharmProjects/BluVision/Testing/shape_index.py:36: RuntimeWarning: invalid value encountered in less point_y_s, point_x_s = np.where(np.abs(s_smooth - target) < delta) Traceback (most recent call last): File "C:/Users/stefanie/PycharmProjects/BluVision/Testing/shape_index.py", line 59, in <module> ax2.plot_surface(x, y, image, linewidth=0, alpha=0.5) File "D:\Anaconda\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line 1612, in plot_surface X, Y, Z = np.broadcast_arrays(X, Y, Z) File "D:\Anaconda\lib\site-packages\numpy\lib\stride_tricks.py", line 252, in broadcast_arrays shape = _broadcast_shape(*args) File "D:\Anaconda\lib\site-packages\numpy\lib\stride_tricks.py", line 187, in _broadcast_shape b = np.broadcast(*args[:32]) ValueError: shape mismatch: objects cannot be broadcast to a single shape
I would love to open an issue or even to try a pull request. Since this would be the first time, I would need some help and might come back to you if it is OK for you. I notice quite often an uncertainty in the documentation about loading images, so I am glad to help to improve it.
Cheers Stefanie
Am Di., 1. Jan. 2019 um 22:50 Uhr schrieb Emmanuelle Gouillart < emmanuelle.gouillart@normalesup.org>:
Hi Stefanie,
happy new year to you too :-). I had a quick look at the code of feature.shape_index, and the function requires a 2D (hence grayscale image). Can you check that the function works on color.rgb2gray(image)?
This also means that the docstring is incorrect, we should say
image: 2D array
instead of
image : ndarray
Would you mind opening an issue for this? (or even submitting a pull request?)
All the best Emma
On Tue, Jan 01, 2019 at 08:48:52PM +0100, Stefanie Lück wrote:
Hi everybody,
first of all I wish you a happy new year :)
I have a problem with the Shape Index example. When I try with my image (shape (778, 1802, 3)) I am getting the following error message:
Traceback (most recent call last): File "C:/Users/stefanie/PycharmProjects/BluVision/Testing/shape_index.py", line 16, in <module> s = shape_index(image) File "D:\Anaconda\lib\site-packages\skimage\feature\corner.py", line 419, in shape_index l1, l2 = hessian_matrix_eigvals(H) ValueError: too many values to unpack (expected 2)
System: scikit-image 0.14.1 Windows 10 Python 3.6
Any suggestions? Thanks Stefanie
_______________________________________________ scikit-image mailing list -- scikit-image@python.org To unsubscribe send an email to scikit-image-leave@python.org
scikit-image mailing list -- scikit-image@python.org To unsubscribe send an email to scikit-image-leave@python.org
![](https://secure.gravatar.com/avatar/36b04adcdce59af3ecbdec908fa4158f.jpg?s=120&d=mm&r=g)
The problem is not with shape_index any more, x, y and image have transposed dimensions. If you replace ax2.plot_surface(x, y, image, linewidth=0, alpha=0.5) with ax2.plot_surface(x.T, y.T, image, linewidth=0, alpha=0.5) it works. Cheers Emma On Wed, Jan 02, 2019 at 03:54:29PM +0100, Stefanie Lück wrote:
As Emma pointed out, an image and the code would be helpful to solve the problem. I can't sent the image because of confidentiality reasons but I have the problem with other images too...
Cheers Stefanie
Am Mi., 2. Jan. 2019 um 12:11 Uhr schrieb Stefanie Lück <luecks@gmail.com>:
Hi Emma,
thanks for you reply, I tried already to load the image as gray scale and after your suggestion to convert the image (should be the same) but I got the following error message:
RuntimeWarning: divide by zero encountered in true_divide return (2.0 / np.pi) * np.arctan((l2 + l1) / (l2 - l1)) D:\Anaconda\lib\site-packages\skimage\feature\corner.py:421: RuntimeWarning: invalid value encountered in true_divide return (2.0 / np.pi) * np.arctan((l2 + l1) / (l2 - l1)) C:/Users/stefanie/PycharmProjects/BluVision/Testing/shape_index.py:27: RuntimeWarning: invalid value encountered in less point_y, point_x = np.where(np.abs(s - target) < delta) C:/Users/stefanie/PycharmProjects/BluVision/Testing/shape_index.py:36: RuntimeWarning: invalid value encountered in less point_y_s, point_x_s = np.where(np.abs(s_smooth - target) < delta) Traceback (most recent call last): File "C:/Users/stefanie/PycharmProjects/BluVision/Testing/ shape_index.py", line 59, in <module> ax2.plot_surface(x, y, image, linewidth=0, alpha=0.5) File "D:\Anaconda\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line 1612, in plot_surface X, Y, Z = np.broadcast_arrays(X, Y, Z) File "D:\Anaconda\lib\site-packages\numpy\lib\stride_tricks.py", line 252, in broadcast_arrays shape = _broadcast_shape(*args) File "D:\Anaconda\lib\site-packages\numpy\lib\stride_tricks.py", line 187, in _broadcast_shape b = np.broadcast(*args[:32]) ValueError: shape mismatch: objects cannot be broadcast to a single shape
I would love to open an issue or even to try a pull request. Since this would be the first time, I would need some help and might come back to you if it is OK for you. I notice quite often an uncertainty in the documentation about loading images, so I am glad to help to improve it.
Cheers Stefanie
Am Di., 1. Jan. 2019 um 22:50 Uhr schrieb Emmanuelle Gouillart < emmanuelle.gouillart@normalesup.org>:
Hi Stefanie,
happy new year to you too :-). I had a quick look at the code of feature.shape_index, and the function requires a 2D (hence grayscale image). Can you check that the function works on color.rgb2gray(image)?
This also means that the docstring is incorrect, we should say
image: 2D array
instead of
image : ndarray
Would you mind opening an issue for this? (or even submitting a pull request?)
All the best Emma
On Tue, Jan 01, 2019 at 08:48:52PM +0100, Stefanie Lück wrote: > Hi everybody,
> first of all I wish you a happy new year :)
> I have a problem with the Shape Index example. When I try with my image (shape > (778, 1802, 3)) I am getting the following error message:
> Traceback (most recent call last): > File "C:/Users/stefanie/PycharmProjects/BluVision/Testing/ shape_index.py", > line 16, in <module> > s = shape_index(image) > File "D:\Anaconda\lib\site-packages\skimage\feature\corner.py", line 419, in > shape_index > l1, l2 = hessian_matrix_eigvals(H) > ValueError: too many values to unpack (expected 2)
> System: > scikit-image 0.14.1 > Windows 10 > Python 3.6
> Any suggestions? > Thanks > Stefanie
> _______________________________________________ > scikit-image mailing list -- scikit-image@python.org > To unsubscribe send an email to scikit-image-leave@python.org _______________________________________________ scikit-image mailing list -- scikit-image@python.org To unsubscribe send an email to scikit-image-leave@python.org
_______________________________________________ scikit-image mailing list -- scikit-image@python.org To unsubscribe send an email to scikit-image-leave@python.org
![](https://secure.gravatar.com/avatar/cf9ea3641a4e5ca694a8efa33198aad8.jpg?s=120&d=mm&r=g)
Thanks Emma, I see. It worked now... Am Mi., 2. Jan. 2019 um 16:36 Uhr schrieb Emmanuelle Gouillart < emmanuelle.gouillart@normalesup.org>:
The problem is not with shape_index any more, x, y and image have transposed dimensions. If you replace ax2.plot_surface(x, y, image, linewidth=0, alpha=0.5) with ax2.plot_surface(x.T, y.T, image, linewidth=0, alpha=0.5) it works. Cheers Emma
On Wed, Jan 02, 2019 at 03:54:29PM +0100, Stefanie Lück wrote:
As Emma pointed out, an image and the code would be helpful to solve the problem. I can't sent the image because of confidentiality reasons but I have the problem with other images too...
Cheers Stefanie
Am Mi., 2. Jan. 2019 um 12:11 Uhr schrieb Stefanie Lück < luecks@gmail.com>:
Hi Emma,
thanks for you reply, I tried already to load the image as gray
scale and
after your suggestion to convert the image (should be the same) but
I got
the following error message:
RuntimeWarning: divide by zero encountered in true_divide return (2.0 / np.pi) * np.arctan((l2 + l1) / (l2 - l1)) D:\Anaconda\lib\site-packages\skimage\feature\corner.py:421: RuntimeWarning: invalid value encountered in true_divide return (2.0 / np.pi) * np.arctan((l2 + l1) / (l2 - l1))
C:/Users/stefanie/PycharmProjects/BluVision/Testing/shape_index.py:27:
RuntimeWarning: invalid value encountered in less point_y, point_x = np.where(np.abs(s - target) < delta)
C:/Users/stefanie/PycharmProjects/BluVision/Testing/shape_index.py:36:
RuntimeWarning: invalid value encountered in less point_y_s, point_x_s = np.where(np.abs(s_smooth - target) < delta) Traceback (most recent call last): File "C:/Users/stefanie/PycharmProjects/BluVision/Testing/ shape_index.py", line 59, in <module> ax2.plot_surface(x, y, image, linewidth=0, alpha=0.5) File
"D:\Anaconda\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line
1612, in plot_surface X, Y, Z = np.broadcast_arrays(X, Y, Z) File "D:\Anaconda\lib\site-packages\numpy\lib\stride_tricks.py",
line
252, in broadcast_arrays shape = _broadcast_shape(*args) File "D:\Anaconda\lib\site-packages\numpy\lib\stride_tricks.py",
line
187, in _broadcast_shape b = np.broadcast(*args[:32]) ValueError: shape mismatch: objects cannot be broadcast to a single
shape
I would love to open an issue or even to try a pull request. Since
this
would be the first time, I would need some help and might come back
to you
if it is OK for you. I notice quite often an uncertainty in the documentation about loading images, so I am glad to help to improve
it.
Cheers Stefanie
Am Di., 1. Jan. 2019 um 22:50 Uhr schrieb Emmanuelle Gouillart < emmanuelle.gouillart@normalesup.org>:
Hi Stefanie,
happy new year to you too :-). I had a quick look at the code of feature.shape_index, and the function requires a 2D (hence
grayscale
image). Can you check that the function works on
color.rgb2gray(image)?
This also means that the docstring is incorrect, we should say
image: 2D array
instead of
image : ndarray
Would you mind opening an issue for this? (or even submitting a
pull
request?)
All the best Emma
On Tue, Jan 01, 2019 at 08:48:52PM +0100, Stefanie Lück wrote: > Hi everybody,
> first of all I wish you a happy new year :)
> I have a problem with the Shape Index example. When I try with
my
image (shape > (778, 1802, 3)) I am getting the following error message:
> Traceback (most recent call last): > File "C:/Users/stefanie/PycharmProjects/BluVision/Testing/ shape_index.py", > line 16, in <module> > s = shape_index(image) > File
"D:\Anaconda\lib\site-packages\skimage\feature\corner.py",
line 419, in > shape_index > l1, l2 = hessian_matrix_eigvals(H) > ValueError: too many values to unpack (expected 2)
> System: > scikit-image 0.14.1 > Windows 10 > Python 3.6
> Any suggestions? > Thanks > Stefanie
> _______________________________________________ > scikit-image mailing list -- scikit-image@python.org > To unsubscribe send an email to scikit-image-leave@python.org _______________________________________________ scikit-image mailing list -- scikit-image@python.org To unsubscribe send an email to scikit-image-leave@python.org
_______________________________________________ scikit-image mailing list -- scikit-image@python.org To unsubscribe send an email to scikit-image-leave@python.org
![](https://secure.gravatar.com/avatar/008b55030cffb9a4c4f7d8422e10343e.jpg?s=120&d=mm&r=g)
Hi Stefanie, and happy now year to you too!
On 2 Jan 2019, at 6:48 am, Stefanie Lück <luecks@gmail.com> wrote: I have a problem with the Shape Index <http://scikit-image.org/docs/dev/auto_examples/features_detection/plot_shape_index.html#sphx-glr-auto-examples-features-detection-plot-shape-index-py>example. When I try with my image (shape (778, 1802, 3)) I am getting the following error message:
Ah! So it turns out, despite our documentation <http://scikit-image.org/docs/dev/api/skimage.feature.html#skimage.feature.sh...> being unclear about this, that this function can only take 2D arrays. So you need to somehow convert your colour image to a grayscale one. The easiest way is with color.rgb2gray, but a different method might be appropriate for your data (e.g. computing the index separately for each channel). Juan.
participants (3)
-
Emmanuelle Gouillart
-
Juan Nunez-Iglesias
-
Stefanie Lück