What is the dimension of the array representing a BGR image ?
According to documentation, a BGR image is represented this way in OpenCV:
My question: what is the dimension of the array displayed by this picture ?
n * m floats or n * m * 3 uchars, because a float has 32 bits and one uchar has 8 bits, so 3 uchars are 32 bits
Thank you. But in each column there are 3 subcolumns, so ... ?
yes, if you have a union, the 3 uchars are occupying the same memory as the 1 float: 32 b. So
m * n * sizeof(float) == m * n * 3 * sizeof(uchar)
, it depends on how you interpret the memoryThank you for the precision. When I run image.shape (in Numpy) I get as a dimension 3.
Strange, how does your image look like? or what code line exactly you have used? because according to the docs you shall get something like (n, m) ...
@thdrksdfthmn Sorry, I mean image.ndim gives 3 not 2
What are you using? Python? isn't ndim equivalent to channels from C++? If so, then you have 3 channels (R, G, B, or B, G, R)