精华内容
下载资源
问答
  • Opencv 图像深度+转换深度

    万次阅读 2018-08-06 17:09:51
    1. opencv 图像深度 图像深度是指存储每个像素所用的位数,也用于量度图像的色彩分辨率.图像深度确定彩色图像的每个像素可能有的颜色数,或者确定灰度图像的每个像素可能有的灰度级数.它决定了彩色图像中可出现的最多...

    1. opencv 图像深度

    图像深度是指存储每个像素所用的位数,也用于量度图像的色彩分辨率.图像深度确定彩色图像的每个像素可能有的颜色数,或者确定灰度图像的每个像素可能有的灰度级数.它决定了彩色图像中可出现的最多颜色数,或灰度图像中的最大灰度等级.比如一幅单色图像,若每个象素有8位,则最大灰度数目为2的8次方,即256.一幅彩色图像RGB3个分量的象素位数分别为4,4,2,则最大颜色数目为2的4+4+2次方,即1024,就是说像素的深度为10位,每个像素可以是1024种颜色中的一种.

     

    opencv 深度显示范围:(也就是说当定义了如下不同深度的时候,像素的灰度值要处于显示范围之中才可以显示出来。否则要进行转换)

         测试double型:0.0--1.0之间                              IPL_DEPTH_64F

          测试float型:0.0--1.0之间                                  IPL_DEPTH_32F

          测试long型:0--65535之间                                IPL_DEPTH_32S        

          测试short int型:-32768--32767之间                 IPL_DEPTH_16S        

          测试unsigned short int型:0--65535之间           IPL_DEPTH_16U

          测试char型:-128--127之间                               IPL_DEPTH_8S          

          测试unsigned char型:0--255之间                     IPL_DEPTH_8U

    2. Opencv convertScaleAbs函数

    在将RealSense提取的深度图片进行显示时,由于是16位图片,想将图片转化成为8位图形进行显示
    Opencv中有一个函数convertScaleAbs可以实现这种功能
    C++: void convertScaleAbs(InputArray src, OutputArray dst, double alpha=1, double beta=0)
    Parameters:
    src: input array
    dst: output array
    alpha: optional scale factor
    beta: optional delta added to the scaled values
    the governmental definition for the function is :
    On each element of the input array, the function covertScaleAbs performs three operations sequentially: scaling, taking an absolute value, conversion to an unsigned 8-bit type:
    这里写图片描述

    简而言之就是将一个16位的图转换成8位。

     

    展开全文
  • depth:深度,即每一个像素的位数(bits),那么我们创建的时候就可以知道根据类型也就可以知道每个像素的位数,也就是知道了创建mat的深度 图像深度的意义: 图像深度是指存储每个像素所用的位数,也用于量度图像的...

    我们在创建mat的时候,可以选择的CvType中有很多的选项

    CV_8UC1           CV_8SC1           CV_16U C1       CV_16SC1 
    CV_8UC2           CV_8SC2           CV_16UC2        CV_16SC2 
    CV_8UC3           CV_8SC3           CV_16UC3        CV_16SC3 
    CV_8UC4           CV_8SC4           CV_16UC4        CV_16SC4 
    CV_32SC1          CV_32FC1          CV_64FC1
    CV_32SC2          CV_32FC2          CV_64FC2
    CV_32SC3          CV_32FC3          CV_64FC3
    CV_32SC4          CV_32FC4          CV_64FC4

    其实组成都是CV_+深度+通道 其中里面的数字8 ,16,32 标识的是深度

    什么是一个Mat的深度,mat的深度有什么意义

    CV_8U is unsigned 8bit/pixel - ie a pixel can have values 0-255, this is the normal range for most image and video formats.

    CV_32F is float - the pixel can have any value between 0-1.0, this is useful for some sets of calculations on data - but it has to be converted into 8bits to save or display by multiplying each pixel by 255.

    CV_32S is a signed 32bit integer value for each pixel - again useful of you are doing integer maths on the pixels, but again needs converting into 8bits to save or display. This is trickier since you need to decide how to convert the much larger range of possible values (+/- 2billion!) into 0-255

     

    大概的意思是说:

    CV_8U是无符号8位/像素-即一个像素可以有0-255的值,这是大多数图像和视频格式的正常范围。

    CV_32F是float-像素可以有0-1.0之间的任何值,这对于某些数据集的计算很有用-但必须将其转换为8位才能通过将每个像素乘以255来保存或显示。

    CV_32S是每个像素的一个有符号32位整数值-同样有用的是,您正在对像素进行整数运算,但同样需要转换为8位才能保存或显示。因为您需要决定如何转换更大范围的可能值(+/-20亿!)变成0-255

    其实在mat的属性中有个depth()这个函数,我以为这个求解的就是图片的深度,但是并不是,所以我们千万不能用这个depth()的值作为图片的 深度来理解,这个depth() 是我们在定义mat的时候CV_Type对应的值

    CV_8U   0
    CV_8S   1
    CV_16U  2
    CV_16S  3
    CV_32S  4
    CV_32F  5
    CV_64F  6
    CV_USRTYPE1 7

    这些值和图片的深度还有一定的关联的,比如:

    depth:深度,即每一个像素的位数(bits),在opencv的Mat.depth()中得到的是一个 0 – 6 的数字,分别代表不同的位数:enum { CV_8U=0, CV_8S=1, CV_16U=2, CV_16S=3, CV_32S=4, CV_32F=5, CV_64F=6 }; 可见 0和1都代表8位, 2和3都代表16位,4和5代表32位,6代表64位;

    depth:深度,即每一个像素的位数(bits),那么我们创建的时候就可以知道根据类型也就可以知道每个像素的位数,也就是知道了创建mat的深度

    图像深度的意义:

       图像深度是指存储每个像素所用的位数,也用于量度图像的色彩分辨率.图像深度确定彩色图像的每个像素可能有的颜色数,或者确定灰度图像的每个像素可能有的灰度级数.

      它决定了彩色图像中可出现的最多颜色数,或灰度图像中的最大灰度等级.比如一幅单色图像,若每个象素有8位,则最大灰度数目为2的8次方,即256.

    在学习的过程中突然遇到图片的深度,上面是我的理解

    不同的深度之间如何进行转换,我们以8UC3 转换为32FC3为例子

    public static void main(String[] args) {
    		try {
    			ResourceBundle bundle = ResourceBundle.getBundle("opencv");
    			String opencvDllName = bundle.getString("opencv.dllpath");
    			System.load(opencvDllName);
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    		String filename = "D:\\360MoveData\\Users\\lxn\\Desktop\\opencv\\xf.bmp";
    		Mat mat = Imgcodecs.imread(filename);//首先是读取图片,默认是是CV_8UC2
    		Mat submat = mat.submat(10, 200, 10, 200);  //为了方便展示我们,截取图片的一部分内容
    		
    		
    		
    		Mat mat_32F = new Mat(submat.size(), CvType.CV_32FC3);//创建一个32FC3的矩阵
    		
    		
    		//将8UC3转换为32FC3
    		for (int i = 0; i < submat.rows(); i++) {
    			for (int j = 0; j < submat.cols(); j++) {
    				double[] values = new double[] {};
    				values = submat.get(i, j);
    				mat_32F.put(i, j, new double[] { values[0] / 255.0, values[1] / 255.0,values[2] / 255.0 });
    			}
    		}
    
    		
    		//将32FC3 转换为32SC3
    		Mat mat_32S = new Mat(submat.size(), CvType.CV_32SC3);
    		mat_32F.convertTo(mat_32S,  CvType.CV_32SC3);
    		
    		
    		
    		
    		//将32FC3 转换为CV_8UC3
    		for (int i = 0; i < mat_32S.rows(); i++) {
    			for (int j = 0; j < mat_32S.cols(); j++) {
    				double[] values = new double[] {};
    				values = mat_32F.get(i, j);
    				mat_32S.put(i, j,new int[] { (int) (values[0] * 255.0), (int) (values[1] * 255.0), (int) (values[2] * 255.0) });
    			}
    		}
    		Mat mat_s = new Mat();
    		mat_32S.convertTo(mat_s, CvType.CV_8UC3);
    
    		
    		HighGui.imshow("测试", mat_s);
    		HighGui.waitKey();
    
    	}

    covertTo 这个方法是实现了不同mat之间的类型转换,但是里面的具体的数值还是需要我们*255,或者/255 进行手动的转换

    希望对你有所帮助

     

    展开全文
  • opencv图像深度显示

    千次阅读 2018-11-02 09:17:08
    通过SFM重建后的三维点,想把它的深度图显示出来 原来是 double minVal,maxVal; minMaxLoc(depths, &minVal, &maxVal); Mat tmp(768,1024,CV_8UC3,Scalar(0,0,0)); for (unsigned int i=0; i<point...

    通过SFM重建后的三维点,想把它的深度图显示出来

    原来是

    double minVal,maxVal;
    minMaxLoc(depths, &minVal, &maxVal);
    Mat tmp(768,1024,CV_8UC3,Scalar(0,0,0)); 
    for (unsigned int i=0; i<pointcloud.size(); i++)
    {
        double _d = MAX(MIN((pointcloud[i].pt.z-minVal)/(maxVal-minVal),1.0),0.0);
        circle(tmp, correspImg1Pt[i].pt, 1, Scalar(255*(1-_d), (255), (255)), CV_FILLED);
    }
    cvtColor(tmp, tmp, CV_HSV2BGR);

    我发现有点问题,按照HSV理论大致应该是 红橙黄绿青蓝紫

    我测试了一下:

    	Mat image1(500, 500, CV_8UC3, Scalar(0, 0, 0));
    	for (int kf = 0; kf < image1.rows; kf++)
    	{
    
    			for (int j = 0; j < image1.cols; j++)
    			{
    				float a = 255 * (kf / 500.00);
    				image1.at<Vec3b>(kf, j)[0] = 255 * (kf / 500.00);
    				image1.at<Vec3b>(kf, j)[1] = 255;
    				image1.at<Vec3b>(kf, j)[2] = 255;
    			}
    
    	}
    
    	cvtColor(image1, image1, CV_HSV2BGR);
    	imshow("Depth Map1", image1);

    系数从0到1,发现会有颜色会有回转

    这个感觉无法做到表示深度

    后来就想jet表示深度,不用HSV模型

    写了一个代码

    	Mat pts(256, 1, CV_32FC3);
    	float r[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.00588235294117645f, 0.02156862745098032f, 0.03725490196078418f, 0.05294117647058827f, 0.06862745098039214f, 0.084313725490196f, 0.1000000000000001f, 0.115686274509804f, 0.1313725490196078f, 0.1470588235294117f, 0.1627450980392156f, 0.1784313725490196f, 0.1941176470588235f, 0.2098039215686274f, 0.2254901960784315f, 0.2411764705882353f, 0.2568627450980392f, 0.2725490196078431f, 0.2882352941176469f, 0.303921568627451f, 0.3196078431372549f, 0.3352941176470587f, 0.3509803921568628f, 0.3666666666666667f, 0.3823529411764706f, 0.3980392156862744f, 0.4137254901960783f, 0.4294117647058824f, 0.4450980392156862f, 0.4607843137254901f, 0.4764705882352942f, 0.4921568627450981f, 0.5078431372549019f, 0.5235294117647058f, 0.5392156862745097f, 0.5549019607843135f, 0.5705882352941174f, 0.5862745098039217f, 0.6019607843137256f, 0.6176470588235294f, 0.6333333333333333f, 0.6490196078431372f, 0.664705882352941f, 0.6803921568627449f, 0.6960784313725492f, 0.7117647058823531f, 0.7274509803921569f, 0.7431372549019608f, 0.7588235294117647f, 0.7745098039215685f, 0.7901960784313724f, 0.8058823529411763f, 0.8215686274509801f, 0.8372549019607844f, 0.8529411764705883f, 0.8686274509803922f, 0.884313725490196f, 0.8999999999999999f, 0.9156862745098038f, 0.9313725490196076f, 0.947058823529412f, 0.9627450980392158f, 0.9784313725490197f, 0.9941176470588236f, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9862745098039216f, 0.9705882352941178f, 0.9549019607843139f, 0.93921568627451f, 0.9235294117647062f, 0.9078431372549018f, 0.892156862745098f, 0.8764705882352941f, 0.8607843137254902f, 0.8450980392156864f, 0.8294117647058825f, 0.8137254901960786f, 0.7980392156862743f, 0.7823529411764705f, 0.7666666666666666f, 0.7509803921568627f, 0.7352941176470589f, 0.719607843137255f, 0.7039215686274511f, 0.6882352941176473f, 0.6725490196078434f, 0.6568627450980391f, 0.6411764705882352f, 0.6254901960784314f, 0.6098039215686275f, 0.5941176470588236f, 0.5784313725490198f, 0.5627450980392159f, 0.5470588235294116f, 0.5313725490196077f, 0.5156862745098039f, 0.5f };
    
    
    
    	float g[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.001960784313725483f, 0.01764705882352935f, 0.03333333333333333f, 0.0490196078431373f, 0.06470588235294117f, 0.08039215686274503f, 0.09607843137254901f, 0.111764705882353f, 0.1274509803921569f, 0.1431372549019607f, 0.1588235294117647f, 0.1745098039215687f, 0.1901960784313725f, 0.2058823529411764f, 0.2215686274509804f, 0.2372549019607844f, 0.2529411764705882f, 0.2686274509803921f, 0.2843137254901961f, 0.3f, 0.3156862745098039f, 0.3313725490196078f, 0.3470588235294118f, 0.3627450980392157f, 0.3784313725490196f, 0.3941176470588235f, 0.4098039215686274f, 0.4254901960784314f, 0.4411764705882353f, 0.4568627450980391f, 0.4725490196078431f, 0.4882352941176471f, 0.503921568627451f, 0.5196078431372548f, 0.5352941176470587f, 0.5509803921568628f, 0.5666666666666667f, 0.5823529411764705f, 0.5980392156862746f, 0.6137254901960785f, 0.6294117647058823f, 0.6450980392156862f, 0.6607843137254901f, 0.6764705882352942f, 0.692156862745098f, 0.7078431372549019f, 0.723529411764706f, 0.7392156862745098f, 0.7549019607843137f, 0.7705882352941176f, 0.7862745098039214f, 0.8019607843137255f, 0.8176470588235294f, 0.8333333333333333f, 0.8490196078431373f, 0.8647058823529412f, 0.8803921568627451f, 0.8960784313725489f, 0.9117647058823528f, 0.9274509803921569f, 0.9431372549019608f, 0.9588235294117646f, 0.9745098039215687f, 0.9901960784313726f, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9901960784313726f, 0.9745098039215687f, 0.9588235294117649f, 0.943137254901961f, 0.9274509803921571f, 0.9117647058823528f, 0.8960784313725489f, 0.8803921568627451f, 0.8647058823529412f, 0.8490196078431373f, 0.8333333333333335f, 0.8176470588235296f, 0.8019607843137253f, 0.7862745098039214f, 0.7705882352941176f, 0.7549019607843137f, 0.7392156862745098f, 0.723529411764706f, 0.7078431372549021f, 0.6921568627450982f, 0.6764705882352944f, 0.6607843137254901f, 0.6450980392156862f, 0.6294117647058823f, 0.6137254901960785f, 0.5980392156862746f, 0.5823529411764707f, 0.5666666666666669f, 0.5509803921568626f, 0.5352941176470587f, 0.5196078431372548f, 0.503921568627451f, 0.4882352941176471f, 0.4725490196078432f, 0.4568627450980394f, 0.4411764705882355f, 0.4254901960784316f, 0.4098039215686273f, 0.3941176470588235f, 0.3784313725490196f, 0.3627450980392157f, 0.3470588235294119f, 0.331372549019608f, 0.3156862745098041f, 0.2999999999999998f, 0.284313725490196f, 0.2686274509803921f, 0.2529411764705882f, 0.2372549019607844f, 0.2215686274509805f, 0.2058823529411766f, 0.1901960784313728f, 0.1745098039215689f, 0.1588235294117646f, 0.1431372549019607f, 0.1274509803921569f, 0.111764705882353f, 0.09607843137254912f, 0.08039215686274526f, 0.06470588235294139f, 0.04901960784313708f, 0.03333333333333321f, 0.01764705882352935f, 0.001960784313725483f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    
    
    	float b[] = { 0.5f, 0.5156862745098039f, 0.5313725490196078f, 0.5470588235294118f, 0.5627450980392157f, 0.5784313725490196f, 0.5941176470588235f, 0.6098039215686275f, 0.6254901960784314f, 0.6411764705882352f, 0.6568627450980392f, 0.6725490196078432f, 0.6882352941176471f, 0.7039215686274509f, 0.7196078431372549f, 0.7352941176470589f, 0.7509803921568627f, 0.7666666666666666f, 0.7823529411764706f, 0.7980392156862746f, 0.8137254901960784f, 0.8294117647058823f, 0.8450980392156863f, 0.8607843137254902f, 0.8764705882352941f, 0.892156862745098f, 0.907843137254902f, 0.9235294117647059f, 0.9392156862745098f, 0.9549019607843137f, 0.9705882352941176f, 0.9862745098039216f, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9941176470588236f, 0.9784313725490197f, 0.9627450980392158f, 0.9470588235294117f, 0.9313725490196079f, 0.915686274509804f, 0.8999999999999999f, 0.884313725490196f, 0.8686274509803922f, 0.8529411764705883f, 0.8372549019607844f, 0.8215686274509804f, 0.8058823529411765f, 0.7901960784313726f, 0.7745098039215685f, 0.7588235294117647f, 0.7431372549019608f, 0.7274509803921569f, 0.7117647058823531f, 0.696078431372549f, 0.6803921568627451f, 0.6647058823529413f, 0.6490196078431372f, 0.6333333333333333f, 0.6176470588235294f, 0.6019607843137256f, 0.5862745098039217f, 0.5705882352941176f, 0.5549019607843138f, 0.5392156862745099f, 0.5235294117647058f, 0.5078431372549019f, 0.4921568627450981f, 0.4764705882352942f, 0.4607843137254903f, 0.4450980392156865f, 0.4294117647058826f, 0.4137254901960783f, 0.3980392156862744f, 0.3823529411764706f, 0.3666666666666667f, 0.3509803921568628f, 0.335294117647059f, 0.3196078431372551f, 0.3039215686274508f, 0.2882352941176469f, 0.2725490196078431f, 0.2568627450980392f, 0.2411764705882353f, 0.2254901960784315f, 0.2098039215686276f, 0.1941176470588237f, 0.1784313725490199f, 0.1627450980392156f, 0.1470588235294117f, 0.1313725490196078f, 0.115686274509804f, 0.1000000000000001f, 0.08431372549019622f, 0.06862745098039236f, 0.05294117647058805f, 0.03725490196078418f, 0.02156862745098032f, 0.00588235294117645f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    	
    	Mat rr(256, 1, CV_32FC1, r); // red
    	Mat gg(256, 1, CV_32FC1, g); // green
    	Mat bb(256, 1, CV_32FC1, b); // blue
    
    	for (int i = 0; i < pts.rows; i++)
    	{
    		pts.at<Vec3f>(i, 0)[0] = rr.at<float>(i, 0);
    		pts.at<Vec3f>(i, 0)[1] = gg.at<float>(i, 0);
    		pts.at<Vec3f>(i, 0)[2] = bb.at<float>(i, 0);
    	}
    
    	Mat image3(256, 500, CV_8UC3, Scalar(0, 0, 0));
    	for (int kf = 0; kf < image3.rows; kf++)
    	{
    
    		for (int j = 0; j < image3.cols; j++)
    		{
    			image3.at<Vec3b>(kf, j)[0] = 255 * pts.at<Vec3f>(kf, 0)[0];
    			image3.at<Vec3b>(kf, j)[1] = 255 * pts.at<Vec3f>(kf, 0)[1];
    			image3.at<Vec3b>(kf, j)[2] = 255 * pts.at<Vec3f>(kf, 0)[2];
    		}
    
    	}
    	imshow("Depth Map5", image3);
    	waitKey();
        Mat test1 = cv::imread("5_IMG_DepthMap.tif", -1);
        double min;
        double max;
        cv::minMaxIdx(test1, &min, &max);
        cv::Mat adjMap;
        // expand your range to 0..255. Similar to histEq();
        test1.convertTo(adjMap,CV_8UC1, 255 / (max-min), -min* (255/(max-min)) );
        //test1.convertTo(adjMap,CV_8UC1, 255 / (max-min));
        // this is great. It converts your grayscale image into a tone-mapped one,
        // much more pleasing for the eye
        // function is found in contrib module, so include contrib.hpp
        // and link accordingly
        cv::Mat falseColorsMap;
        //    enum
        //    {
        //        COLORMAP_AUTUMN = 0,
        //        COLORMAP_BONE = 1,
        //        COLORMAP_JET = 2,
        //        COLORMAP_WINTER = 3,
        //        COLORMAP_RAINBOW = 4,
        //        COLORMAP_OCEAN = 5,
        //        COLORMAP_SUMMER = 6,
        //        COLORMAP_SPRING = 7,
        //        COLORMAP_COOL = 8,
        //        COLORMAP_HSV = 9,
        //        COLORMAP_PINK = 10,
        //        COLORMAP_HOT = 11
        //    }
        applyColorMap(adjMap, falseColorsMap, cv::COLORMAP_JET);
        cv::imwrite("depthNormalize_1.jpg", falseColorsMap);

     

    测试了一下,效果不错,颜色越深,代表近,颜色越浅代表远,这就有点深度学习特征图热力图的感觉了

    测试一下:

       float r[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.00588235294117645f, 0.02156862745098032f, 0.03725490196078418f, 0.05294117647058827f, 0.06862745098039214f, 0.084313725490196f, 0.1000000000000001f, 0.115686274509804f, 0.1313725490196078f, 0.1470588235294117f, 0.1627450980392156f, 0.1784313725490196f, 0.1941176470588235f, 0.2098039215686274f, 0.2254901960784315f, 0.2411764705882353f, 0.2568627450980392f, 0.2725490196078431f, 0.2882352941176469f, 0.303921568627451f, 0.3196078431372549f, 0.3352941176470587f, 0.3509803921568628f, 0.3666666666666667f, 0.3823529411764706f, 0.3980392156862744f, 0.4137254901960783f, 0.4294117647058824f, 0.4450980392156862f, 0.4607843137254901f, 0.4764705882352942f, 0.4921568627450981f, 0.5078431372549019f, 0.5235294117647058f, 0.5392156862745097f, 0.5549019607843135f, 0.5705882352941174f, 0.5862745098039217f, 0.6019607843137256f, 0.6176470588235294f, 0.6333333333333333f, 0.6490196078431372f, 0.664705882352941f, 0.6803921568627449f, 0.6960784313725492f, 0.7117647058823531f, 0.7274509803921569f, 0.7431372549019608f, 0.7588235294117647f, 0.7745098039215685f, 0.7901960784313724f, 0.8058823529411763f, 0.8215686274509801f, 0.8372549019607844f, 0.8529411764705883f, 0.8686274509803922f, 0.884313725490196f, 0.8999999999999999f, 0.9156862745098038f, 0.9313725490196076f, 0.947058823529412f, 0.9627450980392158f, 0.9784313725490197f, 0.9941176470588236f, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9862745098039216f, 0.9705882352941178f, 0.9549019607843139f, 0.93921568627451f, 0.9235294117647062f, 0.9078431372549018f, 0.892156862745098f, 0.8764705882352941f, 0.8607843137254902f, 0.8450980392156864f, 0.8294117647058825f, 0.8137254901960786f, 0.7980392156862743f, 0.7823529411764705f, 0.7666666666666666f, 0.7509803921568627f, 0.7352941176470589f, 0.719607843137255f, 0.7039215686274511f, 0.6882352941176473f, 0.6725490196078434f, 0.6568627450980391f, 0.6411764705882352f, 0.6254901960784314f, 0.6098039215686275f, 0.5941176470588236f, 0.5784313725490198f, 0.5627450980392159f, 0.5470588235294116f, 0.5313725490196077f, 0.5156862745098039f, 0.5f };
    
    
    
        float g[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.001960784313725483f, 0.01764705882352935f, 0.03333333333333333f, 0.0490196078431373f, 0.06470588235294117f, 0.08039215686274503f, 0.09607843137254901f, 0.111764705882353f, 0.1274509803921569f, 0.1431372549019607f, 0.1588235294117647f, 0.1745098039215687f, 0.1901960784313725f, 0.2058823529411764f, 0.2215686274509804f, 0.2372549019607844f, 0.2529411764705882f, 0.2686274509803921f, 0.2843137254901961f, 0.3f, 0.3156862745098039f, 0.3313725490196078f, 0.3470588235294118f, 0.3627450980392157f, 0.3784313725490196f, 0.3941176470588235f, 0.4098039215686274f, 0.4254901960784314f, 0.4411764705882353f, 0.4568627450980391f, 0.4725490196078431f, 0.4882352941176471f, 0.503921568627451f, 0.5196078431372548f, 0.5352941176470587f, 0.5509803921568628f, 0.5666666666666667f, 0.5823529411764705f, 0.5980392156862746f, 0.6137254901960785f, 0.6294117647058823f, 0.6450980392156862f, 0.6607843137254901f, 0.6764705882352942f, 0.692156862745098f, 0.7078431372549019f, 0.723529411764706f, 0.7392156862745098f, 0.7549019607843137f, 0.7705882352941176f, 0.7862745098039214f, 0.8019607843137255f, 0.8176470588235294f, 0.8333333333333333f, 0.8490196078431373f, 0.8647058823529412f, 0.8803921568627451f, 0.8960784313725489f, 0.9117647058823528f, 0.9274509803921569f, 0.9431372549019608f, 0.9588235294117646f, 0.9745098039215687f, 0.9901960784313726f, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9901960784313726f, 0.9745098039215687f, 0.9588235294117649f, 0.943137254901961f, 0.9274509803921571f, 0.9117647058823528f, 0.8960784313725489f, 0.8803921568627451f, 0.8647058823529412f, 0.8490196078431373f, 0.8333333333333335f, 0.8176470588235296f, 0.8019607843137253f, 0.7862745098039214f, 0.7705882352941176f, 0.7549019607843137f, 0.7392156862745098f, 0.723529411764706f, 0.7078431372549021f, 0.6921568627450982f, 0.6764705882352944f, 0.6607843137254901f, 0.6450980392156862f, 0.6294117647058823f, 0.6137254901960785f, 0.5980392156862746f, 0.5823529411764707f, 0.5666666666666669f, 0.5509803921568626f, 0.5352941176470587f, 0.5196078431372548f, 0.503921568627451f, 0.4882352941176471f, 0.4725490196078432f, 0.4568627450980394f, 0.4411764705882355f, 0.4254901960784316f, 0.4098039215686273f, 0.3941176470588235f, 0.3784313725490196f, 0.3627450980392157f, 0.3470588235294119f, 0.331372549019608f, 0.3156862745098041f, 0.2999999999999998f, 0.284313725490196f, 0.2686274509803921f, 0.2529411764705882f, 0.2372549019607844f, 0.2215686274509805f, 0.2058823529411766f, 0.1901960784313728f, 0.1745098039215689f, 0.1588235294117646f, 0.1431372549019607f, 0.1274509803921569f, 0.111764705882353f, 0.09607843137254912f, 0.08039215686274526f, 0.06470588235294139f, 0.04901960784313708f, 0.03333333333333321f, 0.01764705882352935f, 0.001960784313725483f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    
    
        float b[] = { 0.5f, 0.5156862745098039f, 0.5313725490196078f, 0.5470588235294118f, 0.5627450980392157f, 0.5784313725490196f, 0.5941176470588235f, 0.6098039215686275f, 0.6254901960784314f, 0.6411764705882352f, 0.6568627450980392f, 0.6725490196078432f, 0.6882352941176471f, 0.7039215686274509f, 0.7196078431372549f, 0.7352941176470589f, 0.7509803921568627f, 0.7666666666666666f, 0.7823529411764706f, 0.7980392156862746f, 0.8137254901960784f, 0.8294117647058823f, 0.8450980392156863f, 0.8607843137254902f, 0.8764705882352941f, 0.892156862745098f, 0.907843137254902f, 0.9235294117647059f, 0.9392156862745098f, 0.9549019607843137f, 0.9705882352941176f, 0.9862745098039216f, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9941176470588236f, 0.9784313725490197f, 0.9627450980392158f, 0.9470588235294117f, 0.9313725490196079f, 0.915686274509804f, 0.8999999999999999f, 0.884313725490196f, 0.8686274509803922f, 0.8529411764705883f, 0.8372549019607844f, 0.8215686274509804f, 0.8058823529411765f, 0.7901960784313726f, 0.7745098039215685f, 0.7588235294117647f, 0.7431372549019608f, 0.7274509803921569f, 0.7117647058823531f, 0.696078431372549f, 0.6803921568627451f, 0.6647058823529413f, 0.6490196078431372f, 0.6333333333333333f, 0.6176470588235294f, 0.6019607843137256f, 0.5862745098039217f, 0.5705882352941176f, 0.5549019607843138f, 0.5392156862745099f, 0.5235294117647058f, 0.5078431372549019f, 0.4921568627450981f, 0.4764705882352942f, 0.4607843137254903f, 0.4450980392156865f, 0.4294117647058826f, 0.4137254901960783f, 0.3980392156862744f, 0.3823529411764706f, 0.3666666666666667f, 0.3509803921568628f, 0.335294117647059f, 0.3196078431372551f, 0.3039215686274508f, 0.2882352941176469f, 0.2725490196078431f, 0.2568627450980392f, 0.2411764705882353f, 0.2254901960784315f, 0.2098039215686276f, 0.1941176470588237f, 0.1784313725490199f, 0.1627450980392156f, 0.1470588235294117f, 0.1313725490196078f, 0.115686274509804f, 0.1000000000000001f, 0.08431372549019622f, 0.06862745098039236f, 0.05294117647058805f, 0.03725490196078418f, 0.02156862745098032f, 0.00588235294117645f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    
        Mat rr(256, 1, CV_32FC1, r); // red
        Mat gg(256, 1, CV_32FC1, g); // green
        Mat bb(256, 1, CV_32FC1, b); // blue
        for (int i = 0; i < pts.rows; i++)
        {
            pts.at<Vec3f>(i, 0)[2] = rr.at<float>(i, 0);
            pts.at<Vec3f>(i, 0)[1] = gg.at<float>(i, 0);
            pts.at<Vec3f>(i, 0)[0] = bb.at<float>(i, 0);
        }
        double minVal,maxVal;
        Mat test = cv::imread("OtherSampleFrame_IMG_DepthMap.tif", -1);
        minMaxLoc(test, &minVal, &maxVal);
    
        Mat image3(test.rows, test.cols, CV_8UC3, Scalar(0, 0, 0));
        for (int m = 0; m < image3.rows; m++)
        {
    
            for (int n = 0; n < image3.cols; n++)
            {
                float depth = test.ptr<float>(m)[n];
    
                if (depth == 0)
                    continue;
    
                // 颜色越深(红),代表近,颜色越浅(蓝色)代表远,黑色代表无深度
                double depthNormalize = MAX(MIN((depth-minVal)/(maxVal-minVal),1.0),0.0);
    
                image3.at<Vec3b>(m, n)[0] = 255 * pts.at<Vec3f>(255*(1-depthNormalize), 0)[0];
                image3.at<Vec3b>(m, n)[1] = 255 * pts.at<Vec3f>(255*(1-depthNormalize), 0)[1];
                image3.at<Vec3b>(m, n)[2] = 255 * pts.at<Vec3f>(255*(1-depthNormalize), 0)[2];
            }
    
        }
        cv::imwrite("depthNormalize.jpg", image3);
    
        Mat imgimg(256, 100, CV_32FC3, cv::Scalar(0,0,0));
        for (int i = 0; i < imgimg.rows; i++)
        {
            rectangle(imgimg, cv::Point(0,i), cv::Point(imgimg.cols-1,i+1), cv::Scalar(255*pts.at<Vec3f>(255-i, 0)[0], 255*pts.at<Vec3f>(255-i, 0)[1], 255*pts.at<Vec3f>(255-i, 0)[2]),1);
        }
        cv::imwrite("depthNormalize_3.jpg", imgimg);
    
       Mat imgimgimg(test.rows, 100, CV_32FC3, cv::Scalar(0,0,0));
        double mmin = 0;
        double mmax = test.rows;
        for (int i = 0; i < imgimgimg.rows; i++)
        {
            double dddd = 255 * MAX(MIN((i-mmin)/(mmax-mmin),1.0),0.0);
            rectangle(imgimgimg, cv::Point(0,i), cv::Point(imgimgimg.cols-1,i+1), cv::Scalar(255*pts.at<Vec3f>(255-dddd, 0)[0], 255*pts.at<Vec3f>(255-dddd, 0)[1], 255*pts.at<Vec3f>(255-dddd, 0)[2]),1);
        }
        cv::imwrite("depthNormalize_4.jpg", imgimgimg);

        Mat imgimgimg(test.rows, 200, CV_32FC3, cv::Scalar(255,255,255));
        double mmin = 50;
        double mmax = imgimgimg.rows-50;
        for (int i = 50; i < imgimgimg.rows-50; i++)
        {
            //0-255  256->2001mm(0-2000mm)
            double dddd = 255 * MAX(MIN((i-mmin)/(mmax-mmin),1.0),0.0);
            rectangle(imgimgimg, cv::Point(0,i), cv::Point(100-1,i+1), cv::Scalar(255*pts.at<Vec3f>(dddd, 0)[0], 255*pts.at<Vec3f>(dddd, 0)[1], 255*pts.at<Vec3f>(dddd, 0)[2]),1);
    
            if (i==50)
            {
                line(imgimgimg, Point(100, i), Point(119, i), Scalar(0, 0, 0), 1);
                std::string text = to_string(2000);
                int font_face = cv::FONT_HERSHEY_COMPLEX;
                double font_scale = 0.8;
                int thickness = 1.5;
                cv::putText(imgimgimg, text, Point(120, i+10), font_face, font_scale, cv::Scalar(0, 0, 0), thickness, 8, 0);
            } else if (i==imgimgimg.rows-50-1) {
                line(imgimgimg, Point(100, i), Point(119, i), Scalar(0, 0, 0), 1);
                std::string text = to_string(0);
                int font_face = cv::FONT_HERSHEY_COMPLEX;
                double font_scale = 0.8;
                int thickness = 1.5;
                cv::putText(imgimgimg, text, Point(120, i + 10), font_face, font_scale, cv::Scalar(0, 0, 0), thickness, 8,
                            0);
            } else if (i > 50+30 and i < imgimgimg.rows-50-30-1) {
                if (i % ( (imgimgimg.rows-50-50-30-2) /30) == 0) {
                    line(imgimgimg, Point(100, i), Point(119, i), Scalar(0, 0, 0), 1);
                    std::string text = to_string(int((255-dddd)/255 * 2000) );
                    int font_face = cv::FONT_HERSHEY_COMPLEX;
                    double font_scale = 0.8;
                    int thickness = 1.5;
                    cv::putText(imgimgimg, text, Point(120, i+10), font_face, font_scale, cv::Scalar(0, 0, 0), thickness, 8, 0);
                }
            }
        }
    
        cv::imwrite("depthNormalize_4.jpg", imgimgimg);
    

     

    效果对了

    最后附上原图(没有附上序列,只上一个就行)

    展开全文
  • OpenCV对不同图像深度的处理(转),这是我从网上收集过来的额!
  • opencv 图像深度(depth)

    千次阅读 2015-08-04 16:03:03
    图像深度是指存储每个像素所用的位数,也用于量度图像的色彩分辨率.图像深度确定彩色图像的每个像素可能有的颜色数,或者确定灰度图像的每个像素可能有的灰度级数.它决定了彩色图像中可出现的最多颜色数,或灰度图像中...

    图像深度是指存储每个像素所用的位数,也用于量度图像的色彩分辨率.图像深度确定彩色图像的每个像素可能有的颜色数,或者确定灰度图像的每个像素可能有的灰度级数.它决定了彩色图像中可出现的最多颜色数,或灰度图像中的最大灰度等级.比如一幅单色图像,若每个象素有8位,则最大灰度数目为2的8次方,即256.一幅彩色图像RGB3个分量的象素位数分别为4,4,2,则最大颜色数目为2的4+4+2次方,即1024,就是说像素的深度为10位,每个像素可以是1024种颜色中的一种.

    例如:一幅画的尺寸是1024*768,深度为16,则它的数据量为1.5M。

    计算如下:1024*768*16bit=(1024*768*16)/8字节=[(1024*768*16)/8]/1024KB={[(1024*768*16)/8]/1024}/1024MB。


    Opencv 转化函数,参考opencv 2.3.1 manual Reference
    [cpp]  view plain copy
    1. Converts one array to another with optional linear transformation.  
    2. C: void cvConvertScale(const CvArr* src, CvArr* dst, double scale=1, double shift=0)  
    3. #define cvCvtScale cvConvertScale  
    4. #define cvScale cvConvertScale  
    5. #define cvConvert(src, dst ) cvConvertScale((src), (dst), 1, 0 )  
    6. Parameters:  
    7. src – Source array  
    8. dst – Destination array  
    9. scale – Scale factor  
    10. shift – Value added to the scaled source array elements  

    scale  ( Double )
    The value to be multipled with the pixel
    shift (Double)
    The value to be added to the pixel
    Return Value
    Image of the specific depth, val = val * scale + shift

    如果 scale=1,shift=0 就不会进行比例缩放. 这是一个特殊的优化,相当于该函数的同义函数名:cvConvert 。

    如果原来数组和输出数组的类型相同,这是另一种特殊情形,可以被用于比例缩放和平移矩阵或图像,此时相当于该函数的同义函数名:cvScale。

    因此可以用这个函数实现不同位深之间的转换,也可以用于不同数据类型之间的转换!



    下面转一段别人总结的深度显示范围。
    测试double型:0.0--1.0之间                          IPL_DEPTH_64F

    测试float型:0.0--1.0之间                             IPL_DEPTH_32F

    测试long型:0--65535之间                            IPL_DEPTH_32S        

    测试short int型:-32768--32767之间                 IPL_DEPTH_16S       

    测试unsigned short int型:0--65535之间             IPL_DEPTH_16U

    测试char型:-128--127之间                           IPL_DEPTH_8S         

    测试unsigned char型:0--255之间                    IPL_DEPTH_8U

    这个时候如果需要保存图像,请记住要先转换到IPL_DEPTH_8U的深度。因为只有8位单通道或者3通道(通道顺序为'BGR')才可以使用cvSaveImage保存。下



    转载:http://blog.csdn.net/dingfc/article/details/7457984

    展开全文
  • opencv关于图像深度转换的一点理解

    千次阅读 2019-07-09 18:48:27
    常用图像深度如下: 图像类型 数据类型 字节 取值范围 显示范围 CV_8U unsigned char 1 0~255 0~255 CV_8S char 1 -128~127 -128~128 CV_16U unsigned short 2 0~65535 0~65535 CV_16S short 2 -32768...
  • opencv-图像深度

    千次阅读 2019-12-09 14:03:54
    0--65535之间 IPL_DEPTH_16U 测试char型:-128--127之间 IPL_DEPTH_8S 测试unsigned char型:0--255之间 IPL_DEPTH_8U 不同深度图像的转换 要注意范围 比如IPL_DEPTH_8U 转到 IPL_DEPTH_32U 要用cvConvertScale...
  • OpenCV图像深度

    千次阅读 2018-01-21 14:57:45
    图像深度: 图片是由一个个像素点构成的,所有不同颜色的像素点构成了一副完整的图像,计算机存储图片是以二进制来进行的。 1 bit : 用一位来存储,那么这个像素点的取值范围就是0或者1,那么我们看来这幅图片...
  • Python-opencv读取深度图像

    万次阅读 2018-11-26 14:24:33
    由于实验需要用到Kinect2.0采集的深度图像,但是用以下程序读取深度图片的时候显不方便观察 temp_img= 'cup_depth.png' depth_filename = os.path.join(image_dir,depth_img) temp_filename = os.path.join...
  • opencv图像深度

    千次阅读 2011-09-07 09:35:53
    opencv的IplImage结构中有这么一个成员:depth。 其取值如下: 枚举值 用%d输出 二进制 IPL_DEPTH_8U : 8 : 0x0000 0008 IPL_DEPTH_8S : -2147483640 : 0xfff
  • Opencv中使用预训练的深度学习模型,实现特定物体的识别
  • opencv_python 深度估计与图像分割

    千次阅读 2019-11-07 20:52:12
    opencv_python 深度估计与图像分割 半全局块匹配(Semi-Global Block Matching)算法 计算每个像素点的代价 原论文使用的方法是利用互信息熵,而OpenCV使用的是Birchfield和Tomasi的方法(参照《Depth ...
  • opencv图像深度及取值范围

    千次阅读 2017-07-31 18:47:05
    图像的位深度及其取值范围:src.depth() Mat类型: 矩阵数据类型:  —— CV_(S|U|F)C  S= 符号整型 U=无符号整形 F=浮点型  如:CV_8UC1 表示一个8位无符号整型单通道矩阵  CV_32FC2 表示一个32位浮点型...
  • OpenCV对不同图像深度的处理

    千次阅读 2014-05-13 18:41:31
    在处理一些需要图像相加运算的操作时,通常定义 ... 当处理完成后,需要对原这个IPL_DEPTH_64F深度图像进行显示的时候,就需要做一些转换。可以用cvScale()这个函数,这个函数主要是对图像做线性变换。如果不转换的
  • opencv图像基础(大小,深度,通道)

    万次阅读 多人点赞 2015-08-21 10:36:26
    1、图像的大小 2、图像深度 3、图像的通道 例如: cvCreateImage(cvSize(imgMono->width,imgMono->height), IPL_DEPTH_8U, 3) 1、图像的位深度及其取值范围:src.depth()    depth 图像元素的位深度,可以...
  • 使用OpenCV深度学习模型残差网络(ResNet)人脸检测,实现了静态图像人脸检测和实时视频流人脸检测
  • 原文链接图像着色 使用 OpenCV ,深度学习 进行 黑白图像着色 在2019年7月23日上张贴 由hotdog发表回复 图像着色 使用OpenCV,深学习进行黑白 图像着色 在本教程中,您将学习如何使用OpenCV深度学习和Python对...
  • 利用Kinect sdk2.0和opencv3.0,获取深度图实时显示。 详见博文http://blog.csdn.net/cs2539263027, 内含有opencv3.0的属性文件。
  • 角点检测 是由Opencv的cornerHarris函数实现,其他函数参数说明如下: cv2.cornerHarris(src=gray, blockSize=9, ksize=23, k=0.04) # cornerHarris参数: # src - 数据类型为 float32 的输入图像。 # blockSize - ...
  • 什么是图像深度 很多人开始学习 OpenCV之后接触前面几个 API 就包括 imwrite 函数而 且很快知道了如何去保存 Mat 对象为图像常规代码如下 imwrite"D:/result.png , dst; 其中 dst 是 Mat 对象 这样保存的图像默认是...
  • opencv2/opencv.hpp> using namespace std; using namespace cv; string Type2String(int type) { string strType; uchar depth = type & CV_MAT_DEPTH_MASK; uchar chans = 1 + (type >> CV_...
  • 最近编程有用到OpenCV,其中涉及到图像不同位深度间的转换。在网上搜索一番后,总结的东西整理成如下笔记。 图像的位深度及其取值范围    depth 图像元素的位深度,可以是下面的其中之一:  位深度 ...
  • 利用keras深度学习框架,生成交通标志分类模型h5,转换为tensorflow的深度学习框架pb,在OpenCV中利用dnn调用pb模型并判断交通标志分类
  • opencv图像识别训练实例

    万次阅读 多人点赞 2018-10-17 20:35:10
    我一度以为图像训练会很难,觉得很高深,直到我亲自做了一个图像的训练才认识到如果仅仅是单纯地学习和使用,真的很简单。 本文按照如下顺序来进行详细解释如何进行图像识别训练过程: 制作图像 图像数据 图像...
  • OpenCV中提供了图像尺寸调整的函数resize(),函数介绍如下: void resize( InputArray src, OutputArray dst, Size dsize, Double fx=0, Double fy=0, int interpolation=INTER_LINEAR ) 第一个参数:...
  • 下面介绍三种OpenCV复制图像的方法: 方法1、重载运算符= 使用重载运算符“=”进行的拷贝是一种浅拷贝,虽然它们有不同的矩阵头,但是二者共享相同的内存空间,二者内容相互关联,任何一个变量变化的同时另一个变量...
  • opencv-python 立体图像深度

    千次阅读 2020-05-05 09:24:50
    我们将学习如何从立体图像创建深度图。 基础 在上一节中我们学习了对极约束的基本概念和相关术语。如果同一场景有两幅图像的话我们在直觉上就可以获得图像深度信息。下面是的这幅图和其中的数学公式证明我们的...
  • OpenCV 2.0里使用C++进行了重写,包括图像数据也从IplImage编程了Mat。Mat分为两个部分:头部(header)和像素矩阵(pixels matrix)。同时OpenCV对像素矩阵的内存管理模式使用了引用计数的概念。也就是说,像素矩阵...
  • TensorFlow + Opencv 实现简单的图像识别。 使用TensorFlow搭建简单的BP神经网络的模型,一层输入层,一层隐藏,一层输出,最终实现简单的图像识别。 机器学习

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 31,966
精华内容 12,786
关键字:

opencv图像深度