亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? cvdominants.cpp

?? opencv庫(kù)在TI DM6437上的移植,目前包括兩個(gè)庫(kù)cv.lib和cxcore.lib的工程
?? CPP
字號(hào):
/*M///////////////////////////////////////////////////////////////////////////////////////
//
//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
//  By downloading, copying, installing or using the software you agree to this license.
//  If you do not agree to this license, do not download, install,
//  copy or use the software.
//
//
//                        Intel License Agreement
//                For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
//   * Redistribution's of source code must retain the above copyright notice,
//     this list of conditions and the following disclaimer.
//
//   * Redistribution's in binary form must reproduce the above copyright notice,
//     this list of conditions and the following disclaimer in the documentation
//     and/or other materials provided with the distribution.
//
//   * The name of Intel Corporation may not be used to endorse or promote products
//     derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "_cv.h"

typedef struct _PointInfo
{
    CvPoint pt;
    int left_neigh;
    int right_neigh;

}
icvPointInfo;


static CvStatus
icvFindDominantPointsIPAN( CvSeq * contour,
                           CvMemStorage * storage,
                           CvSeq ** corners, int dmin2, int dmax2, int dneigh2, float amax )
{
    CvStatus status = CV_OK;

    /* variables */
    int n = contour->total;

    float *sharpness;
    float *distance;
    icvPointInfo *ptInf;

    int i, j, k;

    CvSeqWriter writer;

    float mincos = (float) cos( 3.14159265359 * amax / 180 );

    /* check bad arguments */
    if( contour == NULL )
        return CV_NULLPTR_ERR;
    if( storage == NULL )
        return CV_NULLPTR_ERR;
    if( corners == NULL )
        return CV_NULLPTR_ERR;
    if( dmin2 < 0 )
        return CV_BADSIZE_ERR;
    if( dmax2 < dmin2 )
        return CV_BADSIZE_ERR;
    if( (dneigh2 > dmax2) || (dneigh2 < 0) )
        return CV_BADSIZE_ERR;
    if( (amax < 0) || (amax > 180) )
        return CV_BADSIZE_ERR;

    sharpness = (float *) cvAlloc( n * sizeof( float ));
    distance = (float *) cvAlloc( n * sizeof( float ));

    ptInf = (icvPointInfo *) cvAlloc( n * sizeof( icvPointInfo ));

/*****************************************************************************************/
/*                                 First pass                                            */
/*****************************************************************************************/

    if( CV_IS_SEQ_CHAIN_CONTOUR( contour ))
    {
        CvChainPtReader reader;

        cvStartReadChainPoints( (CvChain *) contour, &reader );

        for( i = 0; i < n; i++ )
        {
            CV_READ_CHAIN_POINT( ptInf[i].pt, reader );
        }
    }
    else if( CV_IS_SEQ_POLYGON( contour ))
    {
        CvSeqReader reader;

        cvStartReadSeq( contour, &reader, 0 );

        for( i = 0; i < n; i++ )
        {
            CV_READ_SEQ_ELEM( ptInf[i].pt, reader );
        }
    }
    else
    {
        return CV_BADFLAG_ERR;
    }

    for( i = 0; i < n; i++ )
    {
        /* find nearest suitable points
           which satisfy distance constraint >dmin */
        int left_near = 0;
        int right_near = 0;
        int left_far, right_far;

        float dist_l = 0;
        float dist_r = 0;

        int i_plus = 0;
        int i_minus = 0;

        float max_cos_alpha;

        /* find  right minimum */
        while( dist_r < dmin2 )
        {
            float dx, dy;
            int ind;

            if( i_plus >= n )
                goto error;

            right_near = i_plus;

            if( dist_r < dneigh2 )
                ptInf[i].right_neigh = i_plus;

            i_plus++;

            ind = (i + i_plus) % n;
            dx = (float) (ptInf[i].pt.x - ptInf[ind].pt.x);
            dy = (float) (ptInf[i].pt.y - ptInf[ind].pt.y);
            dist_r = dx * dx + dy * dy;
        }
        /* find right maximum */
        while( dist_r <= dmax2 )
        {
            float dx, dy;
            int ind;

            if( i_plus >= n )
                goto error;

            distance[(i + i_plus) % n] = cvSqrt( dist_r );

            if( dist_r < dneigh2 )
                ptInf[i].right_neigh = i_plus;

            i_plus++;

            right_far = i_plus;

            ind = (i + i_plus) % n;

            dx = (float) (ptInf[i].pt.x - ptInf[ind].pt.x);
            dy = (float) (ptInf[i].pt.y - ptInf[ind].pt.y);
            dist_r = dx * dx + dy * dy;
        }
        right_far = i_plus;

        /* left minimum */
        while( dist_l < dmin2 )
        {
            float dx, dy;
            int ind;

            if( i_minus <= -n )
                goto error;

            left_near = i_minus;

            if( dist_l < dneigh2 )
                ptInf[i].left_neigh = i_minus;

            i_minus--;

            ind = i + i_minus;
            ind = (ind < 0) ? (n + ind) : ind;

            dx = (float) (ptInf[i].pt.x - ptInf[ind].pt.x);
            dy = (float) (ptInf[i].pt.y - ptInf[ind].pt.y);
            dist_l = dx * dx + dy * dy;
        }

        /* find left maximum */
        while( dist_l <= dmax2 )
        {
            float dx, dy;
            int ind;

            if( i_minus <= -n )
                goto error;

            ind = i + i_minus;
            ind = (ind < 0) ? (n + ind) : ind;

            distance[ind] = cvSqrt( dist_l );

            if( dist_l < dneigh2 )
                ptInf[i].left_neigh = i_minus;

            i_minus--;

            left_far = i_minus;

            ind = i + i_minus;
            ind = (ind < 0) ? (n + ind) : ind;

            dx = (float) (ptInf[i].pt.x - ptInf[ind].pt.x);
            dy = (float) (ptInf[i].pt.y - ptInf[ind].pt.y);
            dist_l = dx * dx + dy * dy;
        }
        left_far = i_minus;

        if( (i_plus - i_minus) > n + 2 )
            goto error;

        max_cos_alpha = -1;
        for( j = left_far + 1; j < left_near; j++ )
        {
            float dx, dy;
            float a, a2;
            int leftind = i + j;

            leftind = (leftind < 0) ? (n + leftind) : leftind;

            a = distance[leftind];
            a2 = a * a;

            for( k = right_near + 1; k < right_far; k++ )
            {
                int ind = (i + k) % n;
                float c2, cosalpha;
                float b = distance[ind];
                float b2 = b * b;

                /* compute cosinus */
                dx = (float) (ptInf[leftind].pt.x - ptInf[ind].pt.x);
                dy = (float) (ptInf[leftind].pt.y - ptInf[ind].pt.y);

                c2 = dx * dx + dy * dy;
                cosalpha = (a2 + b2 - c2) / (2 * a * b);

                max_cos_alpha = MAX( max_cos_alpha, cosalpha );

                if( max_cos_alpha < mincos )
                    max_cos_alpha = -1;

                sharpness[i] = max_cos_alpha;
            }
        }
    }
/*****************************************************************************************/
/*                                 Second pass                                           */
/*****************************************************************************************/

    cvStartWriteSeq( (contour->flags & ~CV_SEQ_ELTYPE_MASK) | CV_SEQ_ELTYPE_INDEX,
                     sizeof( CvSeq ), sizeof( int ), storage, &writer );

    /* second pass - nonmaxima suppression */
    /* neighborhood of point < dneigh2 */
    for( i = 0; i < n; i++ )
    {
        int suppressed = 0;
        if( sharpness[i] == -1 )
            continue;

        for( j = 1; (j <= ptInf[i].right_neigh) && (suppressed == 0); j++ )
        {
            if( sharpness[i] < sharpness[(i + j) % n] )
                suppressed = 1;
        }

        for( j = -1; (j >= ptInf[i].left_neigh) && (suppressed == 0); j-- )
        {
            int ind = i + j;

            ind = (ind < 0) ? (n + ind) : ind;
            if( sharpness[i] < sharpness[ind] )
                suppressed = 1;
        }

        if( !suppressed )
            CV_WRITE_SEQ_ELEM( i, writer );
    }

    *corners = cvEndWriteSeq( &writer );

    cvFree( &sharpness );
    cvFree( &distance );
    cvFree( &ptInf );

    return status;

  error:
    /* dmax is so big (more than contour diameter)
       that algorithm could become infinite cycle */
    cvFree( &sharpness );
    cvFree( &distance );
    cvFree( &ptInf );

    return CV_BADRANGE_ERR;
}


/*F///////////////////////////////////////////////////////////////////////////////////////
//    Name: icvFindDominantPoints
//    Purpose:
//      Applies some algorithm to find dominant points ( corners ) of contour
//     
//    Context:
//    Parameters:
//      contours - pointer to input contour object.
//      out_numbers - array of dominant points indices
//      count - length of out_numbers array on input
//              and numbers of founded dominant points on output   
//                  
//      method - only CV_DOMINANT_IPAN now
//      parameters - array of parameters
//                   for IPAN algorithm
//                   [0] - minimal distance
//                   [1] - maximal distance
//                   [2] - neighborhood distance (must be not greater than dmaximal distance)
//                   [3] - maximal possible angle of curvature
//    Returns:
//      CV_OK or error code
//    Notes:
//      User must allocate out_numbers array. If it is small - function fills array 
//      with part of points and returns  error
//F*/
CV_IMPL CvSeq*
cvFindDominantPoints( CvSeq * contour, CvMemStorage * storage, int method,
                      double parameter1, double parameter2, double parameter3, double parameter4 )
{
    CvSeq* corners = 0;

    CV_FUNCNAME( "cvFindDominantPoints" );
    __BEGIN__;

    if( !contour )
        CV_ERROR( CV_StsNullPtr, "" );

    if( !storage )
        storage = contour->storage;

    if( !storage )
        CV_ERROR( CV_StsNullPtr, "" );

    switch (method)
    {
    case CV_DOMINANT_IPAN:
        {
            int dmin = cvRound(parameter1);
            int dmax = cvRound(parameter2);
            int dneigh = cvRound(parameter3);
            int amax = cvRound(parameter4);

            if( amax == 0 )
                amax = 150;
            if( dmin == 0 )
                dmin = 7;
            if( dmax == 0 )
                dmax = dmin + 2;
            if( dneigh == 0 )
                dneigh = dmin;

            IPPI_CALL( icvFindDominantPointsIPAN( contour, storage, &corners,
                                                  dmin*dmin, dmax*dmax, dneigh*dneigh, (float)amax ));
        }
        break;
    default:
        CV_ERROR_FROM_STATUS( CV_BADFLAG_ERR );
    }

    __END__;

    return corners;
}

/* End of file. */

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产在线不卡一区| 欧美第一区第二区| 色婷婷综合中文久久一本| 在线国产亚洲欧美| 制服丝袜av成人在线看| 亚洲国产高清aⅴ视频| 国产精品嫩草影院com| 成人国产精品免费| 91蜜桃传媒精品久久久一区二区| 色88888久久久久久影院野外| 欧美日韩亚洲综合在线| 亚洲欧美精品午睡沙发| 亚洲精选免费视频| 极品尤物av久久免费看| av电影在线不卡| 久久久精品免费网站| 日韩精品1区2区3区| 欧美巨大另类极品videosbest | 日韩福利电影在线| 久久精品国产99久久6| 丰满亚洲少妇av| 国产一区二区三区黄视频| 欧美日韩一区二区在线观看视频| 日韩精品乱码av一区二区| 日韩欧美一级片| 5858s免费视频成人| k8久久久一区二区三区 | 久久新电视剧免费观看| 欧美三级午夜理伦三级中视频| 99亚偷拍自图区亚洲| 国产成人亚洲综合a∨婷婷| 久久99精品久久久久久久久久久久| 亚洲小少妇裸体bbw| 亚洲午夜激情网页| 一区二区三区高清| 亚洲资源中文字幕| 亚洲第一会所有码转帖| 一区二区三区日韩欧美| 伊人夜夜躁av伊人久久| 亚洲狼人国产精品| 亚洲精品老司机| 亚洲午夜在线观看视频在线| 亚洲一区av在线| 午夜不卡av在线| 日韩二区三区四区| 蜜臀久久99精品久久久画质超高清 | 91毛片在线观看| 色综合久久天天| 色偷偷一区二区三区| 在线欧美日韩精品| 欧美日韩国产精品成人| 欧美一区二区精品在线| 日韩色视频在线观看| 精品99一区二区| 国产亚洲综合在线| ...xxx性欧美| 亚洲一级二级三级| 免费高清在线一区| 国产精品一二三区在线| 99热99精品| 欧美色国产精品| 日韩一区二区在线观看视频| www久久久久| 国产精品久久久爽爽爽麻豆色哟哟| 亚洲欧美视频在线观看视频| 成人午夜在线免费| 亚洲欧洲日本在线| 国产mv日韩mv欧美| 欧美大片顶级少妇| 国产精品电影一区二区三区| 国产精品乱人伦| 国产精品国产a级| 亚洲猫色日本管| 日韩av一区二区在线影视| 国产精品久久久久婷婷| 国产日韩三级在线| 亚洲人123区| 亚洲一区精品在线| 蜜桃视频在线观看一区二区| 国产精品一区二区三区乱码| aaa亚洲精品| 欧美一级一区二区| 国产精品免费久久| 日本欧美一区二区三区乱码| 国产另类ts人妖一区二区| 在线一区二区三区做爰视频网站| 欧美一区二区三区视频免费 | 中文字幕一区二区视频| 亚洲成av人片在线观看无码| 国产乱子伦视频一区二区三区| 色狠狠一区二区三区香蕉| 精品日产卡一卡二卡麻豆| 亚洲精品乱码久久久久久日本蜜臀| 美女脱光内衣内裤视频久久网站| 成人h动漫精品| 欧美成人猛片aaaaaaa| 国产精品网站一区| 久久福利资源站| 欧美亚洲动漫精品| 国产精品日韩成人| 久久99深爱久久99精品| 欧美在线免费观看亚洲| 国产精品色哟哟网站| 看电视剧不卡顿的网站| 色综合视频在线观看| 久久人人97超碰com| 奇米777欧美一区二区| 在线精品视频免费观看| 亚洲图片激情小说| 国产成人综合自拍| 欧美r级在线观看| 午夜天堂影视香蕉久久| 色综合婷婷久久| 日本一区二区三区高清不卡| 老司机免费视频一区二区| 欧美三级电影在线看| 亚洲日本欧美天堂| www.视频一区| 欧美国产乱子伦| 国产经典欧美精品| 精品成人免费观看| 麻豆精品一二三| 欧美一区二区三区四区五区 | 亚洲欧美另类久久久精品2019| 成人自拍视频在线观看| 久久精品日产第一区二区三区高清版| 奇米精品一区二区三区四区| 911精品产国品一二三产区| 亚洲午夜激情av| 欧美三级中文字幕| 亚洲成av人影院| 91精品免费在线| 亚洲第一电影网| 欧美人体做爰大胆视频| 性欧美疯狂xxxxbbbb| 91精品国产一区二区三区蜜臀| 婷婷综合另类小说色区| 欧美乱妇23p| 日本三级韩国三级欧美三级| 777午夜精品视频在线播放| 日韩国产成人精品| 欧美一级二级在线观看| 七七婷婷婷婷精品国产| 精品国产三级a在线观看| 国内成人免费视频| 中文字幕精品一区二区三区精品| 丁香五精品蜜臀久久久久99网站| 国产精品视频你懂的| 91伊人久久大香线蕉| 亚洲在线免费播放| 在线成人免费视频| 久久www免费人成看片高清| 久久综合久久99| 成人免费高清在线| 亚洲免费观看在线视频| 欧美性受极品xxxx喷水| 午夜精品久久久久久久99水蜜桃| 91精品国产综合久久福利| 国产毛片一区二区| 中文字幕制服丝袜一区二区三区| 91女厕偷拍女厕偷拍高清| 亚洲国产视频直播| 欧美电影免费观看完整版| 国产精品18久久久久| 中文字幕亚洲在| 欧美日本免费一区二区三区| 日韩精品一区第一页| 精品国产91亚洲一区二区三区婷婷 | 夫妻av一区二区| 一区二区三区中文字幕电影| 欧美日韩日日夜夜| 激情综合网激情| 亚洲日本丝袜连裤袜办公室| 欧美精品久久一区二区三区| 国产福利电影一区二区三区| 一区二区三区免费网站| 日韩一区二区免费视频| 成人综合日日夜夜| 日韩高清国产一区在线| 国产人伦精品一区二区| 欧美视频精品在线| 国产黑丝在线一区二区三区| 一区二区三区在线视频免费| 日韩美一区二区三区| 99国产精品国产精品久久| 日韩电影在线看| 综合分类小说区另类春色亚洲小说欧美 | 日本一区二区综合亚洲| 欧美亚洲免费在线一区| 国产精品中文欧美| 亚洲国产精品久久久久婷婷884| 久久综合九色综合97婷婷女人| 色婷婷av一区二区三区软件| 久久99久久精品欧美| 亚洲黄色小视频| 国产午夜亚洲精品羞羞网站| 欧美日韩视频在线一区二区| 北条麻妃国产九九精品视频| 男人操女人的视频在线观看欧美| 亚洲视频狠狠干|