图像分割(阈值分割和区域生长)vc++代码(6)
时间:2025-04-09
时间:2025-04-09
EnQu(q,i);
EnQu(p,j+1);
}
if(abs(data[i*step+j-1]-data[i*step+j])<18&&(data2[(i)*step+j-1]==0)&&(i>0)&&(i<height)&&(j-1>0)&&(j-1<width))
{ data2[i*step+j-1]=255; EnQu(q,i);
EnQu(p,j-1);
}
q->front=(q->front+1);
p->front=(p->front+1);
}
//显示生长范围
cvNamedWindow("win2", 1);
cvShowImage( "win2", pImg2 );//显示图像
cvWaitKey(0); cvDestroyWindow( "win1" );//销毁窗口
cvDestroyWindow( "win2" );
cvReleaseImage( &pImg ); //释放图像
return 0;
}