opencv 执行cv::split()函数时报错.
voidDehazor::GenerateDarkImage(){MatrawImage=imread("E:\\tempimage\\1.bmp",CV_LOAD_IM...
void Dehazor::GenerateDarkImage()
{
Mat rawImage= imread("E:\\tempimage\\1.bmp",CV_LOAD_IMAGE_COLOR);
int col = rawImage.cols;
int row = rawImage.rows;
cv::Mat tempdark = cv::Mat(row,col,CV_8UC1);
std::vector<cv::Mat > channelLayers;
cv::split(rawImage,channelLayers);
//cv::Mat rawImage_r;cv::Mat rawImage_g;cv::Mat rawImage_b;必须是连续的
int ncol = row*col;
int nrow = 1;
for(int i = 0; i < nrow; ++i)
{
uchar* p0 = channelLayers[0].ptr();
uchar* p1 = channelLayers[1].ptr();
uchar* p2 = channelLayers[2].ptr();
uchar* pdark = tempdark.ptr();
for (int j = 0; j < ncol; ++j)
{
uchar temp = ((p0[j]<p1[j])?p0[j]:p1[j]);
pdark[j] = ((temp<p2[j])?temp:p2[j]);
}
}
minFilter(tempdark);
cv::imshow("dark",darkChannelImage);
}
并在release条件写可以通过,可得debug就不行。 展开
{
Mat rawImage= imread("E:\\tempimage\\1.bmp",CV_LOAD_IMAGE_COLOR);
int col = rawImage.cols;
int row = rawImage.rows;
cv::Mat tempdark = cv::Mat(row,col,CV_8UC1);
std::vector<cv::Mat > channelLayers;
cv::split(rawImage,channelLayers);
//cv::Mat rawImage_r;cv::Mat rawImage_g;cv::Mat rawImage_b;必须是连续的
int ncol = row*col;
int nrow = 1;
for(int i = 0; i < nrow; ++i)
{
uchar* p0 = channelLayers[0].ptr();
uchar* p1 = channelLayers[1].ptr();
uchar* p2 = channelLayers[2].ptr();
uchar* pdark = tempdark.ptr();
for (int j = 0; j < ncol; ++j)
{
uchar temp = ((p0[j]<p1[j])?p0[j]:p1[j]);
pdark[j] = ((temp<p2[j])?temp:p2[j]);
}
}
minFilter(tempdark);
cv::imshow("dark",darkChannelImage);
}
并在release条件写可以通过,可得debug就不行。 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询