Ask Your Question

yungtrizzle's profile - activity

2017-04-26 11:45:22 -0600 commented question Fill Mat from 2D vector

Transforming to single channel will lose color data which is not acceptable in this scenario. In terms of range, there is no limitation, although I would like to think that [0,1] would be better since floating point data is expected.

2017-04-26 11:20:22 -0600 commented question Fill Mat from 2D vector

I'm doing a wavelet transform on the data which requires at most a 2d vector to compute the coefficients, I cannot pass a vector<vec3b> which would be the most convenient situation, I would still somehow need to create a vector<vector<double>>

2017-04-26 11:11:29 -0600 commented question Fill Mat from 2D vector

Both data and idwt are 2d vectors, so you're saying my vectors needs to be bigger than 2d to hold 3 channels of data? How you would declare such a vector?

2017-04-26 10:57:37 -0600 commented question Fill Mat from 2D vector

But this is a 24 bit 3 channel image, if I substitute your change I get a grayscale image that stretches out the partially reconstructed area. ibb. co/jYZPak

2017-04-26 10:16:48 -0600 asked a question Fill Mat from 2D vector

I have some code that pulls the pixel values from a mat (image from videocapture):

for (int k = 0; k < rows; k++) {
    for (int l = 0; l < cols; l++) {

        data[k][l] =  (double)frame.at<uchar>(k, l);

        }             
    }

After some transformations the data is written to file. I am trying to reconstruct the original image using these lines:

  cv::Mat frame(idwt.size(), idwt[0].size(), CV_8UC3);//CV_8UC3 8bit unsigned int 3 channels

for (int k = 0; k < idwt.size(); k++) {
    for (int l = 0; l < idwt[k].size(); l++) {

          frame.at<uchar>(k, l) = (unsigned char)std::round(idwt[k][l]); 
        //See ibb.co/j4AzO5
    }
}

Where the data is in idwt, declared as :

 std::vector<std::vector<double>> idwt(row, std::vector<double>(col));

I've inspected the original mat data, the transformed data and the reconstructed data and there is no error but I get a partial reconstructed image. (I have some links to related questions but not enough karma now to post). I cannot fathom why this fails in this way, I've read the docs and nothing seems like a solution to this.