imdata = imread ('//www.tianjin-qmedu.com/matlabcentral/answers/uploaded_files/642495/image.png');
YAX = SUM(CONC2(单(灰色),[ - 1 -1 -1; 0 0 0; 1 1 1],“有效”),2);
xax = sum(conv2(单(灰色),[ - 1 -1 -1; 0 0 0; 1 1 1]',“有效”), 1);
图(1)中,次要情节(211),故事情节(xax),次要情节(212),故事情节(yax)
ROIy =找到(abs (yax) > 1 e5);
Roiyinner =查找(差异(Roiy)> 5);
ROIybounds = ROIy([ROIyinner ROIyinner+1]);
Roix = find(abs(xax)> 1e5);
Roixinner =查找(Diff(Roix)> 5);
ROIxbounds = ROIx([ROIxinner ROIxinner+1]);
PLTREGION =灰色(ROIYBOUNDS(1):ROIYBOUNDS(2),ROIXBOUNDS(1):ROIXBOUNDS(2));
PLTREGION(PLTREGION == 255)= NAN;
[n x] = hist(单(pltregion(:)),0:255);
图(3)中,情节(X, N),集(gca),'yscale'那'日志')
pltitems = find(n> 2000)
pltitems =
167 90 101 129 132 144 167 180 194
为了IND = 1:NUMER(PLTVALUES)
temp(plregion ==PLTvalues(ind) | (plregion <=50 & plregion >10))=255;
temp = bwareaopen(temp,1000);
图(100),子图(3,3,IND),ImageSC(TEMP)
图(101),次要情节(3,3,印第安纳州),显示亮度图像(单(PLTregion)。* temp, 255年[0])