フィルターのクリア

Image Grey to Color

1 回表示 (過去 30 日間)
Ammar Taha
Ammar Taha 2020 年 7 月 12 日
コメント済み: Rena Berman 2020 年 7 月 22 日
Hi there, I am trying to perform certain task on the image:
In which I should divide it into three equal parts, then extract the RGB planes seperately and fuse all of them in a one color image:
img = imread('image.jpg');
[h, w] = size(img);
h_one = h / 3;
B = imcrop(img,[1, 1, w, h_one]);
G = imcrop(img,[1, 1*h_one, w, h_one]);
R = imcrop(img,[1, 2*h_one, w, h_one]);
colorImg(:,:,1) = R;
colorImg(:,:,2) = G;
colorImg(:,:,3) = B;
imshow(colorImg)
but the grader of the course doesn't accept it and tells me: Variable B must be of size [341 400]. It is currently of size [342 400], and I don't know to to handle it.
The result image:
  1 件のコメント
Rena Berman
Rena Berman 2020 年 7 月 22 日
(Answers Dev) Restored edit

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

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 7 月 12 日
B = imcrop(img,[1, 1, w, h_one]);
What is the first row number that will be extracted when you do that? What is the last row number that will be extracted when you do that?
G = imcrop(img,[1, 1*h_one, w, h_one]);
What is the first row number that will be extracted when you do that? What is the last row number that will be extracted when you do that?
Is the black border extracted above the top image the same height as the black border extracted above the middle image?
Is the black border extracted below the bottom image the same height as the black border extracted below the middle image?

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by