Hi Riley On Thu, Aug 3, 2017, at 14:31, Riley Myers wrote: > I'm currently using matplotlib 2.0.2, which seems to be the most > recent that I can get with `conda install` or `conda> update`. Should I take > this up with their development team instead? > > As before: > >>> import matplotlib print(matplotlib.__version__) > 2..2 The error does seem to result in a change between skimage 0.13 and 0.14dev0. Here is the relevant patch:
commit dcec9cdfd630f555216eb4105652fceb0f943dac Author: Gregory R. Lee <grle...@gmail.com> Date: Fri May 5 08:53:30 2017 -0400 BUG: make the color array in plot_matches 1D Using a 2D array is unecessary and causes a crash for Matplotlib 2.0.1 diff --git a/skimage/feature/util.py b/skimage/feature/util.py index b0c66986..fdb1b67e 100644 --- a/skimage/feature/util.py +++ b/skimage/feature/util.py @@ -114,7 +114,7 @@ def plot_matches(ax, image1, image2, keypoints1, keypoints2, matches, idx2 = matches[i, 1] if matches_color is None: - color = np.random.rand(3, 1) + color = np.random.rand(3) else: color = matches_color Your options are: 1. Use the attached version of plot_matches or 2. to upgrade to the source version of scikit-image Best regards Stéfan
import numpy as np import matplotlib.pyplot as plt from skimage import io, img_as_float from skimage.color import rgb2gray from skimage.feature import ORB, match_descriptors def plot_matches(ax, image1, image2, keypoints1, keypoints2, matches, keypoints_color='k', matches_color=None, only_matches=False): """Plot matched features. Parameters ---------- ax : matplotlib.axes.Axes Matches and image are drawn in this ax. image1 : (N, M [, 3]) array First grayscale or color image. image2 : (N, M [, 3]) array Second grayscale or color image. keypoints1 : (K1, 2) array First keypoint coordinates as ``(row, col)``. keypoints2 : (K2, 2) array Second keypoint coordinates as ``(row, col)``. matches : (Q, 2) array Indices of corresponding matches in first and second set of descriptors, where ``matches[:, 0]`` denote the indices in the first and ``matches[:, 1]`` the indices in the second set of descriptors. keypoints_color : matplotlib color, optional Color for keypoint locations. matches_color : matplotlib color, optional Color for lines which connect keypoint matches. By default the color is chosen randomly. only_matches : bool, optional Whether to only plot matches and not plot the keypoint locations. """ image1 = img_as_float(image1) image2 = img_as_float(image2) new_shape1 = list(image1.shape) new_shape2 = list(image2.shape) if image1.shape[0] < image2.shape[0]: new_shape1[0] = image2.shape[0] elif image1.shape[0] > image2.shape[0]: new_shape2[0] = image1.shape[0] if image1.shape[1] < image2.shape[1]: new_shape1[1] = image2.shape[1] elif image1.shape[1] > image2.shape[1]: new_shape2[1] = image1.shape[1] if new_shape1 != image1.shape: new_image1 = np.zeros(new_shape1, dtype=image1.dtype) new_image1[:image1.shape[0], :image1.shape[1]] = image1 image1 = new_image1 if new_shape2 != image2.shape: new_image2 = np.zeros(new_shape2, dtype=image2.dtype) new_image2[:image2.shape[0], :image2.shape[1]] = image2 image2 = new_image2 image = np.concatenate([image1, image2], axis=1) offset = image1.shape if not only_matches: ax.scatter(keypoints1[:, 1], keypoints1[:, 0], facecolors='none', edgecolors=keypoints_color) ax.scatter(keypoints2[:, 1] + offset[1], keypoints2[:, 0], facecolors='none', edgecolors=keypoints_color) ax.imshow(image, interpolation='nearest', cmap='gray') ax.axis((0, 2 * offset[1], offset[0], 0)) for i in range(matches.shape[0]): idx1 = matches[i, 0] idx2 = matches[i, 1] if matches_color is None: color = np.random.rand(3) else: color = matches_color ax.plot((keypoints1[idx1, 1], keypoints2[idx2, 1] + offset[1]), (keypoints1[idx1, 0], keypoints2[idx2, 0]), '-', color=color) pano_imgs = io.ImageCollection('./JDW_9*') # Make grayscale versions of the three color images in pano_imgs # named pano0, pano1, and pano2 p0 = rgb2gray(pano_imgs[0]) p1 = rgb2gray(pano_imgs[1]) p2 = rgb2gray(pano_imgs[2]) # Initialize ORB orb = ORB(n_keypoints=800, fast_threshold=0.05) # Detect keypoints in pano0 orb.detect_and_extract(p0) keypoints0 = orb.keypoints descriptors0 = orb.descriptors # Detect keypoints in pano1 and pano2 orb.detect_and_extract(p1) keypoints1 = orb.keypoints descriptors1 = orb.descriptors orb.detect_and_extract(p2) keypoints2 = orb.keypoints descriptors2 = orb.descriptors # Match descriptors between left/right images and the center matches01 = match_descriptors(descriptors0, descriptors1, cross_check=True) matches12 = match_descriptors(descriptors1, descriptors2, cross_check=True) fig, ax = plt.subplots(1, 1, figsize=(12, 12)) # Best match subset for pano0 -> pano1 plot_matches(ax, p0, p1, keypoints0, keypoints1, matches01) ax.axis('off'); plt.show()
_______________________________________________ scikit-image mailing list scikit-image@python.org https://mail.python.org/mailman/listinfo/scikit-image