create 3*3 matrix around a given pixel
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Yuvashree Mani Urmila
il 7 Lug 2014
Risposto: Mahendra Amrao
il 8 Set 2020
I have a centroid plotted on a blank image using the command img(a(2),a(1))=1;
I would like to create a 3*3 matrix of ones around this pixel as centroid.
Can someone tell me how i can achieve this.
Thankyou
0 Commenti
Risposta accettata
Jos (10584)
il 7 Lug 2014
One solution:
img = zeros(6,7)
a = [4 3]
img(a(2),a(1)) = 1
B = [1 1 1 ; 1 0 1 ; 1 1 1];
img2 = conv2(img, B ,'same')
0 Commenti
Più risposte (1)
Mahendra Amrao
il 8 Set 2020
img = zeros(6,7)
a = [4 3]
img(a(2),a(1)) = 1
B = [1 1 1 ; 1 0 1 ; 1 1 1];
img2 = conv2(img, B ,'same')
0 Commenti
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!