"OpenCV, C + +" implements down-grating tracking to detect edges

Source: Internet
Author: User

The design functions are as follows:

which

void int int low);

In the parameter list, the first entry is the grayscale image to be traced, and the second is the output image.

The third high is the detection threshold, and the fourth low is the tracking threshold value.

voidGratingdetect (Mat &graysrc, Mat &graydst,intHighintLow ) {    intRowNum =graysrc.rows; intColnum =Graysrc.cols;  for(inti =0; i < RowNum; i++) {Uchar* D_data = graydst.ptr<uchar>(i); Uchar* S_data = graysrc.ptr<uchar>(i);  for(intj =0; J < Colnum; J + +)        {            if(S_data[j] >=High ) {D_data[j]=255; inttemp =S_data[j]; if(I < rowNum-1) {D_data= graydst.ptr<uchar> (i +1); S_data= graysrc.ptr<uchar> (i +1); if(J >0&& J < Colnum-1)                    {                         for(intK =-1; K <2; k++)                        {                            if(ABS (Temp-s_data[j + K]) <=Low ) D_data[j+ K] =255; Elsed_data[j+ K] =0; }} d_data= graydst.ptr<uchar>(i); S_data= graysrc.ptr<uchar>(i); }            }            ElseD_data[j]=0; }    }}

"OpenCV, C + +" implements down-grating tracking to detect edges

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.