| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1769 人关注过本帖
标题:再牛的人也永远看不懂这段程序!
只看楼主 加入收藏
yinkai1205
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-5-28
结帖率:0
收藏
已结贴  问题点数:20 回复次数:13 
再牛的人也永远看不懂这段程序!
void computeF(IplImage* img,int* feature)
{
        uchar* imgdate;
        int height=train->height;
        int width=train->width;
        int indexadd=-1,index=0,begin=0;
        for (int h=0;h<height;h++)
        {
            imgdate=(uchar*)(img->imageData+h*train->widthStep);
            begin=0;
            for (int w=0;w<width;w++)
            {
                if (w!=width-1&&imgdate[3*w]==0&&imgdate[3*w+1]==0&&imgdate[3*w+2]==0&&imgdate[3*(w+1)]==255&&imgdate[3*(w+1)+1]==255&&imgdate[3*(w+1)+2]==255)    //黑白跳跃
                {
                    indexadd++;
                    if (w<width/3&&h<height/2)
                    {
                        if (indexadd>1)      //接触2次黑白跳跃
                        {
                            w=width/3-1;
                            begin=width/3;
                            indexadd=-1;
                            continue;
                        }
                        index=0+indexadd;
                        feature[index]+=w-begin+1;
                        begin=w+1;
                    }
                    else if (w<2*width/3&&h<height/2)
                    {
                        if (indexadd>1)      
                        {
                            w=2*width/3-1;
                            begin=2*width/3;
                            indexadd=-1;
                            continue;
                        }
                        index=2+indexadd;
                        feature[index]+=w-begin+1;
                        begin=w+1;
                    }
                    else if (w<width&&h<height/2)
                    {
                        if (indexadd>1)
                        {
                            indexadd=-1;
                            break;
                        }
                        index=4+indexadd;
                        feature[index]+=w-begin+1;
                        begin=w+1;
                    }
                    else if (w<width/3&&h<height)
                    {
                        if (indexadd>1)
                        {
                            w=width/3-1;
                            begin=width/3;
                            indexadd=-1;
                            continue;
                        }
                        index=6+indexadd;
                        feature[index]+=w-begin+1;
                        begin=w+1;
                    }
                    else if (w<2*width/3&&h<height)
                    {
                        if (indexadd>1)      
                        {
                            w=2*width/3-1;
                            begin=2*width/3;
                            indexadd=-1;
                            continue;
                        }
                        index=8+indexadd;
                        feature[index]+=w-begin+1;
                        begin=w+1;
                    }
                    else if (w<width&&h<height)
                    {
                        if (indexadd>1)
                        {
                            indexadd=-1;
                            break;
                        }
                        index=10+indexadd;
                        feature[index]+=w-begin+1;
                        begin=w+1;
                    }

                    if (w==width/3-1)
                    {
                        if (h<height/2)
                        {
                            if (indexadd==0)
                            {
                                indexadd=1;
                            }
                            if (indexadd==-1)
                            {
                                indexadd=0;
                            }
                            index=0+indexadd;
                            feature[index]+=w-begin+1;
                            begin=w+1;
                        }
                        else  if (h<height)
                        {
                            if (indexadd==0)
                            {
                                indexadd=1;
                            }
                            if (indexadd==-1)
                            {
                                indexadd=0;
                            }
                            index=6+indexadd;
                            feature[index]+=w-begin+1;
                            begin=w+1;
                        }
                    }

                    if (w==2*width/3-1)
                    {
                        if (h<height/2)
                        {
                            if (indexadd==0)
                            {
                                indexadd=1;
                            }
                            if (indexadd==-1)
                            {
                                indexadd=0;
                            }
                            index=2+indexadd;
                            feature[index]+=w-begin+1;
                            begin=w+1;
                        }
                        else  if (h<height)
                        {
                            if (indexadd==0)
                            {
                                indexadd=1;
                            }
                            if (indexadd==-1)
                            {
                                indexadd=0;
                            }
                            index=8+indexadd;
                            feature[index]+=w-begin+1;
                            begin=w+1;
                        }
                    }

                    if (w==width-1)
                    {
                        if (h<height/2)
                        {
                            if (indexadd==0)
                            {
                                indexadd=1;
                            }
                            if (indexadd==-1)
                            {
                                indexadd=0;
                            }
                            index=4+indexadd;
                            feature[index]+=w-begin+1;
                        }
                        else  if (h<height)
                        {
                            if (indexadd==0)
                            {
                                indexadd=1;
                            }
                            if (indexadd==-1)
                            {
                                indexadd=0;
                            }
                            index=10+indexadd;
                            feature[index]+=w-begin+1;
                        }
                    }
                }
            }
        }
}

搜索更多相关主题的帖子: train 
2010-05-28 21:41
Zale_YT
Rank: 2
等 级:论坛游民
帖 子:22
专家分:15
注 册:2010-5-27
收藏
得分:1 
2010-05-28 22:18
vs_inzaghi
Rank: 5Rank: 5
来 自:湖北
等 级:职业侠客
威 望:1
帖 子:303
专家分:364
注 册:2009-8-17
收藏
得分:1 
看了这个帖子,我才发现自己C白学了……

我很懒,但我讨厌别人说我懒……
2010-05-28 23:18
zhujianiu
Rank: 4
等 级:业余侠客
帖 子:126
专家分:244
注 册:2010-5-14
收藏
得分:1 
搞了个算法放这里是干嘛呢?
2010-05-28 23:45
dydsdyds
Rank: 6Rank: 6
来 自:Java
等 级:侠之大者
帖 子:217
专家分:457
注 册:2010-2-14
收藏
得分:1 
我也觉得c白学了……

c语言刚开一学期,就换开VB...
2010-05-30 21:16
ykenny
Rank: 1
等 级:新手上路
帖 子:2
专家分:2
注 册:2009-4-15
收藏
得分:1 
你没加注释谁知道什么意思嘛
2010-05-31 20:45
ioriliao
Rank: 7Rank: 7Rank: 7
来 自:广东
等 级:贵宾
威 望:32
帖 子:2829
专家分:647
注 册:2006-11-30
收藏
得分:1 
看不懂得

/images/2011/147787/2011051411021524.jpg" border="0" />
2010-05-31 20:54
flycatorg
Rank: 1
等 级:新手上路
帖 子:2
专家分:7
注 册:2007-12-2
收藏
得分:1 
有意思吗?
2010-06-01 10:54
姚杰
Rank: 6Rank: 6
等 级:侠之大者
威 望:1
帖 子:169
专家分:477
注 册:2010-6-1
收藏
得分:1 

持之以恒,别留遗憾,加油
2010-06-01 21:42
s58417632
Rank: 2
等 级:论坛游民
帖 子:17
专家分:11
注 册:2010-5-28
收藏
得分:1 
这段代码少东西.....结构体都没写出来,当然看不明白
2010-06-01 21:43
快速回复:再牛的人也永远看不懂这段程序!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020353 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved