i can't get LBP
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I want to apply your program on a weather radar image of 512*512 using local binary pattern. but the result was not good:'' localBinaryPatternImage 256*3 double [0 238] " instead of 512*512 and there are a lot of zeros
helped me please
if true
% clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
imtool close all; % Close all imtool figures.
clear; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
fontSize = 20;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[I,map]=imread('2201960520.tif');
grayImage = rgb2gray(map);
figure, imshow(I,map);
figure,imshow(I,grayImage);
% Get the dimensions of the image. numberOfColorBands should be = 1.
[rows columns numberOfColorBands] = size(grayImage);
% Preallocate/instantiate array for the local binary pattern.
localBinaryPatternImage = zeros(size(grayImage));
for row = 2 : rows - 1
for col = 2 : columns - 1
centerPixel = grayImage(row, col);
pixel7=grayImage(row-1, col-1) > centerPixel;
pixel6=grayImage(row-1, col) > centerPixel;
pixel5=grayImage(row-1, col+1) > centerPixel;
pixel4=grayImage(row, col+1) > centerPixel;
pixel3=grayImage(row+1, col+1) > centerPixel;
pixel2=grayImage(row+1, col) > centerPixel;
pixel1=grayImage(row+1, col-1) > centerPixel;
pixel0=grayImage(row, col-1) > centerPixel;
localBinaryPatternImage(row, col) = uint8(...
pixel7 * 2^7 + pixel6 * 2^6 + ...
pixel5 * 2^5 + pixel4 * 2^4 + ...
pixel3 * 2^3 + pixel2 * 2^2 + ...
pixel1 * 2 + pixel0);
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Processing and Computer Vision finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!