智慧剪刀影像分割。 更多...
#include <opencv2/imgproc/segmentation.hpp>
|
| | IntelligentScissorsMB () |
| |
| IntelligentScissorsMB & | applyImage (InputArray image) |
| | 指定輸入影像並提取影像特徵。
|
| |
| IntelligentScissorsMB & | applyImageFeatures (InputArray non_edge, InputArray gradient_direction, InputArray gradient_magnitude, InputArray image=noArray()) |
| | 指定輸入影像的自定義特徵。
|
| |
| void | buildMap (const Point &sourcePt) |
| | 為影像上給定的源點準備最佳路徑的地圖。
|
| |
| void | getContour (const Point &targetPt, OutputArray contour, bool backward=false) const |
| | 提取影像上給定目標點的最佳輪廓。
|
| |
| IntelligentScissorsMB & | setEdgeFeatureCannyParameters (double threshold1, double threshold2, int apertureSize=3, bool L2gradient=false) |
| | 切換邊緣特徵提取器以使用 Canny 邊緣檢測器。
|
| |
| IntelligentScissorsMB & | setEdgeFeatureZeroCrossingParameters (float gradient_magnitude_min_value=0.0f) |
| | 切換到“拉普拉斯過零點”邊緣特徵提取器並指定其引數。
|
| |
| IntelligentScissorsMB & | setGradientMagnitudeMaxLimit (float gradient_magnitude_threshold_max=0.0f) |
| | 指定梯度幅度最大值閾值。
|
| |
| IntelligentScissorsMB & | setWeights (float weight_non_edge, float weight_gradient_direction, float weight_gradient_magnitude) |
| | 指定特徵函式的權重。
|
| |
智慧剪刀影像分割。
此類用於查詢兩點之間的路徑(輪廓),該路徑可用於影像分割。
使用示例
Point source_point(200, 100);
Point target_point(400, 300);
std::vector<Point> pts;
參考文獻: "用於影像合成的智慧剪刀" 由 Eric N. Mortensen 和 William A. Barrett 設計的演算法,楊百翰大學 [202]
◆ IntelligentScissorsMB()
| cv::segmentation::IntelligentScissorsMB::IntelligentScissorsMB |
( |
| ) |
|
| Python |
|---|
| cv.segmentation.IntelligentScissorsMB( | | ) -> | <segmentation_IntelligentScissorsMB 物件> |
◆ applyImage()
| Python |
|---|
| cv.segmentation.IntelligentScissorsMB.applyImage( | image | ) -> | retval |
◆ applyImageFeatures()
| Python |
|---|
| cv.segmentation.IntelligentScissorsMB.applyImageFeatures( | non_edge, gradient_direction, gradient_magnitude[, image] | ) -> | retval |
指定輸入影像的自定義特徵。
applyImage() 呼叫的自定義高階變體。
- 引數
-
| non_edge | 指定非邊緣畫素的成本。型別為 CV_8UC1。期望值為 {0, 1}。 |
| gradient_direction | 指定梯度方向特徵。型別為 CV_32FC2。值應標準化: x^2 + y^2 == 1 |
| gradient_magnitude | 指定梯度幅度函式的成本:型別為 CV_32FC1。值應在範圍 [0, 1] 內。 |
| image | 可選引數。如果指定了特徵的子集,則必須指定(未指定的特徵在內部計算) |
◆ buildMap()
| void cv::segmentation::IntelligentScissorsMB::buildMap |
( |
const Point & | sourcePt | ) |
|
| Python |
|---|
| cv.segmentation.IntelligentScissorsMB.buildMap( | sourcePt | ) -> | 無 |
◆ getContour()
| void cv::segmentation::IntelligentScissorsMB::getContour |
( |
const Point & | targetPt, |
|
|
OutputArray | contour, |
|
|
bool | backward = false ) const |
| Python |
|---|
| cv.segmentation.IntelligentScissorsMB.getContour( | targetPt[, contour[, backward]] | ) -> | contour |
提取影像上給定目標點的最佳輪廓。
- 注意
- buildMap() 必須在此呼叫之前呼叫
- 引數
-
| targetPt | 目標點 |
| [輸出] | contour | 畫素列表,其中包含影像的源點和目標點之間的最佳路徑。型別為 CV_32SC2(與 std::vector<Point> 相容) |
| backward | 指示檢索到的畫素的反向順序的標誌(使用“true”值從目標點獲取到源點的點) |
◆ setEdgeFeatureCannyParameters()
| IntelligentScissorsMB & cv::segmentation::IntelligentScissorsMB::setEdgeFeatureCannyParameters |
( |
double | threshold1, |
|
|
double | threshold2, |
|
|
int | apertureSize = 3, |
|
|
bool | L2gradient = false ) |
| Python |
|---|
| cv.segmentation.IntelligentScissorsMB.setEdgeFeatureCannyParameters( | threshold1, threshold2[, apertureSize[, L2gradient]] | ) -> | retval |
切換邊緣特徵提取器以使用 Canny 邊緣檢測器。
- 注意
- 預設使用“拉普拉斯過零點”特徵提取器(遵循原始文章)
- 另請參見
- Canny
◆ setEdgeFeatureZeroCrossingParameters()
| IntelligentScissorsMB & cv::segmentation::IntelligentScissorsMB::setEdgeFeatureZeroCrossingParameters |
( |
float | gradient_magnitude_min_value = 0.0f | ) |
|
| Python |
|---|
| cv.segmentation.IntelligentScissorsMB.setEdgeFeatureZeroCrossingParameters( | [, gradient_magnitude_min_value] | ) -> | retval |
切換到“拉普拉斯過零點”邊緣特徵提取器並指定其引數。
根據文章,預設使用此特徵提取器。
此實現對低振幅噪聲的區域進行了額外的過濾。此過濾透過最小梯度振幅引數啟用(使用一些小值 4、8、16)。
- 注意
- 此特徵提取器的當前實現基於灰度影像的處理(彩色影像首先轉換為灰度影像)。
- Canny 邊緣檢測器稍慢,但提供更好的結果(尤其是在彩色影像上):使用 setEdgeFeatureCannyParameters()。
- 引數
-
| gradient_magnitude_min_value | 邊緣畫素的最小梯度幅度值(預設值:0,停用檢查) |
◆ setGradientMagnitudeMaxLimit()
| IntelligentScissorsMB & cv::segmentation::IntelligentScissorsMB::setGradientMagnitudeMaxLimit |
( |
float | gradient_magnitude_threshold_max = 0.0f | ) |
|
| Python |
|---|
| cv.segmentation.IntelligentScissorsMB.setGradientMagnitudeMaxLimit( | [, gradient_magnitude_threshold_max] | ) -> | retval |
指定梯度幅度最大值閾值。
零限制值用於停用梯度幅度閾值處理(預設行為,如原始文章中所述)。否則,梯度幅度 >= 閾值的畫素具有零成本。
- 注意
- 閾值處理應該用於具有不規則區域的影像(以避免卡在高對比度區域的引數上,如嵌入式徽標)。
- 引數
-
| gradient_magnitude_threshold_max | 指定梯度幅度最大值閾值(預設值:0,停用) |
◆ setWeights()
| IntelligentScissorsMB & cv::segmentation::IntelligentScissorsMB::setWeights |
( |
float | weight_non_edge, |
|
|
float | weight_gradient_direction, |
|
|
float | weight_gradient_magnitude ) |
| Python |
|---|
| cv.segmentation.IntelligentScissorsMB.setWeights( | weight_non_edge, weight_gradient_direction, weight_gradient_magnitude | ) -> | retval |
指定特徵函式的權重。
考慮保持權重標準化(權重之和等於 1.0)離散動態規劃 (DP) 的目標是最小化畫素之間的成本。
- 引數
-
| weight_non_edge | 指定非邊緣畫素的成本(預設值:0.43f) |
| weight_gradient_direction | 指定梯度方向函式的成本(預設值:0.43f) |
| weight_gradient_magnitude | 指定梯度幅度函式的成本(預設值:0.14f) |
此類文件由以下檔案生成