# Revision history [back]

### Resize output of 3-channel and 1-channel of the same image does not match.

I have been working on OpenCV's resize function. I resized a one channel input image , this is my output1. And then converted input image to 3 channel by keeping the other two channels zero, then resized this image by the same factor. The 3 channel output's R channel bits does not match with output1 when run on ARM processor.

It would be really helpful if anyone can figure out what the problem is. Thanks in advance.

### Resize output of 3-channel and 1-channel of the same image does not match.

I have been working on OpenCV's resize function. I resized a one channel input image , this is my output1. And then converted input image to 3 channel by keeping the other two channels zero, then resized this image by the same factor. The 3 channel output's R channel bits does not match with output1 when run on ARM processor.

It would be really helpful if anyone can figure out what the problem is. Thanks in advance.

### Resize output of 3-channel and 1-channel of the same image does not match.

I have been working on OpenCV's resize function. I resized a one channel input image , this is my output1. And then converted input image to 3 channel by keeping the other two channels zero, then resized this image by the same factor. The 3 channel output's R channel bits does not match with output1 when run on ARM processor.

It would be really helpful if anyone can figure out what the problem is. Thanks in advance.

#include "opencv2/highgui/highgui.hpp"

# include <opencv2\imgproc\imgproc.hpp>

using namespace std; using namespace cv; int main() { Mat input1 = imread("data/misc/camera/Lighthouse.jpg", IMREAD_GRAYSCALE); Mat input2(input1.rows, input1.cols, CV_8UC3); //converting 1 channel image to 3 channel for (int i = 0; i < input2.rows; i++) { for (int j = 0; j < input2.cols; j++) { input2.at<vec3b>(i, j)[0] = input1.at<uchar>(i, j); input2.at<vec3b>(i, j)[1] = 0; input2.at<vec3b>(i, j)[2] = 0; } } double scale_x = 0.1, scale_y = 0.1; Mat output1(input1.rowsscale_y, input1.colsscale_x, CV_8UC1), output2(input2.rowsscale_y, input2.colsscale_x, CV_8UC3); Mat output3(input1.rowsscale_y, input1.colsscale_x, CV_8UC1); resize(input1, output1, output1.size(), 0, 0, CV_INTER_LINEAR); resize(input2, output2, output2.size(), 0, 0, CV_INTER_LINEAR); //converting 3 channel image to 1 channel for (int i = 0; i < output2.rows; i++) { for (int j = 0; j < output2.cols; j++) { output3.at<uchar>(i, j) = output2.at<vec3b>(i, j)[0]; } } int flag = 0, diff, max = 0; //comparing the outputs for (int i = 0; i < output1.rows; i++) { for (int j = 0; j < output1.cols; j++) { if (output3.at<uchar>(i, j) != output1.at<uchar>(i, j)) { flag = 1; if (flag) { printf("Mismatch!!\n"); break; } } } if (flag) break; } return 0; }

 4 None berak 32464 ●4 ●81 ●306

### Resize output of 3-channel and 1-channel of the same image does not match.

I have been working on OpenCV's resize function. I resized a one channel input image , this is my output1. And then converted input image to 3 channel by keeping the other two channels zero, then resized this image by the same factor. The 3 channel output's R channel bits does not match with output1 when run on ARM processor.

It would be really helpful if anyone can figure out what the problem is. Thanks in advance.

#include "opencv2/highgui/highgui.hpp"

# include <opencv2\imgproc\imgproc.hpp>

#include "opencv2/highgui/highgui.hpp"
#include <opencv2/core/core.hpp>
#include <iostream>
#include <opencv2\imgproc\imgproc.hpp>

using namespace std;
using namespace cv;
int main()
{
Mat input2(input1.rows, input1.cols, CV_8UC3);
//converting 1 channel image to 3 channel
for (int i = 0; i < input2.rows; i++)
{
for (int j = 0; j < input2.cols; j++)
{
input2.at<vec3b>(i, input2.at<Vec3b>(i, j)[0] = input1.at<uchar>(i, j);
input2.at<vec3b>(i, input2.at<Vec3b>(i, j)[1] = 0;
input2.at<vec3b>(i, input2.at<Vec3b>(i, j)[2] = 0;
}
}
double scale_x = 0.1, scale_y = 0.1;
Mat output1(input1.rowsscale_y, input1.colsscale_x, output1(input1.rows*scale_y, input1.cols*scale_x, CV_8UC1), output2(input2.rowsscale_y, input2.colsscale_x, output2(input2.rows*scale_y, input2.cols*scale_x, CV_8UC3);
Mat output3(input1.rowsscale_y, input1.colsscale_x, output3(input1.rows*scale_y, input1.cols*scale_x, CV_8UC1);
resize(input1, output1, output1.size(), 0, 0, CV_INTER_LINEAR);
resize(input2, output2, output2.size(), 0, 0, CV_INTER_LINEAR);
//converting 3 channel image to 1 channel
for (int i = 0; i < output2.rows; i++)
{
for (int j = 0; j < output2.cols; j++)
{
output3.at<uchar>(i, j) = output2.at<vec3b>(i, output2.at<Vec3b>(i, j)[0];
}
}
int flag = 0, diff, max = 0;
//comparing the outputs
for (int i = 0; i < output1.rows; i++)
{
for (int j = 0; j < output1.cols; j++)
{
if (output3.at<uchar>(i, j) != output1.at<uchar>(i, j))
{
flag = 1;
if (flag)
{
printf("Mismatch!!\n");
break;
}
}
}
if (flag) break;
}
return 0;
}

}
 5 retagged sturkmen 6507 ●3 ●43 ●74 https://github.com/stu...

### Resize output of 3-channel and 1-channel of the same image does not match.

I have been working on OpenCV's resize function. I resized a one channel input image , this is my output1. And then converted input image to 3 channel by keeping the other two channels zero, then resized this image by the same factor. The 3 channel output's R channel bits does not match with output1 when run on ARM processor.

It would be really helpful if anyone can figure out what the problem is. Thanks in advance.

#include "opencv2/highgui/highgui.hpp"
#include <opencv2/core/core.hpp>
#include <iostream>
#include <opencv2\imgproc\imgproc.hpp>

using namespace std;
using namespace cv;
int main()
{
Mat input2(input1.rows, input1.cols, CV_8UC3);
//converting 1 channel image to 3 channel
for (int i = 0; i < input2.rows; i++)
{
for (int j = 0; j < input2.cols; j++)
{
input2.at<Vec3b>(i, j)[0] = input1.at<uchar>(i, j);
input2.at<Vec3b>(i, j)[1] = 0;
input2.at<Vec3b>(i, j)[2] = 0;
}
}
double scale_x = 0.1, scale_y = 0.1;
Mat output1(input1.rows*scale_y, input1.cols*scale_x, CV_8UC1), output2(input2.rows*scale_y, input2.cols*scale_x, CV_8UC3);
Mat output3(input1.rows*scale_y, input1.cols*scale_x, CV_8UC1);
resize(input1, output1, output1.size(), 0, 0, CV_INTER_LINEAR);
resize(input2, output2, output2.size(), 0, 0, CV_INTER_LINEAR);
//converting 3 channel image to 1 channel
for (int i = 0; i < output2.rows; i++)
{
for (int j = 0; j < output2.cols; j++)
{
output3.at<uchar>(i, j) = output2.at<Vec3b>(i, j)[0];
}
}
int flag = 0, diff, max = 0;
//comparing the outputs
for (int i = 0; i < output1.rows; i++)
{
for (int j = 0; j < output1.cols; j++)
{
if (output3.at<uchar>(i, j) != output1.at<uchar>(i, j))
{
flag = 1;
if (flag)
{
printf("Mismatch!!\n");
break;
}
}
}
if (flag) break;
}
return 0;
}