Hi, I have a matrix 1664 × 128. How to design a filter, the output of the filter is 832×128. That is, it should have first half of 1664(i.e. 832) and should remove other part. I know that I can use: (1:832,:). But I want to design a filter for it.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Sai Prakash Reddy Konda
el 8 de Sept. de 2018
Comentada: Sai Prakash Reddy Konda
el 3 de Oct. de 2018
Hi, I have a matrix 1664 × 128. How to design a filter, the output of the filter is 832×128. That is, it should have first half of 1664(i.e. 832) and should remove other part. I know that I can use: (1:832,:). But I want to design a filter for it.
0 comentarios
Respuesta aceptada
Image Analyst
el 8 de Sept. de 2018
Not sure what you want. Do you want a filter that returns the matrix unaffected on the top half and the bottom half is all zeros, or cropped off entirely? Or something else?
To zero:
function filteredM = MyFilter(M)
filteredM = M; % Initialize
filteredM(833:end, :) = 0
To crop
function filteredM = MyFilter(M)
filteredM = M(1:832, :);
If that's not what you mean, then explain better.
2 comentarios
Más respuestas (1)
Walter Roberson
el 8 de Sept. de 2018
Filters always return an output the same size as the input, so this is not something that can be done as a true filter.
It can be done as an anonymous function
F = @(M) M(1:floor(end/2),:);
In the case of a matrix with an odd number of rows this does not copy the center row. If you want the center row copied then use ceil instead of floor
Ver también
Categorías
Más información sobre Filter Design en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!