- ReadImage(&ho_Image, "D:/bb/tu/1.jpg");
- Rgb1ToGray(ho_Image, &ho_Image1);
- //将RGB图像转换为灰度图像
- GetImageSize(ho_Image1, &hv_Width, &hv_Height);
- SetWindowAttr("background_color","black");
- OpenWindow(10,10,hv_Width,hv_Height,0,"visible","",&hv_WindowHandle);
- HDevWindowStack::Push(hv_WindowHandle);
- AutoThreshold(ho_Image1, &ho_Regions, 10);
- //自动全局阈值--【根据灰度值分割成多个区域】
- //参数2:输出区域
- //参数3:高斯滤波的标准差--越大提取区域越少
- // 【标准差在值内的归为同一个区域】
- SetColor(hv_WindowHandle, "blue");
- if (HDevWindowStack::IsOpen())
- DispObj(ho_Image1, HDevWindowStack::GetActive());
- SetWindowAttr("background_color","black");
- OpenWindow(10,100,hv_Width,hv_Height,0,"visible","",&hv_WindowHandle1);
- HDevWindowStack::Push(hv_WindowHandle1);
- if (HDevWindowStack::IsOpen())
- DispObj(ho_Regions, HDevWindowStack::GetActive());
复制代码
设置颜色之后,还是一片空白? |