This is the snippet for ROI I used threshold intensity for background as less than 4 and i get ROI but histogram for both original and roi image is same. so what's wrong here ? I used window of 3by3 or 5by5 to get roi
1 次查看(过去 30 天)
显示 更早的评论
clc;
close all;
a= imread('20051019_38557_0100_PP(1).tif');
[m n]=size(a);
N=input('enter the window size=');
%The window size can be 3x3,5x5etc Start=(N+1)/2;
Out_Imag=a;
for
i=Start:m-Start+1,
for
j=Start:n-Start+1,
limit=(N-1)/2;
Sum=0;
for k=-limit:limit,
for l=-limit:limit,
if(a(i+k,j+l)<=4)
%Out_Imag(i,j)=255;
Out_Imag(Out_Imag(i,j) == 255) = NaN;
%else
% Out_Imag(i,j)=255;
end
end
end
end
end
original=rgb2gray(a);
imshow(original),title('original Image'),figure,
imhist(original),title('original hist Image'),figure,
%Out_Imag(Out_Imag(i,j) == 255) = NaN;
roi=rgb2gray(Out_Imag); imshow(roi),title('roi Image'),figure,
imhist(roi),title('roi_hist Image')
% imshow(uint8(a)),title('original Image'),figure,
% imshow(uint8(Out_Imag)),title('ROI Image');
% InHistgray=rgb2gray(a);
% imhist(histgray),title('Histogram of original Image'),figure,
% OuyHistgray=rgb2gray(a);
% imhist(OuyHistgray),title('Histogram of ROI Image');
回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!