Adding corresponding pixels of input images to produce an output image in matlab

1 回表示 (過去 30 日間)
Mohammed
Mohammed 2016 年 9 月 10 日
コメント済み: Jemal Andeta 2018 年 9 月 15 日
I am writing a function that can take any number of 1D arrays representing coloured images. the output should be a 3D array to represent an image that represents the combined image? how would i write a matlab code that adds corresponding elements together from each of the input images?
For example, if we have 3 images as inputs, pixel 1 from image 1 + pixel 1 from image 2 + pixel 1 from image 3 = pixel 1 in the output image
Thanks :)

回答 (2 件)

Image Analyst
Image Analyst 2016 年 9 月 10 日
See my attached demo to average RGB images. Adapt as needed.

Jemal Andeta
Jemal Andeta 2018 年 9 月 14 日
This answer is not timely, but in case if needed by someone. Thanks!
  2 件のコメント
Image Analyst
Image Analyst 2018 年 9 月 14 日
But you don't need to loop over rows and columns. You can just sum the entire image directly as I did in my answer:
sumImage = sumImage + double(thisImage); % Be sure to cast to double to prevent clipping.
Jemal Andeta
Jemal Andeta 2018 年 9 月 15 日
You are right! Thanks!

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

Community Treasure Hunt

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

Start Hunting!

Translated by