Create DenseMatrix with more than two dimensions

177 views
Skip to first unread message

Fonso

unread,
Jan 4, 2016, 12:58:08 PM1/4/16
to Scala Breeze
Hi.

I am a newbie in Scala and breeze and my question probably will be very silly but I couldn't a solution.

I work with images and apply different algorithms to them in order to analyse his content. I need to create matrix with more of two dimensions, the objective is store for each pixel the result of different algorithms, by example: create a 512x512x4 matrix.

I tried to used DenseMatrix to create the matrix but I obtain the error: error: overloaded method constructor DenseMatrix with alternatives: cannot be applied to (Int, Int, Int).

Is there some way in breeze to create this type of matrix?

Thanks in advance.


David Hall

unread,
Jan 4, 2016, 12:58:55 PM1/4/16
to scala-...@googlegroups.com
breeze doesn't have higher-order tensors right now, sorry.

It comes up a lot and I'd love to have them, but I haven't gotten there yet, and nor has anyone else.

-- David

--
You received this message because you are subscribed to the Google Groups "Scala Breeze" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-breeze...@googlegroups.com.
To post to this group, send email to scala-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scala-breeze/311b6b0a-734f-4528-9f1e-967e37dbb758%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Fonso

unread,
Jan 5, 2016, 6:39:23 AM1/5/16
to Scala Breeze
Thanks for the answer.

Best regards.

Fonso

unread,
Jan 14, 2016, 1:00:43 PM1/14/16
to Scala Breeze
One thing I can make in my problem in order to be able to use Breeze, it is the final three dimensional matrix can be calculate combining different two dimensional matrix. By example:

IM(512,512) -> original image

IM1(512,512) -> result of apply algorithm 1 to original image
IM2(512,512) -> result of apply algorithm 2 to original image
IM3(512,512) -> result of apply algorithm 3 to original image

RES(512,512,3) -> matrix with the results of all algorithms

RES(:,:,1)=IM1
RES(:,:,2)=IM2
RES(:,:,3)=IM3

My objective is use DenseMatrix to create IM1, IM2, IM3, then create RES like Array[Array[Array[Double]]] and finally convert them from DenseMatrix to two dimensional Array in order to assign them to RES. But I am not able to convert the DenseMatrix to two dimensional array. I know toArray makes it but I obtain an one dimensional array.

Is there some way or method to convert a DenseMatrix to two dimensional array of scala?

Thanks.

Reply all
Reply to author
Forward
0 new messages