<small id='Za8mS'></small><noframes id='Za8mS'>

  • <i id='Za8mS'><tr id='Za8mS'><dt id='Za8mS'><q id='Za8mS'><span id='Za8mS'><b id='Za8mS'><form id='Za8mS'><ins id='Za8mS'></ins><ul id='Za8mS'></ul><sub id='Za8mS'></sub></form><legend id='Za8mS'></legend><bdo id='Za8mS'><pre id='Za8mS'><center id='Za8mS'></center></pre></bdo></b><th id='Za8mS'></th></span></q></dt></tr></i><div id='Za8mS'><tfoot id='Za8mS'></tfoot><dl id='Za8mS'><fieldset id='Za8mS'></fieldset></dl></div>

      1. <tfoot id='Za8mS'></tfoot>
      2. <legend id='Za8mS'><style id='Za8mS'><dir id='Za8mS'><q id='Za8mS'></q></dir></style></legend>
          <bdo id='Za8mS'></bdo><ul id='Za8mS'></ul>
      3. Matplotlib imshow 和 kivy

        时间:2023-10-09
          <tbody id='NKhsj'></tbody>
        <legend id='NKhsj'><style id='NKhsj'><dir id='NKhsj'><q id='NKhsj'></q></dir></style></legend>
          <bdo id='NKhsj'></bdo><ul id='NKhsj'></ul>

            • <small id='NKhsj'></small><noframes id='NKhsj'>

                  <i id='NKhsj'><tr id='NKhsj'><dt id='NKhsj'><q id='NKhsj'><span id='NKhsj'><b id='NKhsj'><form id='NKhsj'><ins id='NKhsj'></ins><ul id='NKhsj'></ul><sub id='NKhsj'></sub></form><legend id='NKhsj'></legend><bdo id='NKhsj'><pre id='NKhsj'><center id='NKhsj'></center></pre></bdo></b><th id='NKhsj'></th></span></q></dt></tr></i><div id='NKhsj'><tfoot id='NKhsj'></tfoot><dl id='NKhsj'><fieldset id='NKhsj'></fieldset></dl></div>
                1. <tfoot id='NKhsj'></tfoot>
                  本文介绍了Matplotlib imshow 和 kivy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我有一个 3D numpy 数组,代表一个 3D 断层图像 I = [i,j,k].

                  我开始学习 kivy,因为我需要做一个简单的 GUI,该 GUI 由一个 2D 图像查看器组成,用于 3D (s = [i,:,:]) 图像的每个切片和一个用于跨平面移动的切片器.

                  我通常通过 matplotlib 执行所有可视化,我认为最简单的方法是将 matplotlib 连接到 kivy.我该怎么做?我看到另一个问题,它提出了类似的问题,但仅限于绘图功能,并且该方法似乎不适用于 imshow.(

                  I have a 3D numpy array, representing a 3D tomographic image I = [i,j,k].

                  I started to learn kivy as I need to do a simple GUI consisting of a 2D image viewer for each slice of the 3D (s = [i,:,:]) image and a slicer to move across planes.

                  I usually perform all visualization via matplotlib and I tough that the easiest way will be to connect matplotlib to the kivy. How can I do it? I saw another question which ask a similar question, but only with the plot function, and the methodology does not seems to work for imshow. (How to get started/use matplotlib in kivy).

                  Any suggestions?

                  Thanks,

                  解决方案

                  Please refer to the example for details.

                  Example

                  main.py

                  from kivy.garden.matplotlib.backend_kivyagg import FigureCanvasKivyAgg
                  from kivy.app import App
                  from kivy.uix.boxlayout import BoxLayout
                  import matplotlib.pyplot as plt
                  import matplotlib.image as mpimg
                  
                  
                  img = mpimg.imread('ac013.JPG')
                  lum_img = img[:, :, 0]
                  plt.imshow(lum_img, cmap="nipy_spectral")
                  plt.colorbar()
                  
                  
                  class TestApp(App):
                      title = "Kivy Garden Matplolib & imshow()"
                  
                      def build(self):
                          box = BoxLayout()
                          box.add_widget(FigureCanvasKivyAgg(plt.gcf()))
                          return box
                  
                  
                  if __name__ == "__main__":
                      TestApp().run()
                  

                  Output

                  这篇关于Matplotlib imshow 和 kivy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在 Kivy Python 中显示数学文本? 下一篇:每次数据更改时如何刷新kivy RecycleView?

                  相关文章

                  最新文章

                    <bdo id='2M32j'></bdo><ul id='2M32j'></ul>

                  <legend id='2M32j'><style id='2M32j'><dir id='2M32j'><q id='2M32j'></q></dir></style></legend>
                2. <small id='2M32j'></small><noframes id='2M32j'>

                  1. <i id='2M32j'><tr id='2M32j'><dt id='2M32j'><q id='2M32j'><span id='2M32j'><b id='2M32j'><form id='2M32j'><ins id='2M32j'></ins><ul id='2M32j'></ul><sub id='2M32j'></sub></form><legend id='2M32j'></legend><bdo id='2M32j'><pre id='2M32j'><center id='2M32j'></center></pre></bdo></b><th id='2M32j'></th></span></q></dt></tr></i><div id='2M32j'><tfoot id='2M32j'></tfoot><dl id='2M32j'><fieldset id='2M32j'></fieldset></dl></div>
                    <tfoot id='2M32j'></tfoot>