Need to remove the black background from image patches
조회 수: 2 (최근 30일)
이전 댓글 표시
I have patches of an image . I want to remove those patches which only contain the black background of the image . The image is medical CT scan image of the brain. As you can see in the attachment, the original image and the patches of that image, i want to remove those patches which are only black patches i.e patches of the image background.
FYI , please ignore label of the patch.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154760/image.jpeg)
댓글 수: 0
채택된 답변
Image Analyst
2016년 7월 8일
Inside your loop where you're creating the subplots of the subimages, do this
for k = 1 : 121
thisImage = ....whatever....
if mean2(thisImage) < 20 % Or whatever value you want
continue;
end
subplot(......
end
댓글 수: 0
추가 답변 (1개)
Thorsten
2016년 7월 8일
편집: Thorsten
2016년 7월 8일
You can detect an all-black patch P if the maximum value is 0 (in the ideal case) or below a certain threshold, say 0.1 (if the image values range from 0 to 1)
threshold = 0.1;
isblack = max(P(:)) < threshold;
And if it is black, you do not show the patch.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!