Histogram based thresholding for reduction in computation
이전 댓글 표시
i am planning to use histcounts () function for histogram based threshold We know that histogram is a plot of pixel intensity vs frequency. My plan is to use the histcounts function to identify the pixel intensity for a particular drop in frequency for the first time in the histogram and use it as a threshold. eg: say if I execute function [N edges] = histcounts(I) on image I and I get frequency values N = 5000 2000 1000 150 20 5 3 0 1 5 3 0 0 2 and edges = 0 2.5 2.7 3.0 3.5 3.8 4.2 4.6 4.9 5.4 5.7 6.1 7.3 7.7 8.1 then how do I choose a threshold by observing the minimum frequency for the first time and selecting the corresponding edge as the threshold. (In the above case 0 is the minimum frequency. I want the pixel intensity when this zero frequency occurs for the first time)
채택된 답변
추가 답변 (1개)
Image Analyst
2018년 9월 5일
You can pass "N" into imregionalmin() to get local mins (dips) in the histogram. Then use find() to find the first dip, if that's what you want. Something like (untested)
% Find all local mins (dips) in the histogram shape:
minIndexes = imregionalmin(N);
% minIndexes is 1 at every index that is a valley/min/dip.
% Find the first min
indexOfFirstMin = find(minIndexes, 1, 'first');
% Get the bin edge there and make that the threshold.
thresholdValue = edges(indexOfFirstMin);
카테고리
도움말 센터 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!