how do i get the matrix index to agree

i have two images which have been image processed how to get the two images to have the same matrix index, i have used matlab to calculate the values of x, y and x1, y1:
>> size(x)
ans =
142505 1
>> size(y)
ans =
142505 1
>> size(x1)
ans =
176868 1
>> size(y1)
ans =
176868 1
this is what i am getting but i need to perform a calculation to try and make these images the same.

 Accepted Answer

Do you have a 2D grayscale image, or a 3D RGB color image? x, y, x1, and y1 look like 1D arrays. What do they represent? Four one-dimensional grayscale images?

6 Comments

142505 is not divisible by 3, so they are not RGB.
it is 2D grayscale image
Right. Size() would also have given 3 as a third output argument if that were the case. I just have no idea what they (x,y,x1,y1) represent, and what is the "index" and what is the "image".
BW1=im2bw(E); BW1=~BW1; BW2 = bwperim(E,8); image1=BW2; [x1 y1]=find(image1==1); ba=[x1 y1];
then this is analyse for a freeman chain code, the image is of a hand image , the index is a chaincode matrix (very long one too)
Why not just use bwboundaries()?
the whole code does include boundaries P=imread('khalil hand1.jpg'); %% Show Image imshow(P);
%start to track hand warning off stats:kmeans:EmptyCluster; rawImage = P; a_gray = rgb2gray(P); figure, imshow(P); figure, imshow(a_gray); T=wiener2(a_gray); figure,imshow(T); figure, imhist(a_gray); subplot (1,2,1), imshow(a_gray); subplot (1,2,2), imhist(a_gray); E=edge(T,'sobel'); figure, imshow(E) axis on xlabel x ylabel y iptsetpref imshowAxesVisible on I = rawImage; cform = makecform('srgb2lab'); J = applycform(I,cform); ab = double(J(:,:,2:3)); nrows = size(ab,1); ncols = size(ab,2); ab = reshape(ab,nrows*ncols,2); nColors = 2; [cluster_idx cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean', ... 'Replicates',2); pixel_labels = reshape(cluster_idx,nrows,ncols); segmented_images = cell(1,2); rgb_label = repmat(pixel_labels,[1 1 3]); %% BW1=im2bw(E); BW1=~BW1; BW2 = bwperim(E,8); image1=BW2; [x y]=find(image1==1); ba=[x y];
%I=imread('close.jpg'); %h=fspecial('average', 9); %g=imfilter(E, h, 'replicate'); %gB=im2bw(g, 0.5); B = bwboundaries(BW2, 'holes'); d = cellfun('length', B); [maxd, k] = max(d); b = B{k}; [M N] = size(B); %g = bound2im(b, M, N); [s, su] = bsubsamp(b, 50); %g2 = bound2im(s, M, N); cn = connectpoly(s(:, 1), s(:, 2)); %g3 = bound2im(cn, M, N); C = fchcode(BW2, 8);

Sign in to comment.

More Answers (0)

Categories

Find more on Linear Algebra 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!