OpenCV rowRange()函数使用

关于rowRange()和colRange()函数,很多都是转载一个3x3矩阵的例子来说事,让初学者云里雾里,有的甚至用行列扫描的方式输出显示,更增加了云里雾里~-~
运行结果:

#include <opencv2/opencv.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main(int argc, char** argv) {
    cout << "OpenCV rowRang() Test!" << endl << endl;
    //定义病初始化5x5矩阵
    Mat Martrix55 = (Mat_<int>(5, 5) << 1,2,3,4,5, 
                                  11,12,13,14,15,
                                  21,22,23,24,25,
                                  31,32,33,34,35,
                                  41,42,43,44,45);


    cout << "Martrix55 = " << endl << Martrix55 << endl << endl;

    Mat mchunk1 = Martrix55.rowRange(0,1);
    cout << "mchunk1 = Martrix55.rowRange(0,1)" << endl << "mchunk1 = " << endl << mchunk1 << endl << endl;

    Mat mchunk2 = Martrix55.rowRange(0, 2);
    cout << "mchunk2 = Martrix55.rowRange(0, 2)" << endl << "mchunk2 = " << endl << mchunk2 << endl << endl;

    Mat mchunk3 = Martrix55.rowRange(0, 3);
    cout << "mchunk3 = Martrix55.rowRange(0, 3)" << endl << "mchunk3 = " << endl << mchunk3 << endl << endl;

    Mat mchunk4 = Martrix55.rowRange(3, 5);
    cout << "mchunk4 = Martrix55.rowRange(3, 5)" << endl << "mchunk4 = " << endl << mchunk4 << endl << endl;

    Mat mchunk5 = Martrix55.rowRange(3, 4);
    cout << "mchunk5 = Martrix55.rowRange(3, 4)" << endl << "mchunk5 = " << endl << mchunk5 << endl << endl;

    Mat mchunk6 = Martrix55.rowRange(3, 3);
    cout << "mchunk6 = Martrix55.rowRange(3, 3)" << endl << "mchunk6 = " << endl << mchunk6 << endl << endl;

    system("pause");

    return 0;
}

colRange()一个道理

这么例子能讲清楚吗?

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值