How to solve the error "Undefined function 'pointCloud' for input arguments of type 'double'."

7 ビュー (過去 30 日間)
forest tracker
forest tracker 2016 年 7 月 3 日
コメント済み: forest tracker 2016 年 7 月 3 日
Hello everyone, I am trying to run this code, but when it goes to the line 6. It will give me the error "Undefined function 'pointCloud' for input arguments of type 'double'." I would great appreciate if anybody can help me out in the aspect of solving this error. Thank you in advance!
clear;close all;clc
obj = VideoReader('twocolors12.avi'); %%%good frames from 3295---3484
get(obj)
NOF=500;
SE = strel('arbitrary',ones(2,2));
mm=pointCloud([0,0,0]);
for i=60:80;
he=read(obj,i);
kl=he(:,:,3);
[X_no_dither,map]= rgb2ind(he,8,'nodither');
%figure, imshow(X_no_dither,map);
%imshow(kl)
cform = makecform('srgb2lab');
lab_he = applycform(he,cform);
ab = double(lab_he(:,:,2:3));
nrows = size(ab,1);
ncols = size(ab,2);
ab = reshape(ab,nrows*ncols,2);
nColors = 5;
[cluster_idx, cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean', ...
'Replicates',3);
pixel_labels = reshape(cluster_idx,nrows,ncols);
mean_cluster_value = mean(cluster_center,3);
[tmp, idx] = sort(mean_cluster_value);
blue_cluster_num = idx(5);
L = lab_he(:,:,2);
%imshow(L)
blue_idx = find(pixel_labels == blue_cluster_num);
L_blue = L(blue_idx);
is_light_blue = im2bw(L_blue,graythresh(L_blue));
nuclei_labels = repmat(uint8(0),[nrows ncols]);
nuclei_labels(blue_idx(is_light_blue==false)) = 1;
nuclei_labels = repmat(nuclei_labels,[1 1 3]);
blue_nuclei = he;
blue_nuclei(nuclei_labels ~= 1) = 0;
%imshow(blue_nuclei), title('blue nuclei');
f=blue_nuclei(:,:,1);
%imshow(f)
f12=(f/5).^2*2;
%imshow(f12)
f123=imdilate(f12,SE,'same');
%imshow(f123)
%[r,t]=edge(f12,'canny',0.9,'vertical');
%imshow(r)
fb=im2bw((f123),0.01);
%imshow(fb)
f123=imdilate(fb,SE,'same');
%imshow(f123)
[r,t]=edge(f123,'canny',0.9,'vertical');
%imshow(r)
fn=imclose(r,ones(25,25));
%imshow(fn)
BW2 = bwmorph(fn,'thin',inf);
fn=imclose(BW2,ones(10,15));
BW2=imdilate(fn,SE,'same');
%BW2=bwmorph(BW2,'spur',1);
%imshow(BW2)
%...........................rotate..............................
image=BW2;
%image padding
[Rows, Cols] = size(image);
Diagonal = sqrt(Rows^2 + Cols^2);
RowPad = ceil(Diagonal - Rows) + 2;
ColPad = ceil(Diagonal - Cols) + 2;
imagepad = zeros(Rows+RowPad, Cols+ColPad);
imagepad(ceil(RowPad/2):(ceil(RowPad/2)+Rows-1),ceil(ColPad/2):(ceil(ColPad/2)+Cols-1)) = image;
degree=-10;
%midpoints
midx=ceil((size(imagepad,1)+1)/2);
midy=ceil((size(imagepad,2)+1)/2);
imagerot=zeros(size(imagepad));
%rotation
for ii=1:size(imagepad,1)
for j=1:size(imagepad,2)
x=(ii-midx)*cos(degree)-(j-midy)*sin(degree);
y=(ii-midx)*sin(degree)+(j-midy)*cos(degree);
x=round(x)+midx;
y=round(y)+midy;
if (x>=1 && y>=1)
imagerot(x,y)=imagepad(ii,j); % k degrees rotated image
end
end
end
%figure
BW2=imagerot;
fn=imdilate(BW2,SE,'same');
fn=imclose(fn,ones(4,15));
BW2=bwmorph(fn,'spur',3);
ghy=BW2;
%imshow(BW2)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
%.................Horizantel pixels............
fn1=BW2;
[RR CC]=size(fn1);
yy1(RR,CC)=0;
d1(RR)=0;
for o=1:RR
yyy=find(fn1(o,:)==1);
[nn ll1]=size(yyy);
if ll1<=4
d1(o)=0;
else
ss1=yyy(1);
re=0;
for ib=1:ll1
yy1(o,ib)=yyy(1,ib);
if ss1==yy1(o,ib);
re=re+1;
ss1=ss1+1;
end
end
re1=ll1-re;
vv1=yyy(re);
if re==ll1
vv2=0;
else
re2=(ll1-re1)+1;
vv2=yyy(re2);
end
d1(o)=vv2-vv1;
end
end
bbb1=find(d1==max(d1));
Hp(i)=ceil(mean(bbb1));
simemajor(i)=ceil(max(d1)/2)+1;
%BW2(Hp-1:Hp+1,:)=1;
%imshow(BW2)
%...............end................
%........... virtical...................
fn21=BW2;
%imshow(fn21)
yy11(RR,CC)=0;
d11(CC)=0;
for oo=1:CC
yyy1=find(fn21(:,oo)==1)';
[nn ll11]=size(yyy1);
if ll11<=4
d11(oo)=0;
else
ss11=yyy1(1);
ree=0;
for iii=1:ll11
yy11(oo,iii)=yyy1(1,iii);
if ss11==yy11(oo,iii);
ree=ree+1;
ss11=ss11+1;
end
end
ree1=ll11-ree;
vv11=yyy1(ree);
if ree==ll11
vv21=0;
else
ree2=(ll11-ree1)+1;
vv21=yyy1(ree2);
end
d11(oo)=vv21-vv11;
end
end
bbb11=find(d11==max(d11));
vp(i)=ceil(mean(bbb11));
simeminor(i)=ceil(max(d11)/2)+1;
if simemajor(i)> simeminor(i)
fff=sqrt((simemajor(i))^2-(simeminor(i))^2);
ecentracity(i)=fff/simemajor(i);
else
fff=sqrt((-simemajor(i))^2+(simeminor(i))^2);
ecentracity(i)=fff/simeminor(i);
end
%.............end...................
%........... ploting the image withe the center.......
BW2(Hp(i)-1:Hp(i)+1,:)=1;
BW2(:,vp(i)-2:vp(i)+2)=1;
%imshow(BW2)
nnn=(Hp(i)-(RR/2)-1);
nnn1=(vp(i)-(CC/2)-1);
%...................End................................
%.................recenter the image..................
BB1(1:RR,1:CC)=0;
ee=max(max(yy11));
for o=1:ee
yyy=find(fn1(o,:)==1);
[nn nm]=size(yyy);
if nm==0
BB1(o,:)=0;
else
[nn nm]=size(yyy);
BB1(abs(ceil(o-nnn)),abs(ceil(yyy(1:nm)-nnn1)))=1;
end
end
[rr,c]=find(ghy);
zzzz=((2.2346*i)*ones(1,length(rr)));
xx=[rr,0.1141*c,zzzz'];
f=pointCloud(xx);
mm=pcmerge(mm,f,0.5);
i
end
% showPointCloud(mm)
% zlabel('The distance(mm)')
% vbn=ecentracity;
%
kh=zeros(1,357);
lo=60;
cv=1;
for lk=134:179
kh(lk)=ecentracity(lo);
if cv<=3
lo=lo;
else
lo=lo+1;
cv=1;
end
cv=cv+1;
end
%hju=ecentracity(89:160);
plot(kh)
axis([134 179 0 0.6])
xlabel('The distance(mm)')
ylabel('The eccentricity ')
% plot(bigradus(:179))
% figure
% imshow(BB1)
% Hp
% vp
% smallraduse
% bigradus
% ecentracity

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 7 月 3 日
The pointCloud class was added in R2015a. Your posting in a different Question suggests that you are using R2014b.
  3 件のコメント
Steven Lord
Steven Lord 2016 年 7 月 3 日
If you want to use pointCloud, you must be using release R2015a or later (and have Computer Vision System Toolbox installed and licensed.)
Release R2014b is before release R2015a.
forest tracker
forest tracker 2016 年 7 月 3 日
Thanks for your great help. I am working on getting a new version of Matlab of current year.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by