Closed Romuns-Nicole closed 4 years ago
The easiest solutions are to run the script within ipython, or to add
input()
at the end of the script so that it doesn't terminate immediately.
Thank you very much.It's stuck when displaying the image, and the image is all white.
Have you tried running it in ipython? What OS and Python version are you using?
I tried running it in ipython.and to add
input() at the end of the script.The image is still stuck when displaying, the image is all white.I use the win10 system.Python3.5
Sorry, it's not obvious to me why you're seeing such strange behaviour. Have you tried in ipython without the input()
?
Thank you very much for your patience in answering my question.I have solved the problem of not displaying the image.I can run the program with jupyter notebook without any problems.I have another question for you, how to test with my own pictures?The following errors occur when I use my own image to test.
1 img = util.ExampleImages().image('timg.png', scaled=True,
----> 2 idxexp=np.s_[160:416,60:316])
C:\Anaconda3\envs\tensorflow19\lib\site-packages\sporco\util.py in image(self, fname, group, scaled, dtype, idxexp, zoom, gray) 1098 except IOError: 1099 raise IOError('Could not access image %s in group %s' % -> 1100 (fname, group)) 1101 1102 if scaled:
OSError: Could not access image timg.png in group None
If you want to load your own images using sporco.util.ExampleImages
you need to set the path to the directory containing your images using the pth
parameter of the constructor (see the docs for details). For loading a single image, however, it may be simpler to use imageio.imread.
from future import print_function from builtins import input from builtins import range
import pyfftw # See https://github.com/pyFFTW/pyFFTW/issues/40 import numpy as np
from sporco import util from sporco import plot plot.config_notebook_plotting() import sporco.metric as sm from sporco.admm import cbpdn
img = util.ExampleImages().image('kodim23.png', scaled=True, gray=True, idxexp=np.s_[160:416,60:316])
npd = 16 fltlmbd = 10 sl, sh = util.tikhonov_filter(img, fltlmbd, npd)
D = util.convdicts()['G:12x12x36'] plot.imview(util.tiledict(D), fgsz=(7, 7))
Show the image appear below disappear, how should I solve?