what does this line means in the following code? I=I(200:400,250:450,:); and when i change the ratio there comes an error of "index exceeds matrix dimensions"

2 ビュー (過去 30 日間)
I=imread('images/Persepolis_Taureaux.jpg');
I=I(200:400,250:450,:);% about M1:60second % M2:70second % M3:60second
tic
S=regcovsmooth(I,10,4,0.2,'M1');
toc

採用された回答

Andrew Newell
Andrew Newell 2017 年 4 月 18 日
編集済み: Andrew Newell 2017 年 4 月 19 日
The function imread retrieves a 3D array consisting of 2D images in various colors or grayscale. The number of these images depends on the size of the third dimension (see Multidimensional arrays). They may, for example, be the red, green and blue components of the total color. The command I=I(200:400,250:450,:) is taking a rectangular sample out of each of these images. As for how regcovsmooth deals with it, this is software from GitHub that I'm not familiar with.
  5 件のコメント
Walter Roberson
Walter Roberson 2017 年 4 月 19 日
For the full image, leave out the line
I=I(200:400,250:450,:);% about M1:60second % M2:70second % M3:60second
Or if you want to leave something there as a placeholder to make it easier to change back, then
I = I(:,:,:);
misbah mateen
misbah mateen 2017 年 4 月 19 日
ok. thank you. it works for full image.

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

その他の回答 (2 件)

msahar
msahar 2017 年 4 月 18 日
編集済み: msahar 2017 年 4 月 19 日
I am assuming that you are particularly asking about regcovsmooth function. This function is used for preserving image smoothing via region covariances. The output S is the structure component extracted from input image I.
Please read the research paper at the link given below,
  3 件のコメント
msahar
msahar 2017 年 4 月 19 日
編集済み: msahar 2017 年 4 月 19 日
This line just scale the image (i is used to take out the desired portion of image) so that it take the form of positive definite matrix.

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


Image Analyst
Image Analyst 2017 年 4 月 18 日
regcovsmooth
It probably wants a gray scale image, not a color image. At least that's what I'd try to get rid of the error message.
tic
I = rgb2gray(I);
S = regcovsmooth(I,10,4,0.2,'M1');
By the way, please pick a more descriptive variable name than I. It looks too must like 1 (one) and l (lower case L).
  5 件のコメント
Image Analyst
Image Analyst 2017 年 4 月 19 日
The code has virtually no comments and that makes it very hard for someone other than the author to support it. Either that was their intent, or they just don't write very good code. I'd have to spend quite a bit of time to understand what that code does, and you can do that just as well as we can. I suggest you contact the author.

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

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by