how to represent 3D points into cluster with the mutual cluster distance over a hard threshold?
1 次查看(过去 30 天)
显示 更早的评论
i want to implement cluster based image segmentation method,i have a code for it.I want to implement this code in an image.while doing so i have facing the problem of how to represent 3D points into cluster with the mutual cluster distance over a hard threshold? REQUIREMENT: idx=FindPartitions(points,distance) partitions 3-D points into clusters % with the mutual cluster distances over a hard threshold. Can be used to % check point connectivity. % % Parameters: % points can be 3-D or higher dimension, dist is the distance between % clusters, idx is a column vector with the cluster labels.
% Examples: % nPts = 500; % h1 = rand(nPts,1)*10; % r1 = 5+(rand(nPts,1)-.5)*0.5; % degree1 = 160*rand(nPts,1); % % h2 = rand(nPts,1)*10; % r2 = 5+(rand(nPts,1)-.5)*0.5; % degree2 = 160*rand(nPts,1)+180; % % points=[ % r1.*cos(degree1/180*pi),r1.*sin(degree1/180*pi),h1; % r2.*cos(degree2/180*pi),r2.*sin(degree2/180*pi),h2; % ]; % plot3(points(:,1),points(:,2),points(:,3),'.r'); % idx=FindPartitions(points,1.5); % figure,scatter3(points(:,1),points(:,2),points(:,3),ones(2*nPts,1),idx); % code clc;clear all;close all;
I=imread('flower.jpg');
I=(points;dist);
points=((h1,r1):(h2,r2):(h3,r3));
idx=FindPartitions(I);
npoints=500;
h1=rand(npoints,1)*10;
r1=5+(rand(npoints,1)-.5)*0.5;
degree1=160*rand(npoints,1);
h2=rand(npoints,1)*10;
r2=5+(rand(npoints,1)-.5)*0.5;
degree2=160*rand(npoints,1)+180;
points=[ r1.*cos(degree1/180*pi),r1.*sin(degree1/180*pi),h1; r2.*cos(degree2/180*pi),r2.*sin(degree2/180*pi),h2; ];
plot3(points(:,1),points(:,2),points(:,3),'.r');
idx=FindPartitions(points,1.5);
figure,scatter3(points(:,1),points(:,2),points(:,3),ones(2*nPts,1),idx);
error at line points=((h1,r1):(h2,r2):(h3,r3));
error: >> demo Error: File: demo.m Line: 3 Column: 10 Unbalanced or unexpected parenthesis or bracket.
please sugggest me what modification i have to do in code according to requirement?
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!