opencv split中的内存

在opencv split中为生成的三个通道的数据生成了新的内存区域
测试代码如下

#include 
#include 
#include 
using namespace cv;
int main(int argc, char const *argv[]){
    Mat dilate_element = getStructuringElement(MORPH_ELLIPSE, Size(90, 100));  //0.01-2ms
    Mat in_img = imread("/home/y/ck_wp/mp_camera/src/armor_detect/res/test_armor.jpg");
    printf("%x\n",in_img.data);
    imshow("origin",in_img);
    waitKey(0);
    Mat cha[3];
    split(in_img,cha);
    imshow("cha1 origin",cha[0]);
    waitKey(0);
    printf("%x\n",cha[0].data);
    printf("%x\n",cha[1].data);
    printf("%x\n",cha[2].data); 
    dilate(cha[0], cha[0], dilate_element, Point(-1,-1), 1); //原值通道二值化后膨胀
    imshow("cha1 change",cha[0]);
    waitKey(0);
    imshow("origin img after change",in_img);
    waitKey(0);
}

你可能感兴趣的:(opencv split中的内存)