stuck here ,please help me out,if there are some more mistakes give the solution
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
This is the part of mean shift segmentation code
while ~done
weightAccum = 0;
yAccum = 0;
% only 99.75% area (3sigma) of the entire non-zero Gaussian kernel is considered
for i = -3*hs:3*hs % hs is spatial kernel
for j = -3*hs:3*hs
% spatial kernel weight
spatialKernel = exp(-(i^2+j^2)/(hs^2/2));
xThis = xPad(height+i:2*height+i-1, width+j:2*width+j-1, 1:depth);
xDiff = abs(y-xThis);
xDiffSq = xDiff.^2./hf^2; % hf is feature kernel
% deal with multi-channel image
if depth > 1
xDiffSq = repmat(sum(xDiffSq,3),[1,1,depth]);
end
% feature kernel weight
intensityKernel = exp(-(xDiffSq)./2);
% mixed kernel weight
weightThis = spatialKernel.*intensityKernel.*xDiff;
% update accumulated weights
weightAccum = weightAccum+ weightThis;
% update accumulated estimated ys from xs
yAccum = yAccum+xThis.*weightThis;
end
end
% normalized y
yThis = yAccum./(weightAccum+eps);
% convergence criterion
yMSE = mean((yThis(:)-y(:)).^2);
if yMSE <= th % exit if converge
done = 1;
else % otherwise update estimated y and repeat mean shift
y = yThis;
iter = iter+1;
if plotOn
drawnow, imshow(uint8(y)),axis image, title(['iteration times = ' num2str(iter) '; mse = ' num2str(yMSE)]);
end
end
end
stuck here
??? Error using ==> times Integers can only be combined with integers of the same class, or scalar doubles.
Error in ==> meanShiftseg at 50 weightThis = spatialKernel.*intensityKernel.*xDiff;
Error in ==> meanshiftdemo at 83 y = meanShiftseg(x,8,10);
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Animation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!