Problem in finding the skewness for the blocks of an image

조회 수: 1 (최근 30일)
Mohan
Mohan 2012년 12월 4일
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);

채택된 답변

Image Analyst
Image Analyst 2012년 12월 4일
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개)

카테고리

Help CenterFile Exchange에서 Get Started with Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by