Selecting all pixels except one pixel
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Say that we have a 3x3 matrix. If we type x(:), this will select all the elements in the matrix, right?
How can we select all the elecments except element x(2,2)? What should we type in this case?
Thanks.
1 Commento
Image Analyst
il 23 Mag 2013
What are you doing? Because if you're doing something like linear filtering via convolution or morphological filtering, you would do this be proper selection of the kernel.
Risposta accettata
Iain
il 23 Mag 2013
You need to use linear or logical indexing to do that. In this case, linear would be easier:
The indices for a 3x3 are:
[1 4 7;
2 5 8;
3 6 9];
So you can access it via x([1:(1 before the one you don't want) (1 after the one you don't want:end]), so for your example:
x([1:4 6:9]);
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!