cvmorphing.cpp.svn-base
来自「非结构化路识别」· SVN-BASE 代码 · 共 397 行 · 第 1/2 页
SVN-BASE
397 行
for( ; begDestLine < endDestLine; begDestLine++ )
{
/* for each pixel */
begLineIndex = (int) begLine;
begLineIndex *= 3;
/* Blend R */
dst_pix[indexImg1] =
(uchar) (dst_pix[indexImg1] +
(uchar) (((unsigned int) (second_pix[begLineIndex]) * s1) >> 8));
indexImg1++;
/* Blend G */
dst_pix[indexImg1] =
(uchar) (dst_pix[indexImg1] +
(uchar) (((unsigned int) (second_pix[begLineIndex + 1]) * s1) >>
8));
indexImg1++;
/* Blend B */
dst_pix[indexImg1] =
(uchar) (dst_pix[indexImg1] +
(uchar) (((unsigned int) (second_pix[begLineIndex + 2]) * s1) >>
8));
indexImg1++;
begLine += step;
} /* for */
}
else
{
for( ; begDestLine < endDestLine; begDestLine++ )
{
/* for each pixel */
begLineIndex = (int) begLine;
begLineIndex *= 3;
/* Blend R */
dst_pix[indexImg1] = (uchar) (dst_pix[indexImg1] + second_pix[begLineIndex]);
indexImg1++;
/* Blend G */
dst_pix[indexImg1] =
(uchar) (dst_pix[indexImg1] + second_pix[begLineIndex + 1]);
indexImg1++;
/* Blend B */
dst_pix[indexImg1] =
(uchar) (dst_pix[indexImg1] + second_pix[begLineIndex + 2]);
/*assert(indexImg1 < dst_len); */
indexImg1++;
begLine += step;
} /* for */
} /* if */
begLineIndex = endLineIndex;
begLine = endLine;
} /* for each runs in second line */
return CV_NO_ERR;
} /* icvMorphEpilines8uC3 */
/*======================================================================================*/
CvStatus
icvMorphEpilines8uC3Multi( int lines, /* number of lines */
uchar * first_pix, /* raster epilines from the first image */
int *first_num, /* numbers of pixel in first line */
uchar * second_pix, /* raster epilines from the second image */
int *second_num, /* numbers of pixel in second line */
uchar * dst_pix, /* raster epiline from the destination image */
/* (it's an output parameter) */
int *dst_num, /* numbers of pixel in output line */
float alpha, /* relative position of camera */
int *first, /* first sequence of runs */
int *first_runs, /* it's length */
int *second, /* second sequence of runs */
int *second_runs, int *first_corr, /* correspond information for the 1st seq */
int *second_corr ) /* correspond information for the 2nd seq */
{
CvStatus error;
int currLine;
int currFirstPix = 0;
//int currFirstNum = 0;
int currSecondPix = 0;
//int currSecondNum = 0;
int currDstPix = 0;
int currFirst = 0;
//int currFirstRuns = 0;
int currSecond = 0;
//int currSecondRuns = 0;
int currFirstCorr = 0;
int currSecondCorr = 0;
if( lines < 1 ||
first_pix == 0 ||
first_num == 0 ||
second_pix == 0 ||
second_num == 0 ||
dst_pix == 0 ||
dst_num == 0 ||
alpha < 0 ||
alpha > 1 ||
first == 0 ||
first_runs == 0 ||
second == 0 || second_runs == 0 || first_corr == 0 || second_corr == 0 )
return CV_BADFACTOR_ERR;
for( currLine = 0; currLine < lines; currLine++ )
{
error = icvMorphEpilines8uC3( &(first_pix[currFirstPix]),
&(second_pix[currSecondPix]),
&(dst_pix[currDstPix]),
alpha,
&(first[currFirst]),
first_runs[currLine],
&(second[currSecond]),
second_runs[currLine],
&(first_corr[currFirstCorr]),
&(second_corr[currSecondCorr]), dst_num[currLine] * 3 );
if( error != CV_NO_ERR )
return CV_NO_ERR;
currFirstPix += first_num[currLine] * 3;
currSecondPix += second_num[currLine] * 3;
currDstPix += dst_num[currLine] * 3;
currFirst += (first_runs[currLine] * 2) + 1;
currSecond += (second_runs[currLine] * 2) + 1;
currFirstCorr += first_runs[currLine] * 2;
currSecondCorr += second_runs[currLine] * 2;
} /* for */
return CV_NO_ERR;
} /* icvMorphEpilines8uC3Multi */
/*======================================================================================*/
CV_IMPL void
cvMorphEpilinesMulti( int lines, /* number of lines */
uchar * first_pix, /* raster epilines from the first image */
int *first_num, /* numbers of pixel in first line */
uchar * second_pix, /* raster epilines from the second image */
int *second_num, /* numbers of pixel in second line */
uchar * dst_pix, /* raster epiline from the destination image */
/* (it's an output parameter) */
int *dst_num, /* numbers of pixel in output line */
float alpha, /* relative position of camera */
int *first, /* first sequence of runs */
int *first_runs, /* it's length */
int *second, /* second sequence of runs */
int *second_runs, int *first_corr, /* correspond information for the 1st seq */
int *second_corr /* correspond information for the 2nd seq */
)
{
CV_FUNCNAME( "cvMorphEpilinesMulti" );
__BEGIN__;
IPPI_CALL( icvMorphEpilines8uC3Multi( lines, /* number of lines */
first_pix, /* raster epilines from the first image */
first_num, /* numbers of pixel in first line */
second_pix, /* raster epilines from the second image */
second_num, /* numbers of pixel in second line */
dst_pix, /* raster epiline from the destination image */
/* (it's an output parameter) */
dst_num, /* numbers of pixel in output line */
alpha, /* relative position of camera */
first, /* first sequence of runs */
first_runs, /* it's length */
second, /* second sequence of runs */
second_runs, first_corr, /* correspond information for the 1st seq */
second_corr /* correspond information for the 2nd seq */
));
__END__;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?