當我任何圖像上做segemtation它與背景和前景的表示返回一個圖像I-E的二值圖像。 現在如果我想使用的圖像的背景只爲任何目的.....怎麼辦it..i均值分割後我得到的二進制圖像現在如何識別(或服用)僅背景值。 ???????在Matlab分割後如何利用背景值從圖像?
0
A
回答
0
我假設你有一個灰度圖像。當你的分割目標爲1,背景爲0時,只需進行元素明智的矩陣乘法運算即可得到目標圖像。這與掩蔽相似。如果你只需要背景,你可以做(1 - 二進制圖像),並做相似的乘法與原始圖像。請記住,這是元素明智的乘法而不是矩陣乘法。
1
% Assume you have these variables:
% 'mask' - binary segmentation results, all 1's or 0's.
% 'img' - original image.
% 'bgImg' - Output, containing background only.
bgImg = zeros(size(img)); % Initialize to all zeros.
bg(mask) = img(mask); % Use logical indexing.
0
如果要衡量前景/背景區域的統計,一個有趣的選擇是regionprops
% img - variable containing original grey-scale image
% mask - binary mask (same size as img) with 0 - background 1 - foreground
% using regionprops to measure average intensity and weighted centroid,
% there are MANY more interesting properties ou can measure, use
% >> doc regionprops
% to discover them
st = regionprops(mask + 1, img, 'MeanIntensity', 'WeightedCentroid');
% get BG avg intensity:
fprintf(1, 'Avg intensity of background = %.2g\n', st(1).MeanIntensity);
相關問題
- 1. Matlab - 基於前景背景分割的裁剪圖像
- 2. 分割從背景
- 3. 圖像分割(MATLAB)
- 4. Matlab分割圖像
- 5. 背景顏色圖像分割 - OpenCV Android
- 6. 被分割的背景圖像
- 7. 圖像分割/背景減除
- 8. 如何從圖像中刪除背景而無需在MATLAB中匹配背景
- 9. 如何在另一個背景圖像背後設置背景?
- 10. Matlab - 顯示背景圖像
- 11. 如何重複背景圖像中的特殊分割方式
- 12. 如何使用頻域從背景分割圖像(理論 - 不是代碼)
- 13. 圖像分割Matlab的
- 14. 如何在圖中放置背景圖像(使用matlab GUIDE)
- 15. (OpenCV)前景和背景顏色相近的圖像分割?
- 16. 如何從圖像精靈中擠壓部分背景圖像
- 17. matlab繪圖圖像作爲背景圖
- 18. 如何圖像值從MATLAB
- 19. 在背景圖像背景圖像
- 20. 使用MATLAB分割圖像處理
- 21. 如何在matlab中繪製背景圖中的圖像
- 22. 如何在matlab中查找圖像分割部分的厚度?
- 23. 從背景圖像
- 24. 存在嘈雜背景時的圖像分割
- 25. 設置股利背景圖像
- 26. 如何把背景圖像放在logo圖像後面?
- 27. 使用matlab實現圖像分割中分割圖像包含多少片
- 28. 從attr分配背景圖像
- 29. 圖像分割:如何隔離人體圖形和複雜背景?
- 30. 如何使用MATLAB檢索任意圖像的背景顏色?
你們,我有一個灰度圖像,我只是想,用1來表示的背景圖像(在分割後我的圖像的情況)。現在我想從背景像素形成原始圖像,並希望取平均值的背景像素。 – chee 2011-04-14 18:52:48
如果我有命名爲「IMG」 ..比我可以通過使用查找語句等的ind採取背景衣被合計分割圖像=找到(IMG == 1); BT它給了奇怪的事情..... – chee 2011-04-14 18:57:45
@chee請添加這些意見你的問題 - 他們使它更加清晰。 – Shai 2012-12-12 16:20:26