0

I have an issue to display the filled contours while is overly on another image. Currently it display me the unfilled contours. any comment would appreciated.

plt.imshow(t_image.detach().cpu().squeeze(), cmap='gray')
plt.contourf(filter_canny_predicted, colors='red') 
plt.contourf(filter_canny_mask, colors='green')
plt.autoscale() 
plt.show()

the above snippet will display this image which is not filled contours. enter image description here

based on answer in here

I added set_rasterized to the snippet and couldn't figure out for both contours and also my background image gone. this is snippet when I tried for the filled contour with rasetrized

  fig, (ax1) = plt.subplots(nrows=1, ncols=1, sharex=True, sharey=True)
ax1.imshow(t_image.detach().cpu().squeeze(), cmap='gray')
cs = ax1.contourf(filter_canny_predicted) 
css = ax1.contourf(filter_canny_mask)
ax1.axis('on')
ax1.autoscale()         
#ax1.tight_layout(pad=0.01, w_pad=0.002, h_pad=1)
for c in cs.collections:
    c.set_rasterized(True)
for cc in css.collections:
    cc.set_rasterized(True)
plt.show()   

and it produce this image which is not my requirement. enter image description here

in order to clarify the filter_canny_predicted is red one and filter_canny_mask is yellow one.

enter image description here

AI_NA
  • 336
  • 2
  • 5
  • 20
  • You mean you want us to find out how the array `filter_canny_predicted` looks like such that it would produce the image shown? Normally it's the inverse: You would provide a [mcve] and ask for a reason why it wouldn't work. – ImportanceOfBeingErnest Jan 08 '19 at 18:23
  • – ImportanceOfBeingErnest I thought I gave enough information. Anyway I did edit the question. – AI_NA Jan 08 '19 at 19:05
  • Mhh, so `rasterized` seems pretty irrelevant here. Just a wild guess, because no verifiable example is given: Your `filter_canny_predicted` array already contains contoured data. Possibly this is even a binary array (only containing zeros and ones). Then drawing another contour of that array will in general result in a double line. – ImportanceOfBeingErnest Jan 08 '19 at 19:26

0 Answers0