So I have this problem that I want to make a 2d array to a dice format I can compare.
So if the 2d array is for example:
00100
02340
00500
00600
(0 = blank space)
would be:
image
So if you fold it in you get a dice. My problem is I need it in a format so I can compare if it's different from another dice.
For example:
00600
00500
04320
00100
Is the same as the other example, so I need it in a format where I can compare them. The rotation of numbers doesn't matter. Any ideas?
Related
I have a questions which is also mentioed in this answer and this one but I'm using the binary descriptor and need more informations:
I'm using BRAND descriptors as an input of LSH problem. The descriptor's size are 300*32 to 400*32, in which 32 is the length of the descriptor and images have 300 to 400 keypoints. The output of BRAND is a int matrix.
As this answer mentioned the inputs of LSH are vectors of D dimensions, it means every images will insert to the hash table as one vector of D dimension, now here are my question:
A. How can I convert the descriptor matrix of integers to a vector for input? Shall I just copy the matrix rows in sequence as a vector? OR Is it possible to convert each line of the descriptor, convert the items in binary and concatenate them to 256 bit binary and have a vector of D dimension of them?
B. Is it nessesary to convert the integer values of the BRAND descriptor to binary digits, in case of using L1 norm, that as far as I understood is the same Hamming distance for binary vectors?
Thank you very much in advance.
I have a 4d array of shape like this. It has total 18*100 = 1800 rows and 30 dimensional outputs per row
(18, 100, 30, 1, 1)
i want to convert or reshape this into 2d array, the easiest way
(1800,30)
Sorry for being so naive with numpy, but please i am a novice user. Any help much appreciated.
numpy.reshape(input_in_4D, (1800,30))
Of course this just converts the input in the default order (meaning you "unroll" the input array from inner to outer); if you need special ordering, you should read up on slicing.
You can use reshape method:
newArray = oldArray.reshape(1800,30)
Can someone explain the last line of this MatLab expression? I need to convert this to C++ and I do not have any experience in matlab syntax.
LUT = zeros(fix(Max - Min),1);
Bin= 1+LUT(round(Image));
Image is an input image, Min and Max are image minimum and maximum grey levels.
Is Bin going to be an array? What shall it contain? What are the dimensions, same as LUT or Image? What is the '1' stands for (add 1 to each member of array or a shift in array positions? I cannot find any example of this.
Thanks in advance.
LUT is a column vector that has a number of entries that is equal to the difference in maximum and minimum intensities in your image. LUT(round(Image)) retrieves the entries in your vector LUT which are given by the command round(Image). The dimension of Bin will be equal to the size of your matrix Image, and the entries will be equal to the corresponding indices from the LUT vector. So, say you have a 3x3 matrix Image, whose rounded values are as follows:
1 2 3
2 2 4
1 5 1
Then LUT(round(Image)) will return:
LUT(1) LUT(2) LUT(3)
LUT(2) LUT(2) LUT(4)
LUT(1) LUT(5) LUT(1)
And 1+LUT(round(Image)) will return:
1+LUT(1) 1+LUT(2) 1+LUT(3)
1+LUT(2) 1+LUT(2) 1+LUT(4)
1+LUT(1) 1+LUT(5) 1+LUT(1)
Note that this only works if all entries in round(Image) are positive, because you can't use zero/negative indexing in the LUT vector (or any MATLAB matrix/vector, for that matter).
I am looking at source code of Psychopy program, and I encountered the below line.
interpolateCones = scipy.interpolate.interp1d(wavelength_5nm, cones_SmithPokorny)
in which wavelength_5nm is a (1,81) vector and cones_SmithPokorny dimension is (3,81) and both of them contain predefined numbers.
I really cannot understand the meaning of interpolating with input parameters of non-equal dimensions. shouldn't cones_SmithPokorny be (1,81) too? why there is no error when I run the code?
interp1d has default value axis=-1, so the 1D interpolation is over the last axis.
I.e., there are 81 x-coordinates, and for each x-coordinate there are 3 y-values.
So it's not interpolating across unequal dimensions.
I have observations in vector form and I want to calculate the covariance matrix and the mean from these observations in OpenCV using calcCovarMatrix:
http://docs.opencv.org/modules/core/doc/operations_on_arrays.html
My current function call is:
calcCovarMatrix(descriptors.at(j).descriptor.t(), covar, mean, CV_COVAR_ROWS);
Whereas descriptors.at(j).descriptor.t() is one matrix with 2 columns and 390 rows. So my "random variables" are the rows of this matrix. The covar and mean are empty matrices.
The function calculates covar correctly and retuns a 390x390 matrix. But the mean is just a matrix with 1 row and 2 columns. I do not get this. I am expecting a matrix with 1 columnd and 390 rows (a column vector).
Am I using the wrong variant of the function? If yes, how should I use the correct variant in my case, I am specifically pointing to the value for the nsamples parameter. I don't know two what value to set it.