How to Display a dot on screen?
Mostrar comentarios más antiguos
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.
Respuesta aceptada
Más respuestas (5)
Jan
el 14 de Mayo de 2011
% 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 comentarios
Chirath Dharshana
el 19 de Mayo de 2011
Jan
el 20 de Mayo de 2011
Fine! I'm glad to hear this.
I assume, there is a lot of further _ugly_ stuff, which can be done with transparent figures. I'm using it for a bitwise comparison of very complicated diagrams on the screen: The bottom window is opaque, the top window and all 12 subplots have an shining-through background (pixels are not drawn), such that I can see the differences very easy.
Julián Francisco
el 8 de Jun. de 2011
@Jan Simon: Is there any way to obtain a normal Matlab window (not fullscreen) with no borders, no title and no taskbar?
Jan
el 8 de Jun. de 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
el 8 de Jun. de 2011
@Jack Simon: Thank you for your suggestions. I have tried the solutions #1 and #2 but I have not had success. Cheers.
Daniel Shub
el 6 de Mayo de 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 comentarios
Chirath Dharshana
el 6 de Mayo de 2011
Daniel Shub
el 6 de Mayo de 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.
Sean de Wolski
el 6 de Mayo de 2011
0 votos
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 comentarios
Chirath Dharshana
el 7 de Mayo de 2011
Sean de Wolski
el 9 de Mayo de 2011
Yes, look at the 'Position' property of a figure.
doc figure
Walter Roberson
el 6 de Mayo de 2011
0 votos
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 comentarios
Chirath Dharshana
el 7 de Mayo de 2011
Walter Roberson
el 8 de Mayo de 2011
Sorry, no. Windows-specific code needs someone who knows Windows.
Walter Roberson
el 9 de Mayo de 2011
0 votos
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.
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!