Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The image drawn by sporco.plot is not displayed #15

Closed
Romuns-Nicole opened this issue Mar 29, 2020 · 7 comments
Closed

The image drawn by sporco.plot is not displayed #15

Romuns-Nicole opened this issue Mar 29, 2020 · 7 comments

Comments

@Romuns-Nicole
Copy link

from future import print_function
from builtins import input
from builtins import range

import pyfftw # See pyFFTW/pyFFTW#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?

@bwohlberg
Copy link
Owner

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.

@Romuns-Nicole
Copy link
Author

Thank you very much.It's stuck when displaying the image, and the image is all white.

@bwohlberg
Copy link
Owner

Have you tried running it in ipython? What OS and Python version are you using?

@Romuns-Nicole
Copy link
Author

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

@bwohlberg
Copy link
Owner

Sorry, it's not obvious to me why you're seeing such strange behaviour. Have you tried in ipython without the input()?

@Romuns-Nicole
Copy link
Author

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

@bwohlberg
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants