Converting uint8 array into 32-bit

조회 수: 33 (최근 30일)
A
A 2012년 6월 6일
I have a 1280x960 uint8 array that I would like to convert into uint32. Any suggestions?
Thanks!

채택된 답변

Walter Roberson
Walter Roberson 2012년 6월 6일
uint32(YourArray)
Are you also wanting to scale the values so that 255 in uint8 becomes a large value in uint32? If so then
uint32(YourArray) .* uint32(2^24)
  댓글 수: 2
A
A 2012년 6월 6일
Hm, okay I guess that this doesn't do the operation I thought it would.
I am trying to minic the photo processing software, ImageJ. When I subtract two images (to remove the background from a file with an image), ImageJ gives me the option to "Convert 32-bit float", which emphasizes the contrast so that my resultant image is not completely black. Do you have an idea of how I can achieve this in matlab?
Please let me know if you would like to see some images to better understand what I mean, I can upload them.
Walter Roberson
Walter Roberson 2012년 6월 6일
im2double() your original arrays and subtract those. The result will be double precision in the range -1 to +1. You can imagesc() to view, or add 1.0 and divide the result by 2 in order to get a matrix in the range 0 to 1 with 0.5 representing "no difference"

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

추가 답변 (1개)

Thomas
Thomas 2012년 6월 6일
I'm not sure maybe the type cast command will help
doc typecast
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 6월 6일
typecast would be for the case where several uint8 had to be bundled together to form a single uint32.

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

카테고리

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