3
A
回答
5
一旦你創建了數字嘗試
3210等你拿上圖點擊一次(這就是爲什麼論點之一),你會得到的座標返回的功能ginput()返回。
6
這裏是如何做到這一點最優雅:
function test
% create test figure
f = figure(1);
% set function to call on mouse click
set(f, 'WindowButtonDownFcn', @clicker);
end
% function called on mouse click in the figure
function clicker(h,~)
get(h, 'selectiontype')
% 'normal' for left moue button
% 'alt' for right mouse button
% 'extend' for middle mouse button
% 'open' on double click
get(h, 'currentpoint')
% Current mouse location, in pixels from the lower left.
% When the units of the figure are 'normalized', the
% coordinates will be [0 0] inb lower left, and [1 1] in
% the upper right.
end
1
也許這也將工作:
function [loc] = get_image_point (I)
figure('name','Doubleclick to set location');imshow(I);
[c r] = getpts(1);
loc = int32([c r]);
if size(loc,1)>1
loc = [loc(1,1) loc(1,2)];
end
close all;
end
斯蒂芬
0
注: - getpts()
- 是一個 「圖像處理工具箱」功能。 - ginput()
- 等待您的鼠標單擊,暫停執行直到您點擊,並且僅在被調用時才起作用。
而get(h, 'currentpoint')
只要你的程序正在運行就可以隨時工作。
相關問題
- 1. 如何在鼠標點擊時獲得鼠標位置 - Python Gtk
- 2. 鼠標點擊圖片上的位置
- 3. 如何在matlab中獲取鼠標在我的設置軸上的位置?
- 4. 如何獲取鼠標位置點擊地形?
- 5. 如何從鼠標點擊獲得相對x和y位置
- 6. 如何讓鼠標在imageview的點擊位置上定位?
- 7. 在鼠標點擊獲取ms圖表中的標記位置
- 8. Java在點擊Gui時獲得鼠標位置
- 9. C#WebBrowser獲取鼠標點擊位置
- 10. MATLAB如何讓鼠標點擊座標
- 11. 如何在google上獲得鼠標位置標記
- 12. 如何在HTML頁面中獲取鼠標點擊位置
- 13. 如何獲得本地鼠標位置
- 14. 點擊鼠標時獲取方形的中心位置? Java的
- 15. 鼠標單擊圖像上的位置
- 16. 是否有可能在Excel圖形軸上獲得點的位置
- 17. 如何獲得座標相對於鼠標位置的位置?
- 18. 如何獲取我點擊的位置的鼠標位置,在kinetic.js階段?
- 19. 在Matlab中調整圖形的座標軸位置
- 20. 在matlab中捕獲鼠標單擊位置
- 21. 如何在Qt屏幕上獲得鼠標位置?
- 22. pygame的:在獲得環鼠標點擊
- 23. 從鼠標單擊軸上獲取值
- 24. 如何在頁面上的任意位置點擊鼠標X和Y位置?
- 25. 如何獲得點擊的位置?
- 26. 如何檢測鼠標點擊在自定義形狀的光標在c + +圖像上的位置
- 27. 根據用戶點擊的位置獲取鼠標位置
- 28. 如何獲得鼠標懸停的高圖形點的值?
- 29. 如何使用鼠標點擊到Mac上的特定位置?
- 30. 如何從MSChart的基礎上點擊鼠標位置得到的x值
當你說「如果沒有繪製圖表,我該怎麼做」,這並不明確。但是你可能想要使用ginput()。例如。看到這裏:[越來越像素座標有效在MATLAB](http://stackoverflow.com/questions/6541444/getting-pixel-coordinates-efficiently-in-matlab) – Justin
我想點擊空的某處情節(我認爲matlab稱之爲座標軸而不是數字,因爲圖(1)不會生成圖形實際顯示的白色畫布)。我想預定義軸的x和y座標的最大和最小限制,當我點擊座標軸上的空白區域時,我希望能夠將點的x和y座標存儲在變量中 – user13267
您可以使用回調。 – bonCodigo