フィルターのクリア

i need code urgently for my project, please help me

3 ビュー (過去 30 日間)
viswanath reddy
viswanath reddy 2019 年 1 月 11 日
コメント済み: viswanath reddy 2019 年 1 月 26 日
i want code for comparison of pixels in an image by considering a 3*3 matrix. for each pixel, a 3*3 matrix around the pixel should be considered and the pixel must be compared with both the diagonals of the considered 3*3 matrix, whether the pixel is greater than all the diagonal elements or not?

採用された回答

Image Analyst
Image Analyst 2019 年 1 月 11 日
If you're not turning it in for homework, you can use my code below which uses highly optimized 2-D convolution:
grayImage = imread('cameraman.tif');
subplot(1, 2, 1);
imshow(grayImage, []);
% Do one corner
kernel = [-1,0,0;0,1,0; 0,0,0];
filter1 = conv2(grayImage, kernel, 'same');
% Do another corner
kernel = [0,0,-1;0,1,0; 0,0,0];
filter2 = conv2(grayImage, kernel, 'same');
% Do another corner
kernel = [0,0,0;0,1,0; -1,0,0];
filter3 = conv2(grayImage, kernel, 'same');
% Do another corner
kernel = [0,0,0;0,1,0; 0,0,-1];
filter4 = conv2(grayImage, kernel, 'same');
% Output must have middle pixel greater than all 4 corners.
outputImage = (filter1 > 0) & (filter2 > 0) & (filter3 > 0) & (filter4 > 0);
subplot(1, 2, 2);
imshow(outputImage, []);
0000 Screenshot.png
  1 件のコメント
viswanath reddy
viswanath reddy 2019 年 1 月 26 日
yes its very useful for me...

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by