Problem in finding the skewness for the blocks of an image
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
clc;
clear all;
close all;
b = imread('D:\PT\gund\image0006.png');
b1 = rgb2gray(b);
c = imresize(b1, [64 64]);
z = 1;
for m = 1:4:61
for n = 1:4:61
Q(:,:,z) = c(m:m+3,n:n+3);
z = z + 1;
end
end
% finding skewness
for z = 1 : 256
a = (Q(:,:,z));
skew_1(z,:) = skewness(a);
end
The above program shows the error Error using - Integers can only be combined with integers of the same class, or scalar doubles.
Error in skewness ( line 39) x0 = x - repmat(nanmean(x,dim),tile);
Error in mrk_skew(*line 23 ) skew_1(z,:) = skewness(a);
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 4 Dez. 2012
Well, there's a lot of code missing from your program (like where you defined Q and skew_1), but generally that error shows up when you try to do something like add a uint8 array to a uint16 array. Why don't you just cast your image to floating point to avoid the problem:
c = double(imresize(b1, [64 64]));
I also don't understand your definition of skewness. It's the 3rd central moment of the histogram, like explained here: http://en.wikipedia.org/wiki/Skewness. I'm not seeing that in your code.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with Image Processing Toolbox 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!