저 대비 이미지 분할에 문제가 있습니다. 작업은 표면 결함을 찾는 것입니다. 그들은 보이지만 (결함은 항상 어두운 영역 임) 이미지의 대비가 매우 낮습니다. 두 개 샘플 아래. 저 대비 이미지 세분화
내가 대비를 강화하려하고 tresholding 한
:Mat tmp1 = imread("C:\\framesRoi\\311.bmp",0);
stretchContrast(tmp1);
threshold(tmp1,tmp1,75,255,THRESH_BINARY);
스트레치 대비 IMPL은 :
int minValue = 255, maxValue = 0;
const int l = sourceImg.cols * sourceImg.rows * sourceImg.channels();
if(sourceImg.isContinuous())
{
uchar* ptr = sourceImg.ptr<uchar>(0);
for(int i = 0; i < l; ++i)
{
if(ptr[i] < minValue)
{
minValue = ptr[i];
}
if(ptr[i] > maxValue)
{
maxValue = ptr[i];
}
}
}
cout<<"min: "<<minValue<<";"<<"max value: "<<maxValue<<endl;
const int magicThreshold = 10;
if(sourceImg.isContinuous())
{
uchar* ptr = sourceImg.ptr<uchar>(0);
for(int i = 0; i < l; ++i)
{
ptr[i] = 255 * (ptr[i]-minValue)/(maxValue - minValue);
}
}
그러나이 방법은 실패했습니다. 이 많은 거짓 탐지는 모든 결함이 감지되지 : 여기
테스트 프레임 우편입니다 : 사람들이 당신의 코멘트에 말했듯이 https://dl.dropboxusercontent.com/u/47015140/testFrames.rar
, 당신은 유용한 임계 값을 선택하는 데 필요한 컨텍스트를 잃게됩니다. –
@ MarkRansom : 어떻게해야합니까? – krzych
결함이 항상 어둡다는 것을 안다면 밝은 영역이 일치하도록 대비를 변경하지 않고 밝기를 조정할 수 있습니다. 90 번째 백분위 수를 사용하면 노이즈에 덜 취약하지만 최대치로 할 수 있습니다. –