# why we do reshape to the matrix of an image before doing pca

Hi. i am trying to implement PCA algorithm on an image but as i was searching i found many do reshaping to the matrix (image). i understand the concept of the PCA but when it comes to the implementation i don't know what's the benefit of reshaping the image. as far as i know reshaping matrix is like resizing the matrix. another question. when i reshape a matrix of 3x3 to 3x1. that means i lost information (i lost 2 columns).

edit retag close merge delete

it's a bit sad, you deleted your last question, because a lot of "context" might be missing here, now.

is this still in the context of "fmri images", where you got like 3d (additional z or time axis) data ?

then, it would make a lot of sense, to reshape each individual image to an 1d vector, stack all of them into a 2d matrix, and then, shorten the rows using pca.

( 2017-11-16 10:06:31 -0500 )edit

If you have 3D data, have you tried getting the properties of the isosurface? Not sure if OpenCV handles 3D triangle meshes, so you're possibly going to have to write your own code. I have a Marching Cubes implementation, if you're interested in that. Getting the isosurface properties is a matter of linear algebra: getting the triangle area and triangle volume element is pretty straightforward.

( 2017-11-16 10:13:14 -0500 )edit

@sjhalayka, this is is not a 3d "rendering" question, you confused something

( 2017-11-16 10:18:42 -0500 )edit

I'm not talking about rendering, but conversion from float to triangle, and the measurement of that result.

See the triangle area and volume element on this page: https://math.oregonstate.edu/home/pro...

( 2017-11-16 10:27:13 -0500 )edit
1

i deleted the last question because i figured it out. but this is another question. all i want to know what reshape function do ? and how does it work mathematically ? because i saw many people using it.

( 2017-11-16 10:58:58 -0500 )edit

@sjhalayka -- triangles ? where on earth did you infer, this is about triangles ?

( 2017-11-16 11:01:48 -0500 )edit

Sightless people "see" by touching the 2D surface of a 3D object. Properties like area, volume, and curvature are what they rely on. Perhaps that's outside the realm of computer vision right now, but it shouldn't be.

I found an old question that looks for the 3D "contour" (the isosurface), where the isosurface is not a 1D curved line, but rather a 2D curved surface:

There are desktop 3D printers for cheap these days. No longer are sightless people restricted to reality. They have algorithms to extract the surface of an unborn baby in the womb. Imagine printing that out for a sightless mother. Granted, there aren't a whole lot of sightless mothers, but they still do count. Sighted mothers count too, I suppose.

( 2017-11-16 11:18:54 -0500 )edit

P.S. From what I can see on google (http://answers.opencv.org/question/32...), triangulations can be made from point set data. I'm not sure if this is just for converting an open surface into triangles, or if it can also be used to convert a closed surface into triangles (producing an air tight surface, with no holes). One can always extrude the open surface to make a closed surface too. Please don't blame me for not knowing for sure what OpenCV supports; the documentation is impenetrable; should OpenCV publish their unit test code?

( 2017-11-16 14:56:02 -0500 )edit

One could always encode colour using surface roughness. Rainbow Braille. Colour can encode any one of many possible properties.

( 2017-11-17 10:23:51 -0500 )edit

@sjhalayka, must say, i'm halfway impressed by your persistance, but please take another look at the title of this question --- you entirely went off the rails here.

( 2017-11-17 11:04:03 -0500 )edit

Sort by ยป oldest newest most voted

When you have too much data and you are going to use intensive algorithm such as training of classifier or clustering on the data. You will require too much time to process the data. If you use the pca or reshaping, It will get rid of redundancy as well as not useful data.

more

Official site

GitHub

Wiki

Documentation

## Stats

Asked: 2017-11-16 09:05:39 -0500

Seen: 216 times

Last updated: Nov 16 '17