how to convert a double matrix image to a unit8 matrix ?
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mariem Harmassi
am 8 Mär. 2013
Kommentiert: Bruno Aravena Pérez
am 29 Apr. 2022
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.
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 8 Mär. 2013
Bearbeitet: Azzi Abdelmalek
am 8 Mär. 2013
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 Kommentare
Azzi Abdelmalek
am 8 Mär. 2013
Bearbeitet: Azzi Abdelmalek
am 8 Mär. 2013
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))
Weitere Antworten (1)
Image Analyst
am 8 Mär. 2013
You can use the mat2gray() function:
image8Bit = uint8(255 * mat2gray(floatingPointImage));
It will scale your values to the range 0-255.
10 Kommentare
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!