声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1891|回复: 2

[图像处理] Matlab程序运行出错Index exceeds matrix dimensions

[复制链接]
发表于 2009-5-7 16:33 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
大家好:最近学习编程,总是碰到下面的问题,希望得到大家的帮助!!!
??? Index exceeds matrix dimensions.
Error in ==> cluster at 61
hsv{i}=rgb_background(:,:,i)'
下面是部分程序代码:
%%初始部分,读取图像及计算相关信息
close all;
clear;
clc;
rgb_background=imread('E:\MATLAB6p5\work\我的程序\ga_fcm_levelset\Lenna.bmp');
mRow=size(rgb_background,1); %numers of lines
nColumn=size(rgb_background,2);  %numers of rows
n=mRow*nColumn ;              %numers of x points
if size(rgb_background,3)==1; % determine the numbers of x's dimensions
    D=2;  
else D=3;
end
%hsv_background=rgb2hsv(rgb_background);
for i=1:D;   % dimension of x  = [n X D]
hsv{i}=rgb_background(:,:,i)';
%hsv{i}=hsv_background(:,:,i)';
x(:,i)=[hsv{i}(:)];
end
%以上为读取图片中的三维数据
我写的程序是有关聚类算法,对图像进行分割,这是最开始的部分,希望将图像数据用一个变量x 表示,以便后面的分割。
回复
分享到:

使用道具 举报

发表于 2009-5-7 17:45 | 显示全部楼层
Ref :
12F 常见的程序出错问题整理 (eight)
http://forum.vibunion.com/forum/thread-46001-1-1.html
发表于 2009-5-7 17:50 | 显示全部楼层
看一下rgb_background,就知道错在何处了(这种错误,楼主可以自己调试出来的):
>> whos rgb_background
  Name                  Size             Bytes  Class    Attributes

  rgb_background      256x256            65536  uint8

评分

1

查看全部评分

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-22 13:44 , Processed in 0.056461 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表