フィルターのクリア

How to R,G and B channels of an image? These 3 separate images are at an offset

2 ビュー (過去 30 日間)
Emmanuel
Emmanuel 2016 年 1 月 18 日
回答済み: Image Analyst 2016 年 1 月 18 日
Given R, G and B channel of an image, at an offset, how do you align it to form an image?

回答 (2 件)

Walter Roberson
Walter Roberson 2016 年 1 月 18 日
Assuming 2D arrays R, G, B, and scalars Rrow_offset, Rcol_offset, Grow_offset, Gcol_offset, Brow_offset, Bcol_offset, each of which are the row or column offsets from the upper left for that color plane (that is, I do not assume that the three planes have the same offsets or that they have the same sizes)
[Rrow, Rcol] = size(R);
[Grow, Gcol] = size(G);
[Brow, Bcol] = size(B);
maxrow = max([Rrow + Rrow_offset, Grow + Grow_offset, Brow + Brow_offset]);
maxcol = max([Rcol + Rcol_offset, Gcol + Gcol_offset, Bcol + Bcol_offset]);
aligned_RGB = zeros(maxrow, maxcol, class(R)); %same datatype as R
aligned_RGB(Rrow_offset + (1:Rrow)-1, Rcol_offset + (1:Rcol)-1) = R;
aligned_RGB(Grow_offset + (1:Grow)-1, Gcol_offset + (1:Gcol)-1) = G;
aligned_RGB(Brow_offset + (1:Brow)-1, Bcol_offset + (1:Bcol)-1) = B;
  2 件のコメント
Emmanuel
Emmanuel 2016 年 1 月 18 日
Is there any way we could find offset?
Walter Roberson
Walter Roberson 2016 年 1 月 18 日
What exactly are the inputs? Three 2D matrices of the same size, each of which represents one color channel from the same object taken from the same location (at the same time) but for some reason the channels have been shifted relative to each other? Is there rotation? Is the match possibly not exact? Is there possibly distortion between the images? Is this an attempt at stereo image rectification except with three cameras?

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


Image Analyst
Image Analyst 2016 年 1 月 18 日
Just extract the 3 color channels
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
Then call imregister() to align the green image with the red one, and again to align the blue image with the red one. imregister() was meant for this kind of thing.

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by