Multiply Image with a mask
조회 수: 15 (최근 30일)
이전 댓글 표시
I have a specific Dicom image (uint16) and i want to multiply it with a mask (double) and then use the final image to generate other information. As I know it is better if an image is uint16 than double but in order to multiply those two i have to convert one of them as uint16 or double..My code works right only when i turn my image into double, otherwise it returns me black image..Is there any differnece between double and uint16 images?What can I do to make my code work right and have uint16 image??
댓글 수: 0
채택된 답변
Thorsten
2015년 11월 4일
편집: Thorsten
2015년 11월 4일
You can convert the mask to uint16:
X = uint16(2^16*rand(10)); % sample image
M = zeros(size(X)); M(4:6, 6:8) = 1; % create sample mask
Y = uint16(M).*X; % combine image and mask
댓글 수: 5
Thorsten
2015년 11월 5일
Maybe it just looks black. If you use imshow, the default range from black to white is 0..65535. You can use imshow(X, []) to adapt the range to the values in the image.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!