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

    <tfoot id='eSQJp'></tfoot>
  • <small id='eSQJp'></small><noframes id='eSQJp'>

        <legend id='eSQJp'><style id='eSQJp'><dir id='eSQJp'><q id='eSQJp'></q></dir></style></legend>
          <bdo id='eSQJp'></bdo><ul id='eSQJp'></ul>

        Matplotlib imshow 和 kivy

        Matplotlib imshow and kivy(Matplotlib imshow 和 kivy)

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

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

                <bdo id='uQEea'></bdo><ul id='uQEea'></ul>
              • <legend id='uQEea'><style id='uQEea'><dir id='uQEea'><q id='uQEea'></q></dir></style></legend>
                    <tbody id='uQEea'></tbody>
                  本文介绍了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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Kivy 1.9.0 Windows package KeyError: #39;rthooks#39;(Kivy 1.9.0 Windows 包 KeyError: rthooks)
                  Python Kivy: how to call a function on button click?(Python Kivy:如何在按钮单击时调用函数?)
                  How to disable a widget in Kivy?(如何禁用 Kivy 中的小部件?)
                  Centering an object in Kivy(在 Kivy 中将对象居中)
                  How to downgrade to Python 3.4 from 3.5(如何从 Python 3.5 降级到 Python 3.4)
                  Change button or label text color in kivy(在kivy中更改按钮或标签文本颜色)
                    <bdo id='peGE3'></bdo><ul id='peGE3'></ul>
                  • <i id='peGE3'><tr id='peGE3'><dt id='peGE3'><q id='peGE3'><span id='peGE3'><b id='peGE3'><form id='peGE3'><ins id='peGE3'></ins><ul id='peGE3'></ul><sub id='peGE3'></sub></form><legend id='peGE3'></legend><bdo id='peGE3'><pre id='peGE3'><center id='peGE3'></center></pre></bdo></b><th id='peGE3'></th></span></q></dt></tr></i><div id='peGE3'><tfoot id='peGE3'></tfoot><dl id='peGE3'><fieldset id='peGE3'></fieldset></dl></div>

                      <tbody id='peGE3'></tbody>

                          <legend id='peGE3'><style id='peGE3'><dir id='peGE3'><q id='peGE3'></q></dir></style></legend>
                        • <tfoot id='peGE3'></tfoot>

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