mein Bildanalyse-Projekt (hier mal ansatzweise erklärt) gedeiht ganz gut, jetzt stolpere ich über ein Problem mit o.g. Funktion. Vor ein paar Wochen funktionierte das wunderbar, dann hab ich an anderen Programmteilen gebastelt und dazu das Plotting auskommentiert, jetzt geht es irgendwie nicht mehr, ich krieg immer folgende Fehlermeldung:
Code: Alles auswählen
File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/skimage/segmentation/boundaries.py", line 38, in mark_boundaries
image[outer_boundaries != 0, :] = np.array(outline_color)
ValueError: array is not broadcastable to correct shape
Code: Alles auswählen
from skimage.segmentation import mark_boundaries
import matplotlib.pyplot as plt
plt.figure(figsize=(18,9))
plt.subplot(131)
plt.imshow(image)
plt.axis('off')
plt.subplot(132)
plt.imshow(mark_boundaries(image, image_labels))
plt.axis('off')
plt.subplot(133)
plt.imshow(mark_boundaries(image, new_labels))
plt.axis('off')
plt.subplots_adjust(wspace=0.02, hspace=0.02, top=1, bottom=0, left=0, right=1)
plt.show()
Code: Alles auswählen
image = [[[252 172 71 255]
[255 172 74 255]
[255 164 59 255]
[250 148 51 255]
[237 135 47 255]
[236 138 48 255]
[230 136 47 255]
[233 136 47 255]
[244 148 52 255]
[246 152 55 255]
[227 132 45 255]
[181 100 33 255]]
[[248 157 65 255]
[254 162 78 255]
[255 162 66 255]
[255 161 58 255]
[239 136 47 255]
[223 126 43 255]
[215 120 41 255]
[235 136 47 255]
[251 153 55 255]
[254 161 60 255]
[249 154 54 255]
[209 117 40 255]]
[[255 203 69 255]
[254 209 73 255]
[254 207 72 255]
[255 197 68 255]
[240 152 52 255]
[221 121 42 255]
[245 149 51 255]
[254 166 63 255]
[252 159 58 255]
[254 162 62 255]
[246 151 53 255]
[211 117 39 255]]
[[255 217 74 255]
[255 219 74 255]
[255 211 72 255]
[255 199 68 255]
[255 176 61 255]
[252 153 53 255]
[255 166 58 255]
[255 172 66 255]
[255 169 64 255]
[255 173 76 255]
[254 170 74 255]
[227 136 47 255]]
[[246 176 60 255]
[237 156 54 255]
[225 132 46 255]
[227 125 44 255]
[230 126 44 255]
[246 147 51 255]
[255 163 57 255]
[255 171 68 255]
[255 170 67 255]
[255 169 68 255]
[255 168 69 255]
[244 151 52 255]]
[[195 100 34 255]
[200 101 34 255]
[203 103 35 255]
[202 104 36 255]
[201 102 35 255]
[216 117 40 255]
[244 141 49 255]
[250 153 55 255]
[251 153 56 255]
[251 156 53 255]
[246 149 49 255]
[226 133 46 255]]
[[148 83 25 255]
[171 92 30 255]
[179 94 31 255]
[185 96 32 255]
[210 110 38 255]
[216 116 40 255]
[214 115 40 255]
[233 126 43 255]
[237 128 44 255]
[238 133 46 255]
[238 139 49 255]
[216 124 42 255]]
[[119 63 18 255]
[140 73 22 255]
[161 83 26 255]
[181 93 31 255]
[199 101 34 255]
[227 119 42 255]
[214 114 39 255]
[232 128 45 255]
[230 127 44 255]
[223 122 42 255]
[207 114 39 255]
[182 101 33 255]]]
image_labels = [[ 0 0 23 23 23 23 5 5 5 5 5 5]
[ 0 0 23 23 23 23 5 5 5 5 11 5]
[ 0 0 23 23 5 5 5 11 11 11 11 5]
[ 0 0 23 23 5 5 11 11 11 11 11 11]
[23 23 23 23 23 5 11 11 11 11 11 11]
[23 23 23 23 23 23 23 11 11 11 11 11]
[18 18 23 23 23 23 23 23 23 23 23 23]
[18 18 23 23 23 23 23 23 23 23 23 23]]
new_labels = [[ 0 0 23 23 23 23 5 5 5 5 5 5]
[ 0 0 23 23 23 23 5 5 5 5 11 5]
[ 0 0 23 23 5 5 5 11 11 11 11 5]
[ 0 0 23 23 5 5 11 11 11 11 11 11]
[23 23 23 23 23 5 11 11 11 11 11 11]
[23 23 23 23 23 23 23 11 11 11 11 11]
[18 18 23 23 23 23 23 23 23 23 23 23]
[18 18 23 23 23 23 23 23 23 23 23 23]]