필터 지우기
필터 지우기

uint8 and double in case of image

조회 수: 5 (최근 30일)
vaishali
vaishali 2014년 11월 27일
편집: Image Analyst 2014년 11월 27일
Hello
In one of the image encryption method I need to convert an image from uint8 to double. But after converting the whole, image is losing some information only white colour with some coloured dots will appear in that double image. so after the required task how to convert it to original image? please guide..
Thanks

채택된 답변

per isakson
per isakson 2014년 11월 27일
Try
a=imread('lena.jpg');
imshow(a);
b=double(a);
imshow(b/255);
  댓글 수: 1
vaishali
vaishali 2014년 11월 27일
Thank You Per Isakson..

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 11월 27일
Look at the variable in the workspace/variable editor and tell me if there is data loss there. Chances are you're just not displaying it correctly. For double, if it's not in the range o-1, you need to use [] as the second argument in imshow():
imshow(doubleImage, []);
  댓글 수: 2
vaishali
vaishali 2014년 11월 27일
편집: per isakson 2014년 11월 27일
in workspace the number of elements not changing.but while displaying
a=imread('lena.jpg');
imshow(a);
b=double(a);
imshow(b,[]);
after converting it to double it is showing blank white background with some dots. if this is the case how to get back original lena?
Image Analyst
Image Analyst 2014년 11월 27일
편집: Image Analyst 2014년 11월 27일
The badly-named "a" must be a color image. You cannot display double RGB images unless they're in the range 0-1. You must cast to uint8 first. And since it's color, you won't need the [] - it will ignore them.
imshow(uint8(b));
Or you can divide your array by 255 (which is intmax('uint8')) like per showed.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by