I used mat in opencv cpp code to load images
1 | initial version |
I used mat in opencv cpp code to load images
2 | No.2 Revision |
I used mat in opencv cpp code to load images
Here is my code: cv::Mat srcImage_3channels = cv::imread(InputPath, CV_LOAD_IMAGE_UNCHANGED); cv::Mat srcImage = cv::Mat::zeros(srcImage_3channels.rows, srcImage_3channels.cols, CV_16UC1);
UINT16* src_3 = (UINT16*)srcImage_3channels.data;
UINT16* src = (UINT16*)srcImage.data;
int B = 0;
for (int j = 0; j < srcImage_3channels.rows; j++)
{
for (int i = 0; i < srcImage_3channels.cols; i ++)
{
B = src_3[i*3 + j*srcImage_3channels.cols * 3];
src[(i)+j*srcImage.cols] = (UINT16)B;//getting single channel from 3 channel image
}
}
test::cvClahe(srcImage, srcImage, clipLimit);
cv::imwrite(OutputPath, srcImage);
3 | No.3 Revision |
I used mat in opencv cpp code to load images
Here is my code:
code:
cv::Mat srcImage_3channels = cv::imread(InputPath, CV_LOAD_IMAGE_UNCHANGED);
cv::Mat srcImage = cv::Mat::zeros(srcImage_3channels.rows, srcImage_3channels.cols, CV_16UC1);
CV_16UC1);
UINT16* src_3 = (UINT16*)srcImage_3channels.data;
UINT16* src = (UINT16*)srcImage.data;
int B = 0;
for (int j = 0; j < srcImage_3channels.rows; j++)
{
for (int i = 0; i < srcImage_3channels.cols; i ++)
{
B = src_3[i*3 + j*srcImage_3channels.cols * 3];
src[(i)+j*srcImage.cols] = (UINT16)B;//getting single channel from 3 channel image
}
}
test::cvClahe(srcImage, srcImage, clipLimit);
cv::imwrite(OutputPath, srcImage);
4 | No.4 Revision |
I used mat in opencv cpp code to load images
Here is my code:
cv::Mat srcImage_3channels = cv::imread(InputPath, CV_LOAD_IMAGE_UNCHANGED);
cv::Mat srcImage = cv::Mat::zeros(srcImage_3channels.rows, srcImage_3channels.cols, CV_16UC1);
UINT16* src_3 = (UINT16*)srcImage_3channels.data;
UINT16* src = (UINT16*)srcImage.data;
int B = 0;
for (int j = 0; j < srcImage_3channels.rows; j++)
{
for (int i = 0; i < srcImage_3channels.cols; i ++)
{
B = src_3[i*3 + j*srcImage_3channels.cols * 3];
src[(i)+j*srcImage.cols] = (UINT16)B;//getting single channel from 3 channel image
}
}
test::cvClahe(srcImage, srcImage, clipLimit);
cv::imwrite(OutputPath, srcImage);
5 | No.5 Revision |
I used mat in opencv cpp code to load images
Here is my code:
cv::Mat srcImage_3channels = cv::imread(InputPath, CV_LOAD_IMAGE_UNCHANGED);
cv::Mat srcImage = cv::Mat::zeros(srcImage_3channels.rows, srcImage_3channels.cols, CV_16UC1);
UINT16* src_3 = (UINT16*)srcImage_3channels.data;
UINT16* src = (UINT16*)srcImage.data;
int B = 0;
for (int j = 0; j < srcImage_3channels.rows; j++)
{
for (int i = 0; i < srcImage_3channels.cols; i ++)
{
B = src_3[i*3 + j*srcImage_3channels.cols * 3];
src[(i)+j*srcImage.cols] = (UINT16)B;//getting single channel from 3 channel image
}
}
test::cvClahe(srcImage, srcImage, clipLimit);
cv::imwrite(OutputPath, srcImage);