How to Display a dot on screen?
古いコメントを表示
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.
採用された回答
その他の回答 (5 件)
Jan
2011 年 5 月 14 日
% 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 件のコメント
Chirath Dharshana
2011 年 5 月 19 日
Jan
2011 年 5 月 20 日
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
2011 年 6 月 8 日
@Jan Simon: Is there any way to obtain a normal Matlab window (not fullscreen) with no borders, no title and no taskbar?
Jan
2011 年 6 月 8 日
@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
2011 年 6 月 8 日
@Jack Simon: Thank you for your suggestions. I have tried the solutions #1 and #2 but I have not had success. Cheers.
Daniel Shub
2011 年 5 月 6 日
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 件のコメント
Chirath Dharshana
2011 年 5 月 6 日
Daniel Shub
2011 年 5 月 6 日
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
2011 年 5 月 6 日
0 投票
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 件のコメント
Chirath Dharshana
2011 年 5 月 7 日
Sean de Wolski
2011 年 5 月 9 日
Yes, look at the 'Position' property of a figure.
doc figure
Walter Roberson
2011 年 5 月 6 日
0 投票
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 件のコメント
Chirath Dharshana
2011 年 5 月 7 日
Walter Roberson
2011 年 5 月 8 日
Sorry, no. Windows-specific code needs someone who knows Windows.
Walter Roberson
2011 年 5 月 9 日
0 投票
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.
カテゴリ
ヘルプ センター および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!