# 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).

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.

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.

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

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...

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.

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

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:

http://answers.opencv.org/question/30...

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.

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?

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

@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.