フィルターのクリア

how to convert a double matrix image to a unit8 matrix ?

76 ビュー (過去 30 日間)
Mariem Harmassi
Mariem Harmassi 2013 年 3 月 8 日
Hi everybody :) I have an image ,a matrix with values between -0.0934 and 0 and i want to convert it to unit8 matrix with values between 0 ans 255.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 3 月 8 日
編集済み: Azzi Abdelmalek 2013 年 3 月 8 日
A=imread('yourimage')
B=uint8(A)
EDIT
d=linspace(min(im(:)),max(im(:)),256)
im1=uint8(arrayfun(@(x) find(abs(d(:)-x)==min(abs(d(:)-x))),im))
  4 件のコメント
Mariem Harmassi
Mariem Harmassi 2013 年 3 月 8 日
yes i tried uint8 it was just an error
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 3 月 8 日
編集済み: Azzi Abdelmalek 2013 年 3 月 8 日
Try this
%If im is your image
d=linspace(min(im(:)),max(im(:)),256)
im1=uint8(arrayfun(@(x) find(abs(d(:)-x)==min(abs(d(:)-x))),im))

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2013 年 3 月 8 日
You can use the mat2gray() function:
image8Bit = uint8(255 * mat2gray(floatingPointImage));
It will scale your values to the range 0-255.
  10 件のコメント
Juan Manuel Miguel
Juan Manuel Miguel 2020 年 8 月 6 日
Thank you, it was perfect for me!!
Bruno Aravena Pérez
Bruno Aravena Pérez 2022 年 4 月 29 日
Thanks!

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by