필터 지우기
필터 지우기

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 CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by