Imshow on Parallel Computing Toolbox

7 views (last 30 days)
I am converting my code to utilise the Parallel Computing Toolbox and I am getting a peculiar error in an imshow instruction:
Error using imshow (line 209) IMSHOW unable to display image.
Error in GPUDemo (line 9) parfor (HSize = 1:n);
Caused by: Error using imshow (line 209) IMSHOW unable to display image.
line 209 of Imshow is the error message:
if ~images.internal.isFigureAvailable() error(message('images:imshow:needJavaFigure')); end
The error appears only when I use the matlabpool.
Obviously I am using many pools in order to have each pool applying a different value for a parameter (eg. HSize or Sigma in an imfilter) to the image
So I cant quite get the Aprils fool joke here: http://blogs.mathworks.com/steve/?s_cid=global_nav :(
Thank you.

Accepted Answer

Walter Roberson
Walter Roberson on 8 Apr 2013
It is not possible to display graphics from inside a worker. The joke was in saying that it was possible.
Note the reference to the non-existent R2011c, and to running on TRS-80's.
  5 Comments
Dimitris Vayenas
Dimitris Vayenas on 9 Apr 2013
Thank you for your response Walter. Regretfully, it does confirm my fears. I guess it is somehow related to the current implementation of asynchronous processes, usually based on the futures abstraction (which is a mistake if you ask me ;)).
I get your point about the rgb2gray, it "crashes" on the input/datatype validation as I am sure you know. The trouble is that if I have such an overhead between transferring the images during their trips from GPU to CPU why not have this functionality built in at Matlab. Same as with imresize and with edge.
But please let me return back to the more practical part of the my original enquiry: Is there a way to have a version of the image even saved (with no figure, imshow), where I can write additional information to it, such as the values of various parameters, or the times of various computations, under the multi-worker scenario?

Sign in to comment.

More Answers (3)

Daniel Golden
Daniel Golden on 29 Apr 2014
I'm running R2014a and the image and imagesc functions do work within parfor loops, although the imshow function does not. If you substitute image for imshow, follow it with this command to get similar results:
axis image off
However, the pixels shown on the screen won't be 1:1 like they are by default with the imshow command.

Dimitris Vayenas
Dimitris Vayenas on 29 Apr 2014
Edited: Dimitris Vayenas on 29 Apr 2014
Thank you very much Daniel!
I will try it and let you know. Glad to hear that Mathworks are giving so Serious consideration to our recommendations; in such challenging cases in particular.
(PS:I do not mind how it appears on the screen as I am using for metavisualisation applications)

kinjal shah
kinjal shah on 6 Mar 2015
what is about the imshow error? what is solution?
  2 Comments
Walter Roberson
Walter Roberson on 13 Feb 2020
You already asked two questions on this topic.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by