Ask Your Question

oralb's profile - activity

2018-03-04 14:14:11 -0600 marked best answer Complex number matrix in OpenCV (Java)

Hello

I am working on image data and the end goal is to use fourier transform on a product of the data and some complex matrix.

  • CV_64FC1 1000x1000 matrix of grayscaled image data (I have this)

  • Secondary 1000x1000 matrix of complex numbers (I don't have this)

The first matrix will multiply with the second complex matrix and after that I will use a fourier transform on it

Is there a way of doing this in OpenCV?

edit:

// image matrix
Bitmap bitmap_image = ...
Mat matrix = new Mat(1000, 1000, CvType.CV_64FC1);
Utils.bitmapToMat(bitmap_image, matrix); 
Imgproc.cvtColor(matrix, matrix, Imgproc.COLOR_RGBA2GRAY);
matrix.convertTo(matrix, CvType.CV_64FC1, 1.0/255.0); // type when initialised is ignored
// secondary matrix
Mat secondary_matrix = new Mat(1000, 1000, CvType.CV_64FC1);
for (int i=0; i<1000; i++) {
    for (int j=0; j<1000; j++) {
        // ... do some stuff to get value
        secondary matrix.put(i,j,value);
    }
}
// now need to make secondary matrix complex by multiplying by some function of i

edit2:

Context: I have a hologram image in OpenCV matrix form (single channel), I have another matrix filled with real numbers (single channel) - this matrix represents the sampling period in the spatial domain. This latter matrix isn't used directly, it passes through an e^(i*...) function to make the values complex. Finally, a discrete fourier transform is applied on the per-element product of the image data and this complex matrix I just described.

2018-03-04 14:09:42 -0600 answered a question Complex number matrix in OpenCV (Java)

Essentially the answer to creating a complex matrix in OpenCV is to use 2 channels. In a 2 channel matrix, separate the

2018-03-04 12:26:58 -0600 commented answer Best way to apply a function to each element of Mat (Android)

I've got it now, it gets the whole image starting from 0,0 and sticks it in the array. For my case I needed a double[] a

2018-03-04 12:26:57 -0600 marked best answer Best way to apply a function to each element of Mat (Android)

Hello,

I've seen the thread here with the same request but the two main answers were to use pointers and to use parallel methods. Neither are really available on the Android implementation of OpenCV.

What would be the fastest way to apply a function like sin(pi/k * element^2) on Android OpenCV and then insert that value into another matrix?

edit: related question: is it faster to collect elements in a Java array first and then insert all of them at once as a row instead of individually with .put()

2018-03-04 12:26:57 -0600 received badge  Scholar (source)
2018-03-04 11:43:45 -0600 commented question Best way to apply a function to each element of Mat (Android)

I've just seen this answer which answers some of my questions

2018-03-04 11:40:14 -0600 commented question Best way to apply a function to each element of Mat (Android)

@berak, confirming that you mean collect as a row right? Or can I collect all elements in some kind of multi-dimensional

2018-03-04 11:39:19 -0600 commented answer Best way to apply a function to each element of Mat (Android)

Is this get operation retrieving an entire row/column or just one element? Would I stick the .get() in a loop that itera

2018-03-04 10:57:58 -0600 edited question Best way to apply a function to each element of Mat (Android)

Best way to apply a function to each element of Mat (Android) Hello, I've seen the thread here with the same request bu

2018-03-03 14:11:24 -0600 received badge  Supporter (source)
2018-03-03 14:02:00 -0600 edited question Best way to apply a function to each element of Mat (Android)

Best way to apply a function to each element of Mat (Android) Hello, I've seen the thread here with the same request bu

2018-03-03 13:59:02 -0600 edited question Best way to apply a function to each element of Mat (Android)

Best way to apply a function to each element of Mat (Android) Hello, I've seen the thread here with the same request bu

2018-03-03 13:58:37 -0600 asked a question Best way to apply a function to each element of Mat (Android)

Best way to apply a function to each element of Mat (Android) Hello, I've seen the thread here with the same request bu

2018-03-02 16:14:14 -0600 received badge  Student (source)
2018-03-02 10:02:11 -0600 edited question Complex number matrix in OpenCV (Java)

Complex number matrix in OpenCV (Java) Hello I am working on image data and the end goal is to use fourier transform on

2018-03-02 08:39:28 -0600 commented question Complex number matrix in OpenCV (Java)

@berak, If you tell me what kind of code to show you, I can help you to help me!

2018-03-01 16:27:18 -0600 edited question Complex number matrix in OpenCV (Java)

Complex number matrix in OpenCV (Java) Hello I am working on image data and the end goal is to use fourier transform on

2018-03-01 15:34:56 -0600 commented question Complex number matrix in OpenCV (Java)

@berak, yep (2) is the reason I made this thread. Interesting you mention the center because currently, in-the-software-

2018-03-01 15:10:25 -0600 commented question Complex number matrix in OpenCV (Java)

per-element, MATLAB might be silly but at least it works ;)

2018-03-01 15:09:33 -0600 commented question Complex number matrix in OpenCV (Java)

@berak, I don't know what more context you want... I am trying to perform a hologram reconstruction using fresnel algori

2018-03-01 14:56:44 -0600 commented question Complex number matrix in OpenCV (Java)

@berak, So I need 2 channels for the imaginary and real part each. How would I do something like this then: [1 2 3 4]

2018-03-01 14:56:03 -0600 commented question Complex number matrix in OpenCV (Java)

@berak, So I need 2 channels for the imaginary and real part each. How would I do something like this then: [1 2 3 4]

2018-03-01 14:55:19 -0600 commented question Complex number matrix in OpenCV (Java)

@berak, So I need 2 channels for the imaginary and real part each. How would I do something like this then: 1 2 3 4 2

2018-03-01 14:37:35 -0600 commented question Complex number matrix in OpenCV (Java)

@berak, Where do you see the 2 channel matrix? I am converting code from MATLAB to Java, in MATLAB it's really easy to h

2018-03-01 14:37:25 -0600 commented question Complex number matrix in OpenCV (Java)

Where do you see the 2 channel matrix? I am converting code from MATLAB to Java, in MATLAB it's really easy to have a ma

2018-03-01 13:51:56 -0600 commented question Complex number matrix in OpenCV (Java)

@berak, silly of me to forget to show it - i've updated it now. The secondary matrix will be made complex, then multipli

2018-03-01 13:51:10 -0600 edited question Complex number matrix in OpenCV (Java)

Complex number matrix in OpenCV (Java) Hello I am working on image data and the end goal is to use fourier transform on

2018-03-01 13:49:53 -0600 received badge  Editor (source)
2018-03-01 13:49:53 -0600 edited question Complex number matrix in OpenCV (Java)

Complex number matrix in OpenCV (Java) Hello I am working on image data and the end goal is to use fourier transform on

2018-03-01 13:11:48 -0600 asked a question Complex number matrix in OpenCV (Java)

Complex number matrix in OpenCV (Java) Hello I am working on image data and the end goal is to use fourier transform on