creating dye distribution profile with image processing

5 ビュー (過去 30 日間)
melody Sharifi
melody Sharifi 2017 年 2 月 20 日
コメント済み: melody Sharifi 2017 年 2 月 21 日
Hi All. I have two photos taken from a sandbox.the first one is reference and second one is the same sandbox after injection of dye which is blue. I did the following: ref=imread('ref.jpg'); p1=imread('photo.jpg'); dif=ref(:,:,:)-p1(:,:,:); imshow(dif)
since everything is the same in both pictures except dye, I expect to see the dye distribution by subtracting second photo from reference photo which doesnt have any dye but at the end I got a very black picture. does anybody know how to do this? I am a beginner so any help would be appreciated. Thanks.

採用された回答

John D'Errico
John D'Errico 2017 年 2 月 20 日
編集済み: John D'Errico 2017 年 2 月 20 日
If both pics are mostly identical, then what do you get when you subtract them? ZERO.
What color is [0 0 0]? Black. So you saw black. This is no surprise.
Worse, if the images are scaled [0-255], then they are stored as uint8 arrays. If the second number in a difference is larger than the first, the difference truncates at zero. Again, black.
So it depends on what you want to see, how you want to view it. I'd probably convert the images to double arrays, using double. Then when you subtract the two arrays, negative numbers will still make sense.
Next, I'd then shift and scale the difference so that a difference of zero would get mapped to a mid-level gray, and then I'd convert back into uint8 to return it into an image form.
  1 件のコメント
melody Sharifi
melody Sharifi 2017 年 2 月 21 日
Hi John, I converted both photos to double and I subtracted them. now I can see the dye distribution better but it is still dark and I dont know how to scale it. would you please let me know how to scale it. thanks so much.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by