How to Display a dot on screen?

15 views (last 30 days)
For my project I want to display a dot on the screen that will follow the path of our eye gaze.
I need to know how to display a dot on the screen(without any matlab window). My system is Win7. Matlab version 2010a.
Thank you.

Accepted Answer

Daniel Shub
Daniel Shub on 7 May 2011
I think you could do it with a transparent window as described by Yair Altman:
  2 Comments
Walter Roberson
Walter Roberson on 8 May 2011
This does not satisfy the requirements of the original question, that the solution be "without any matlab window". If MATLAB windows were to be allowed, then alternative solutions would have been offered.
Daniel Shub
Daniel Shub on 9 May 2011
I agree that it doesn't really answer the question as it was asked, since it does involve a MATLAB window (albeit invisible/transparent). Based on the OP comment on my other answer, I thought this answer might work. What would your alternative solution have been if you could use a MATLAB window, but could not have anything other than the dot visibile?

Sign in to comment.

More Answers (5)

Jan
Jan on 14 May 2011
If you are running Windows, this will work: FEX: WindowAPI
% A Full scrren window - no borders, no title, no taskbar:
FigH = figure('Color', [1, 1, 1]);
WindowAPI(FigH, 'fullscreen');
% Full screen AXES object with a sphere:
AxesH = axes('Units', 'normalized', [0,0,1,1], ...
'Visible', 'off', ...
'Renderer', 'Zbuffer');
sphere;
rotate3d('on');
% Now cut out the background:
WindowAPI(FigH, 'Alpha', 1.0, uint8([255, 255, 255]));
Now you see the object on top of all other figures and with Alpha = 0.5 it is even transparent. You can rotate the sphere interactively with the mouse, but if you click in a window not concealed by the circular shape of the sphere, you can activate the windows behind it, e.g. type in the command window!
I can imagine a lot of other more or less ugly things: display a popup menu "in" the command window, show an atomic transparent progressbar in the top right corner of the screen, display two complicated diagrams on top of eachother for a pixelwise comparison, ...
  5 Comments
Jan
Jan on 8 Jun 2011
@Julian: 1. Yair's http://www.mathworks.com/matlabcentral/fileexchange/30583-setfigtransparency-set-figure-transparency-fading shows a way to control the window layout using Java. I've seen a method to control the border appearence also there, but cannot test it, because I do not have the newest Matlab version.
2. You can use WindowAPI to create the figure in fullscreen and the alpha-blending to hide everything from the window's contents except for a panel, which is exactly there, where you want to show your bare window. This would look exactly the same as a window without decorations.
3. I'm working on accessing the WindowRgn of the DeviceContext using the Windows API. It will take a while until the submission WindowAPI is updated.
Julián Francisco
Julián Francisco on 8 Jun 2011
@Jack Simon: Thank you for your suggestions. I have tried the solutions #1 and #2 but I have not had success. Cheers.

Sign in to comment.


Daniel Shub
Daniel Shub on 6 May 2011
Displaying something with no MATLAB window is hard. It is not even really clear what this means.
What about a full screen figure (with minimal title bars) and a black background?
figure('Units', 'Normalized', 'Position', [0,0,1,1], 'MenuBar', 'none', 'Color', 'k')
Can you use the mouse pointer as your dot?
set(0, 'PointerLocation', [x, y])
  2 Comments
Chirath Dharshana
Chirath Dharshana on 6 May 2011
I just want to display a circular point to show where a person looking at on the screen.
This is needed for the calibration purposes. Therefore, the circular object alone has to be displayed on the screen when coordinates are given.
Thanks anyway.
Daniel Shub
Daniel Shub on 6 May 2011
What else is on the screen at the time? You could take a screen capture, and present this image in the full screen figure window (instead of the black background). Then you can plot a dot on top of that.

Sign in to comment.


Sean de Wolski
Sean de Wolski on 6 May 2011
What if you just make a small red figure the size of the dot you want (it'll be square) and position it somewhere.
  2 Comments
Chirath Dharshana
Chirath Dharshana on 7 May 2011
Sean,
That's what I want. Is there a way to place such a figure on the screen without any window surrounded. (as the mouse pointer appears on the screen)
What I know is I should communicate with windows system. What I don't know is how to do it.
Do you have any suggestions?
Thank you.
Sean de Wolski
Sean de Wolski on 9 May 2011
Yes, look at the 'Position' property of a figure.
doc figure

Sign in to comment.


Walter Roberson
Walter Roberson on 6 May 2011
If it is not allowed to use a MATLAB window (even one whose borders do not appear on the screen), then you will need to use a mex routine or loadlib() that invoke MS Windows graphics directly.
  2 Comments
Chirath Dharshana
Chirath Dharshana on 7 May 2011
Walter,
I am not familiar with above functions. Can you present a sample code to elaborate the idea?
Thank you.
Walter Roberson
Walter Roberson on 8 May 2011
Sorry, no. Windows-specific code needs someone who knows Windows.

Sign in to comment.


Walter Roberson
Walter Roberson on 9 May 2011
If the problem is the cursor, then set() the figure's Pointer to 'custom' and set() the figure's PointerShapeCData to a 16x16 array of double that has the value 2 where you want the dot to be white and which has the value nan where you want the background to show. Move the dot by set()'ing the figure's CurrentPoint property or (if necessary) the root PointerLocation property.

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!