필터 지우기
필터 지우기

draw image, How can I draw the image ? display cluster in an image

조회 수: 3 (최근 30일)
Tomas
Tomas 2014년 4월 1일
편집: Tomas 2014년 4월 1일
Hello, i have code, i need to draw image
my code
close all; clc; clear;
img = imread('pic7.png');
figure(), imshow(img);
impixelregion;
% nastavenie noveho obrazka
[y x z] = size(img)
for i=1:1:y
for j=1:1:x
imgNew(i, j, :) = 0;
end
end
[X_no_dither, map]= rgb2ind(img,12,'nodither');
figure, imshow(X_no_dither, map);
impixelregion;
img = im2double(X_no_dither)
P=size(img);
idx = kmeans(img,4,'emptyaction','singleton');
How can I draw the image back by?
Thank for help
  댓글 수: 1
Tomas
Tomas 2014년 4월 1일
idx = kmeans(img,4,'emptyaction','singleton'); clusteredImage = zeros(size(X_no_dither)); clusteredImage(sub2ind(size(X_no_dither) , m(:,1),m(:,2)))=idx;
imshow(label2rgb(clusteredImage))
??? Error using ==> sub2ind at 58 Out of range subscript.
Error in ==> test at 29 clusteredImage(sub2ind(size(X_no_dither) , m(:,1),m(:,2)))=idx;

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Build Interactive Tools에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by