writing into an image does not work as expected

2 ビュー (過去 30 日間)
Marie-Sophie Pichler
Marie-Sophie Pichler 2020 年 1 月 15 日
newImage = ones(10, 10, 0)
newImage(1, 1, :) = [37, 49, 40];
- > the pixel at position 1, 1 is displayed white instead of green.
This is just an example, actually i need to write part of a processed image into a new image.
it looks kind of this:
newImage(startX:endX, startY:endY, :) = processedImage;
if i check the value for newImage(1, 1) it is correctly set to [27, 49, 40]

採用された回答

Image Analyst
Image Analyst 2020 年 1 月 15 日
Try to make it a uint8 image:
newImage = ones(10, 10, 3, 'uint8);
The problem was that it was double, and if it's double it expects all values to be between 0 and 1 and any that are over 1 are displayed as 1, which is white.
  1 件のコメント
Marie-Sophie Pichler
Marie-Sophie Pichler 2020 年 1 月 15 日
thanks so much! it drove me crazy :D

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

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by