make_normal_gt时候的一些错误吧

1. 代码的括号注意位置,括号位置配对错了。。就不会对了。。。

2.cv::Mat img1 = cv::imread(left_files[i], -1); //-1 读取uint16 ??

 (按原样返回加载的图像,如果有alpha通道,则加载的图像,也包含alpha通道,反之则没有alpha通道。为方便,编程时可以写成flags = -1).

opencv 3.3.1 文档


Mat cv::imread	(	const String & 	filename,
int 	flags = IMREAD_COLOR 
)	

flags:

enum  	cv::ImreadModes {
  cv::IMREAD_UNCHANGED = -1,
  cv::IMREAD_GRAYSCALE = 0,
  cv::IMREAD_COLOR = 1,
  cv::IMREAD_ANYDEPTH = 2,
  cv::IMREAD_ANYCOLOR = 4,
  cv::IMREAD_LOAD_GDAL = 8,
  cv::IMREAD_REDUCED_GRAYSCALE_2 = 16,
  cv::IMREAD_REDUCED_COLOR_2 = 17,
  cv::IMREAD_REDUCED_GRAYSCALE_4 = 32,
  cv::IMREAD_REDUCED_COLOR_4 = 33,
  cv::IMREAD_REDUCED_GRAYSCALE_8 = 64,
  cv::IMREAD_REDUCED_COLOR_8 = 65,
  cv::IMREAD_IGNORE_ORIENTATION = 128
}
IMREAD_UNCHANGED 

If set, return the loaded image as is (with alpha channel, otherwise it gets cropped).

IMREAD_GRAYSCALE 

If set, always convert image to the single channel grayscale image.

IMREAD_COLOR 

If set, always convert image to the 3 channel BGR color image.

IMREAD_ANYDEPTH 

If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it to 8-bit.

IMREAD_ANYCOLOR 

If set, the image is read in any possible color format.

IMREAD_LOAD_GDAL 

If set, use the gdal driver for loading the image.

IMREAD_REDUCED_GRAYSCALE_2 

If set, always convert image to the single channel grayscale image and the image size reduced 1/2.

IMREAD_REDUCED_COLOR_2 

If set, always convert image to the 3 channel BGR color image and the image size reduced 1/2.

IMREAD_REDUCED_GRAYSCALE_4 

If set, always convert image to the single channel grayscale image and the image size reduced 1/4.

IMREAD_REDUCED_COLOR_4 

If set, always convert image to the 3 channel BGR color image and the image size reduced 1/4.

IMREAD_REDUCED_GRAYSCALE_8 

If set, always convert image to the single channel grayscale image and the image size reduced 1/8.

IMREAD_REDUCED_COLOR_8 

If set, always convert image to the 3 channel BGR color image and the image size reduced 1/8.

IMREAD_IGNORE_ORIENTATION 

If set, do not rotate the image according to EXIF's orientation flag.

3.  初始化 给zeros,注意通道数目

cv::Mat mTangeMask= cv::Mat::zeros(imgDepth.rows, imgDepth.cols, CV_8UC1);

 

4.问题:linux下free(): invalid next size (fast)的问题

一般是,free了不存在的变量(已经free过了);或者 访问越界; 操作不存在的指针等

最终发现问题在:

mTangeMask.at<int>(m,n)= 1;

 这里的mTangeMask 是CV_8UC1,8 bits unsigned char== uchar,怎么能用 32 bits的 int访问呢?  改为:

mTangeMask.at<uchar>(m,n)= 1;

5. int main(int argc,char* argv[])传入的参数转成整数(int)

int a = atoi(argv[1]); 

 

6.

depth()

返回是基本的数据类型,也就是说每个数据元素的类型,该函数并不关心矩阵cv::Mat的维度

// <interface.h>
#define CV_8U   0
#define CV_8S   1
#define CV_16U  2
#define CV_16S  3
#define CV_32S  4
#define CV_32F  5
#define CV_64F  6
#define CV_16F  7

type()

返回了 #矩阵相关的数据类型信息#,除元素的数据类型(低3们)外,还包括通道(channel)的个数(高3位),

举个例子来说,

cv::Mat test(100, 100, CV_32FC3);
int type = test.type(); 
int depth = test.depth();

这里
type得到的是CV_32FC3 == 0x15, 因为CV_32F==>0x05,  (3-1)<<3 ==>0x10;
depth得到的是CV_32F,也就是0x05

//<interface.h>
 
#define CV_CN_MAX     512
#define CV_CN_SHIFT   3
#define CV_DEPTH_MAX  (1 << CV_CN_SHIFT)
 
#define CV_MAT_DEPTH_MASK       (CV_DEPTH_MAX - 1)
#define CV_MAT_DEPTH(flags)     ((flags) & CV_MAT_DEPTH_MASK)
 
#define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT))
#define CV_MAKE_TYPE CV_MAKETYPE
 
#define CV_8UC1 CV_MAKETYPE(CV_8U,1)
#define CV_8UC2 CV_MAKETYPE(CV_8U,2)
#define CV_8UC3 CV_MAKETYPE(CV_8U,3)
#define CV_8UC4 CV_MAKETYPE(CV_8U,4)
#define CV_8UC(n) CV_MAKETYPE(CV_8U,(n))
 
#define CV_8SC1 CV_MAKETYPE(CV_8S,1)
#define CV_8SC2 CV_MAKETYPE(CV_8S,2)
#define CV_8SC3 CV_MAKETYPE(CV_8S,3)
#define CV_8SC4 CV_MAKETYPE(CV_8S,4)
#define CV_8SC(n) CV_MAKETYPE(CV_8S,(n))
 
#define CV_16UC1 CV_MAKETYPE(CV_16U,1)
#define CV_16UC2 CV_MAKETYPE(CV_16U,2)
#define CV_16UC3 CV_MAKETYPE(CV_16U,3)
#define CV_16UC4 CV_MAKETYPE(CV_16U,4)
#define CV_16UC(n) CV_MAKETYPE(CV_16U,(n))
 
#define CV_16SC1 CV_MAKETYPE(CV_16S,1)
#define CV_16SC2 CV_MAKETYPE(CV_16S,2)
#define CV_16SC3 CV_MAKETYPE(CV_16S,3)
#define CV_16SC4 CV_MAKETYPE(CV_16S,4)
#define CV_16SC(n) CV_MAKETYPE(CV_16S,(n))
 
#define CV_32SC1 CV_MAKETYPE(CV_32S,1)
#define CV_32SC2 CV_MAKETYPE(CV_32S,2)
#define CV_32SC3 CV_MAKETYPE(CV_32S,3)
#define CV_32SC4 CV_MAKETYPE(CV_32S,4)
#define CV_32SC(n) CV_MAKETYPE(CV_32S,(n))
 
#define CV_32FC1 CV_MAKETYPE(CV_32F,1)
#define CV_32FC2 CV_MAKETYPE(CV_32F,2)
#define CV_32FC3 CV_MAKETYPE(CV_32F,3)
#define CV_32FC4 CV_MAKETYPE(CV_32F,4)
#define CV_32FC(n) CV_MAKETYPE(CV_32F,(n))
 
#define CV_64FC1 CV_MAKETYPE(CV_64F,1)
#define CV_64FC2 CV_MAKETYPE(CV_64F,2)
#define CV_64FC3 CV_MAKETYPE(CV_64F,3)
#define CV_64FC4 CV_MAKETYPE(CV_64F,4)
#define CV_64FC(n) CV_MAKETYPE(CV_64F,(n))
 
#define CV_16FC1 CV_MAKETYPE(CV_16F,1)
#define CV_16FC2 CV_MAKETYPE(CV_16F,2)
#define CV_16FC3 CV_MAKETYPE(CV_16F,3)
#define CV_16FC4 CV_MAKETYPE(CV_16F,4)
#define CV_16FC(n) CV_MAKETYPE(CV_16F,(n))

7.  积分图

void cv::integral	(	
InputArray 	src,
OutputArray 	sum,
OutputArray 	sqsum,
OutputArray 	tilted,
int 	sdepth = -1,
int 	sqdepth = -1 
)	

Parameters

srcinput image as W×H, 8-bit or floating-point (32f or 64f).
sumintegral image as (W+1)×(H+1) , 32-bit integer or floating-point (32f or 64f).
sqsumintegral image for squared pixel values; it is (W+1)×(H+1), double-precision floating-point (64f) array.
tiltedintegral for the image rotated by 45 degrees; it is (W+1)×(H+1) array with the same data type as sum.
sdepthdesired depth of the integral and the tilted integral images, CV_32S, CV_32F, or CV_64F.
sqdepthdesired depth of the integral image of squared pixel values, CV_32F or CV_64F.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值