How to apply Law's Texture Filter to a picture?

조회 수: 21(최근 30일)
Aslanbek Zhumagali 2020년 1월 8일
댓글: Bhaskar Talukdar 2022년 1월 1일
How to apply this function to a picture?
function [ mapz ] = laws( image , averWindSize)
%LAWS Laws image filters
% Law's image filters applied to input image
%% convert to grayscale
if size(image,3) == 3
imageG=rgb2gray(image);
else
imageG=image;
end
%% define fiters
filters={};
filters{1}=[1 4 6 4 1];
filters{2}=[-1 -2 0 2 1];
filters{3}=[-1 0 2 0 -1];
filters{4}=[1 -4 6 -4 1];
%% smooth image
smooth = ones(averWindSize, averWindSize)/(averWindSize^2);
imageG=imfilter(imageG,smooth,'conv','symmetric');
%% define filters and apply to images
filtered2D={};
for i=1:size(filters,2)
for j=1:size(filters,2)
temp=filters{i}'*filters{j};
filtered2D{end+1}=imfilter(imageG,temp);
end
end
%% get resulting 9 maps
mapz={};
mapz{end+1}=wfusmat(filtered2D{2},filtered2D{5},'mean');
mapz{end+1}=wfusmat(filtered2D{4},filtered2D{13},'mean');
mapz{end+1}=wfusmat(filtered2D{7},filtered2D{10},'mean');
mapz{end+1}=filtered2D{11};
mapz{end+1}=filtered2D{16};
mapz{end+1}=wfusmat(filtered2D{3},filtered2D{9},'mean');
mapz{end+1}=filtered2D{6};
mapz{end+1}=wfusmat(filtered2D{8},filtered2D{14},'mean');
mapz{end+1}=wfusmat(filtered2D{12},filtered2D{15},'mean');
end

댓글을 달려면 로그인하십시오.

답변(1개)

masoud sistaninejad 2021년 7월 15일
clc
clear
close all
imshow(I)
averWindSize = 3;
[ mapz ] = laws( I , averWindSize)
imshow(mapz{4})
댓글 수: 1표시숨기기 없음
Bhaskar Talukdar 2022년 1월 1일
thank you so much

댓글을 달려면 로그인하십시오.

범주

Find more on Image Filtering in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by