How to do a maximum rank filter

2 ビュー (過去 30 日間)
Jimmy Neutron
Jimmy Neutron 2021 年 11 月 25 日
コメント済み: Jimmy Neutron 2021 年 11 月 27 日
I would like to do a 3x3 max-rank filter with 0 padding. How would I go about doing this? Currently I have tried:
M = [203 167 233 113 222 232;
79 176 39 27 22 46;
135 191 211 256 102 67;
42 115 137 1 66 37;
154 21 254 198 204 35;
67 58 20 208 110 222];
localMaxImage = imdilate(M, true(3))

採用された回答

yanqi liu
yanqi liu 2021 年 11 月 26 日
clc; clear all; close all;
M = [203 167 233 113 222 232;
79 176 39 27 22 46;
135 191 211 256 102 67;
42 115 137 1 66 37;
154 21 254 198 204 35;
67 58 20 208 110 222];
localMaxImage = imdilate(M, true(3))
localMaxImage = 6×6
203 233 233 233 232 232 203 233 256 256 256 232 191 211 256 256 256 102 191 254 256 256 256 204 154 254 254 254 222 222 154 254 254 254 222 222
fun = @(block_struct) max(max(block_struct.data)) * ones(size(block_struct.data));
localMaxImage2 = blockproc(M,[3 3],fun)
localMaxImage2 = 6×6
233 233 233 256 256 256 233 233 233 256 256 256 233 233 233 256 256 256 254 254 254 222 222 222 254 254 254 222 222 222 254 254 254 222 222 222

その他の回答 (1 件)

Image Analyst
Image Analyst 2021 年 11 月 25 日
Looks right to me. Do you think something is wrong with that?
  1 件のコメント
Jimmy Neutron
Jimmy Neutron 2021 年 11 月 27 日
It is correct, I am not sure why I thought it was not... Thank you for your reply :)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by