Error using ==> horzcat CAT arguments dimensions are not consistent.
Show older comments
I want to find feature vectors.. for that i executed the following code
clear all; close all; clc;
im1=imread('lena.jpg');
im1g=rgb2gray(im1);
%%Calculating mean of im1
grayImage=rgb2gray(im1);
subplot(1, 2, 1);
imshow(grayImage, []); title('Original Grayscale Image');
% Let's get its histogram.
[pixelCount grayLevels] = imhist(grayImage);
subplot(1, 2, 2); bar(pixelCount); title('Histogram of original image');
xlim([0 grayLevels(end)]); % Scale x axis manually.
yRange = ylim; % Calculate the mean gray level
meanGL = sum(pixelCount .* grayLevels) / sum(pixelCount);
%%Calculating standard deviation
st_d1=std(double(im1));
%%Calculating Skewness
sk1=skewness(double(im1));
%%Calculating RMS
im1=double(im1);
rms1=rms(im1);
%%Calculating median absolute
md1=mad(double(im1));
%%Contruct a feature vector
size(meanGL2)
size(st_d2)
size(sk2)
size(rms2)
size(md2)
fv1=[ meanGL, st_d1, sk1, rms1, md1];
and i get that concatenation error .. the size of the variables displayed in the output screen are
ans =
1 1
ans =
1 512 3
ans =
1 512 3
ans =
1 512 3
ans =
1 512 3
??? Error using ==> horzcat
CAT arguments dimensions are not consistent.
Error in ==> fvector at 64
fv1=[ meanGL, st_d1, sk1, rms1, md1];
i am new to matlab and so dont know how to fix it.. if possible any solutions..
Accepted Answer
More Answers (0)
Categories
Find more on Image Category Classification 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!