Change the program or function used for viewing images and return the previous values.
When the
image
orimshow
function is called it will launch an external program to display the image. The default behaviour is to use gnuplot if the installed version supports image viewing, and otherwise try the programsdisplay
,xv
, andxloadimage
. Using this function it is possible to change that behaviour.When called with one input argument images will be displayed by saving the image to a file and the system command command will called to view the image. The command must be a string containing
%s
and possibly%f
. The%s
will be replaced by the filename of the image, and the%f
will (if present) be replaced by the zoom factor given to theimage
function. For example,image_viewer ("eog %s");changes the image viewer to the
eog
program.With two input arguments, images will be displayed by calling the function function_handle. For example,
image_viewer (data, @my_image_viewer);sets the image viewer function to
my_image_viewer
. The image viewer function is called withmy_image_viewer (x, y, im, zoom, data)where x and y are the axis of the image, im is the image variable, and data is extra user-supplied data to be passed to the viewer function.
With three input arguments it is possible to change the zooming. Some programs (like
xloadimage
) require the zoom factor to be between 0 and 100, and not 0 and 1 like Octave assumes. This is solved by setting the third argument to 100.