How to use ginput to determine the coordinates of an image

5 ビュー (過去 30 日間)
Beyza Kural
Beyza Kural 2020 年 8 月 3 日
回答済み: KSSV 2020 年 8 月 3 日
I have a matrix of 4 images (2x2) and I want to use ginput to select an image and with that selection, determine which image it is. For example, if I click on (3000,2000) I want the program to tell me it is the orange flower image.

採用された回答

KSSV
KSSV 2020 年 8 月 3 日
You have dimensions of each image...say dimensions of each image [m,n,3]. Initiate a matrix idx such that, each quarter has the value 1, 2, 3, 4 for each respective image. When you get [x,y] use interp2, and get the value.
idx = zeros(2*m,2*n) ;
idx(1:m,1:n) = 1 ; % first image
idx(1:m,n+1:end) = 2 ; % second image
idx(m+1:end,1:n) = 3 ; % third image
idx(m+1:end,n+1:end) = 4 ; % fourth image
p = interp2(idx,3000,2000) % see the value and decide the image

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by