freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

圖像閾值分割及去噪的實現(xiàn)畢業(yè)論文-資料下載頁

2025-06-23 20:29本頁面
  

【正文】 zes a gray scale image 39。imag39。 into a binary image% Input:% imag: the gray scale image, with black foreground(0), and white% background(255).% Output:% imagBW: the binary image of the gray scale image 39。imag39。, with kittler39。s% minimum error thresholding algorithm.% Reference:% J. Kittler and J. Illingworth. Minimum Error Thresholding. Pattern% Recognition. 1986. 19(1):4147MAXD = 100000。imag = imag(:,:,1)。[counts, x] = imhist(imag)。 % counts are the histogram. x is the intensity level.GradeI = length(x)。 % the resolusion of the intensity. . 256 for uint8.J_t = zeros(GradeI, 1)。 % criterion functionprob = counts ./ sum(counts)。 % Probability distributionmeanT = x39。 * prob。 % Total mean level of the picture% Initializationw0 = prob(1)。 % Probability of the first classmiuK = 0。 % Firstorder cumulative moments of the histogram up to the kth level.J_t(1) = MAXD。 n = GradeI1。for i = 1 : n w0 = w0 + prob(i+1)。 miuK = miuK + i * prob(i+1)。 % firstorder cumulative moment if (w0 == 0) || (w0 == 1) J_t(i+1) = MAXD。 % T = i else miu1 = miuK / w0。 miu2 = (meanTmiuK) / (1w0)。 var1 = (((0 : i)39。miu1).^2)39。 * prob(1 : i+1)。 var1 = var1 / w0。 % variance var2 = (((i+1 : n)39。miu2).^2)39。 * prob(i+2 : n+1)。 var2 = var2 / (1w0)。 if var1 0 amp。amp。 var2 0 % in case of var1=0 or var2 =0 J_t(i+1) = 1+w0 * log(var1)+(1w0) * log(var2)2*w0*log(w0)2*(1w0)*log(1w0)。 else J_t(i+1) = MAXD。 end endendminJ = min(J_t)。index = find(J_t == minJ)。th = mean(index)。th = (th1)/nimagBW = im2bw(imag, th)。% figure, imshow(imagBW), title(39。kittler binary39。)。 :function imagBW = otsu(imag)% Reference:% Nobuyuki Otsu. A Threshold Selection Method from GrayLevel Histograms.% IEEE Transactions on Systems, Man, and Cybernetics. (1):6266imag = imag(:, :, 1)。[counts, x] = imhist(imag)。 % counts are the histogram. x is the intensity level.GradeI = length(x)。 % the resolusion of the intensity. . 256 for uint8.varB = zeros(GradeI, 1)。 % Betweenclass Variance of binarized image.prob = counts ./ sum(counts)。 % Probability distributionmeanT = 0。 % Total mean level of the picturefor i = 0 : (GradeI1) meanT = meanT + i * prob(i+1)。endvarT = ((xmeanT).^2)39。 * prob。 % Initializationw0 = prob(1)。 % Probability of the first classmiuK = 0。 % Firstorder cumulative moments of the histogram up to the kth level.varB(1) = 0。% Betweenclass variance calculationfor i = 1 : (GradeI1) w0 = w0 + prob(i+1)。 miuK = miuK + i * prob(i+1)。 if (w0 == 0) || (w0 == 1) varB(i+1) = 0。 else varB(i+1) = (meanT * w0 miuK) .^ 2 / (w0 * (1w0))。 endendmaxvar = max(varB)。em = maxvar / varT % Effective measureindex = find(varB == maxvar)。index = mean(index)。th = (index1)/(GradeI1)imagBW = im2bw(imag, th)。% thOTSU = graythresh(imag)% imagBWO = im2bw(imag, thOTSU)。 :function imagBW = niblack(imag)tic。k = 。 % the first manual parameterb = 80。 % the second manual parameter, about the width of the square neighborhoodchoice = 1。 % 1 for pixeltopixel putation, 2 for pixel averaging within the square neighborhood for fast putation.imag = imag( :, :, 1)。[Hei, Wid] = size(imag)。imag = padarray(imag, [b b], 39。symmetric39。, 39。both39。)。 % Pad image array Hei_pad = Hei + 2 * b。Wid_pad = Wid + 2 * b。imagBW = false(Hei_pad, Wid_pad)。switch choice case 1 for i = 1+b : Hei+b for j = 1+b : Wid+b upR = ifloor(b/21/2)。 dnR = i+floor(b/2)。 lfC = jfloor(b/21/2)。 rtC = j+floor(b/2)。 m_ij = mean(mean(imag(upR : dnR, lfC : rtC)))。 sigma_squared = double(imag(upR : dnR, lfC : rtC)) m_ij。 sigma_squared = mean(mean(sigma_squared .^2))。 sigma = sqrt(sigma_squared)。 th_ij = m_ij + k * sigma。 if double(imag(i,j)) th_ij imagBW(i,j) = 1。 end end end case 2 for i = 1+b : b : Hei+b for j = 1+b : b : Wid+b upR = ifloor(b/21/2)。 dnR = i+floor(b/2)。 lfC = jfloor(b/21/2)。 rtC = j+floor(b/2)。 m_ij = mean(mean(imag(upR : dnR, lfC : rtC)))。 sigma_squared = double(imag(upR : dnR, lfC : rtC)) repmat(m_ij, (dnRupR+1), (rtClfC+1))。 sigma_squared = sigma_squared .^ 2。 sigma_squared = mean(mean(sigma_squared))。 sigma = sqrt(sigma_squared)。 th_ij = m_ij + k * sigma。 imagBW(upR : dnR, lfC : rtC) = double(imag(upR : dnR, lfC : rtC)) th_ij。 end end otherwise display(39。Wrong Choice!39。)。endimagBW = imagBW(1+b : Hei+b, 1+b : Wid+b)。% figure, imshow(imagBW), title(39。Binarized Image39。)。toc。
點擊復制文檔內(nèi)容
規(guī)章制度相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1