Ask Your Question

svenevs's profile - activity

2020-10-22 04:36:54 -0600 received badge  Famous Question (source)
2019-11-07 14:02:01 -0600 received badge  Nice Question (source)
2019-09-07 08:12:36 -0600 received badge  Notable Question (source)
2019-02-11 16:29:39 -0600 received badge  Popular Question (source)
2018-02-01 12:38:10 -0600 commented answer Calibration with findCirclesGrid - trouble with pattern width/height

I am very confused by this. If I snag the image you have above, I can find the pattern. If I use what my feeble human

2018-01-26 08:35:18 -0600 commented answer can I use stereoCalibrate with different image sizes?

Hey, that makes a lot of sense! I was looking at solvePnP but getting really turned around as to what inputs would be w

2018-01-26 02:18:31 -0600 received badge  Editor (source)
2018-01-26 02:18:31 -0600 edited question can I use stereoCalibrate with different image sizes?

can I use stereoCalibrate with different image sizes? I am looking at using the stereoCalibrate function, but there is o

2018-01-26 02:17:12 -0600 asked a question can I use stereoCalibrate with different image sizes?

can I use stereoCalibrate with different image sizes? I am looking at using the stereoCalibrate function, but there is o

2017-12-07 23:31:35 -0600 commented answer why is CV_32FC1 not normalized to 0-1?

I haven't had a moment to check the column major thing, will probably inspect when I get home. However, I misread the d

2017-12-07 20:40:05 -0600 commented answer why is CV_32FC1 not normalized to 0-1?

Thanks for the response! @Tetragramm explains in their answer that the storage order is row major, which is why OpenGL

2017-12-07 20:36:25 -0600 commented answer why is CV_32FC1 not normalized to 0-1?

I see. I guess my exposure to high dynamic range image formats misled me. It seems reasonable not to auto scale floats

2017-12-07 20:34:13 -0600 marked best answer why is CV_32FC1 not normalized to 0-1?

I needed to call an external CUDA library function that assumes the input data is CV_32FC1. I'm working with data that comes in on a frame to frame basis, in RGBA, but at this point in time the data is already on the GPU. Instead of downloading an image to use OpenCV to convert, I figured I'd just do it myself. The most related question I could find was this SO post asking about the difference between CV_32F and CV_32FC1. The original function I wrote

/// will normalize to [0, 1] then use sRGB conversion to return single float gray
inline __host__ __device__
float rgbaToGray(const uchar4 &src) {
    static constexpr float Wr = 0.2126f;
    static constexpr float Wg = 0.7152f;
    static constexpr float Wb = 0.0722f;
    static constexpr float inv255 = 1.0f / 255.0f;

    float r = Wr * ((float) src.x) * inv255;
    float g = Wg * ((float) src.y) * inv255;
    float b = Wb * ((float) src.z) * inv255;

    return r + g + b;
}

as it turns out, dividing by 255.0f was the fatal flaw. What are the assumptions made about the CV_32FC1 data type? Typically when I think about floating point color values, I assume they are in the range [0, 1] (this is the expectation for OpenGL at least).

I couldn't really find any explicit documentation on what the value ranges are, do such expectations exist in OpenCV? For example, if I wanted to use CV_32FC3 for RGB values, do these values need to be in [0, 1]?

Thank you for any guidance on what the OpenCV assumptions about image values are. The main reason I was avoiding using OpenCV to do anything directly was because

  1. The data was already on the GPU, and I'm not assuming users of the code have the CUDA backend for OpenCV installed.
  2. My understanding is OpenCV demands column-major BGRA storage. My data comes in from the device as row-major RGBA.
2017-12-07 20:34:13 -0600 received badge  Scholar (source)
2017-12-07 20:34:09 -0600 received badge  Supporter (source)
2017-12-06 22:32:25 -0600 received badge  Student (source)
2017-12-06 19:43:24 -0600 asked a question why is CV_32FC1 not normalized to 0-1?

why is CV_32FC1 not normalized to 0-1? I needed to call an external CUDA library function that assumes the input data is