作业帮 > 数学 > 作业

求hough变换问题如何利用hough变换求解变换后的图形的特性,比如圆形经过摄像投影变成椭圆,如何求出圆心在变换后的坐

来源:学生作业帮 编辑:百度作业网作业帮 分类:数学作业 时间:2024/06/23 16:50:32
求hough变换问题
如何利用hough变换求解变换后的图形的特性,比如圆形经过摄像投影变成椭圆,如何求出圆心在变换后的坐标系上的坐标,
求hough变换问题如何利用hough变换求解变换后的图形的特性,比如圆形经过摄像投影变成椭圆,如何求出圆心在变换后的坐
这样的代码网上很多.这个是我copy来的
Input:Original image in the form of an array:Image1[xMax][yMax]
Output:New image :Image2 [xMax][yMax] containing the detected straight lines.
Intermediate data structure:Hough [tMax][rMax] to calculate the corresponding lines.
Algorithm:
/* Fill in the Hough array*/
for (x=0; x< xMax; x++){
for (y=0 ; y< yMax ; y++){
if ( Image1[x][y] > IThresh){
for (t=0 ; t< tMax ; t++){
r = (x-xMax/2)*cos(t) +(y-yMax/2)*sin(t) ;
if (r >0) {Hough [t][r] ++;}
}
/* Process Hough array to find strong maxima */
for (t = 0; t < tMax / 2; t++)
for (r = 0; r < rMax; r++)
if (Hough[t][r] > Hthresh)
{
/* Check 5x5 neighborhood for max */
max = TRUE;
for (dt = (t - 2); dt = 0) && (dt < tMax) && (Hough[dt][dr] > Hough[t][r]))
{
max = FALSE;
break;
}
/* Process Hough array to create output image array */
if (max == TRUE)
{
makeLine(r,t);
}
}
void makeLine (r,t)
{
for (x=0 ; x