The value of an image after adapthisteq

1 回表示 (過去 30 日間)
Wei Qing
Wei Qing 2013 年 1 月 22 日
After I contrast enhance an image by using adapthisteq, the pixels of the image will convert to some decimals value? How can I convert back it to pixels?
For example, I adapthisteq(img1). After that I type img1 inside Matlab, it show me some decimal value of img1 instead of the pixels value of img1. Howevver, what I actually want is the pixels value of img1 after adapthisteq, so how can I convert it back?

回答 (2 件)

Image Analyst
Image Analyst 2013 年 1 月 23 日
I'm not sure what you mean. img1 is an array that is the same thing as before you called adapthisteq(img1). MATLAB is pass by value so there is no way that adapthisteq() changes img1 at all. Also, the output of adapthisteq is the same type as img1. If your img1 was uint8 than adapthisteq() will return a uint8 image - just try the example and prove it to yourself. So you are not describing your situation correctly. Perhaps if you provide your actual code and do a better job of explaining...
  1 件のコメント
Image Analyst
Image Analyst 2013 年 1 月 23 日
Regarding your "Answer", you can mask an image like this without converting to double:
% Mask the image.
maskedRgbImage = bsxfun(@times, rgbImage, cast(mask,class(rgbImage)));
rgbImage can be a gray scale image also.

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


Wei Qing
Wei Qing 2013 年 1 月 23 日
I see. After i try some example myself, I found that the the problem is not adapthisteq, but is im2double. Here is my code :-
img1 = im2double(imread('1.bmp')); img1 = imresize(img1, 0.5); mask_height=4; mask_width=20; [fvr,edges] = lee_region(img1,mask_height,mask_width); imgd = im2double(fvr).*img1;
img1 is a finger vein grayscale image with pixel value. fvr is the Region of Interest(ROI) of finger vein in binary form. After that I combine the img1 with fvr by using .*. Since the img1 and fvr are different type, so I have to use im2double to make them as same type only can combine. However, im2double will change the pixel value 0-255 to decimal. Therefore, is that any way to convert it back to pixels after .*?

カテゴリ

Help Center および File ExchangeRead, Write, and Modify Image についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by