필터 지우기
필터 지우기

Eror when aplaying Masking image to colorfull image

조회 수: 1 (최근 30일)
pizzaa
pizzaa 2023년 6월 14일
답변: Shrey Tripathi 2023년 6월 14일
mask image and source image size do not match
I got an error like that, what should i do?

채택된 답변

Shrey Tripathi
Shrey Tripathi 2023년 6월 14일
To help solve this issue, it would be good if you provide some context in terms of what code you have written, where the error is occurring, the images that are being used, and/or the dimensions of the images being used.
Nevertheless, to debug the issue, you can start with checking the size of both images using the size function and make sure they both have the same number of rows and columns.
size(maskImage)
size(sourceImage)
If the sizes don't match, you can either resize the mask image to match the source image or vice versa. For example, to resize the mask image:
resizedMask = imresize(maskImage, [size(sourceImage, 1) size(sourceImage, 2)]);
This will resize the mask image to have the same number of rows and columns as the source image.
Then, apply the mask to the source image using the imoverlay function:
maskedSource = imoverlay(sourceImage, resizedMask, [1 0 0]);
This will apply the mask to the source image and highlight the masked regions with red color.
All of this assumes that the mask is a binary image with 0's and 1's indicating the masked and unmasked regions, respectively. If the mask has more than two values, you may need to convert it to a binary mask using the imbinarize function.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by