Code covered by the BSD License  

Highlights from
Mouse figure interaction

image thumbnail

Mouse figure interaction

by

 

This example shows how the mouse could be used to change how an image is displayed

movingMouseExample.m
%% Moving Mouse Example
% This example shows how callbacks can be used to alter e.g. an image
% brightness while a button is pressed and the mouse is moved.
% 

% clear persistent variables in used function
clear mouseMove

%% Open an image
figure; imagesc(); colormap('gray');
axis image off ij;
colormap gray

%% Register the click callbacks:
set (gcf, 'WindowButtonDownFcn', @(object, eventdata)mouseClicked(true)); % register mouse down function handle
set (gcf, 'WindowButtonUpFcn', @(object, eventdata)mouseClicked(false));  % register mouse up mouse

%% Thats it
% the changes to the image are made in the mouseMove.m
% this example is shows how mouse input could be used on a figure

Contact us