how do i get the matrix index to agree

3 Ansichten (letzte 30 Tage)
Kbhatti86
Kbhatti86 am 16 Apr. 2013
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.

Akzeptierte Antwort

Image Analyst
Image Analyst am 16 Apr. 2013
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 Kommentare
Image Analyst
Image Analyst am 16 Apr. 2013
Why not just use bwboundaries()?
Kbhatti86
Kbhatti86 am 16 Apr. 2013
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);

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by