Ask Your Question
0

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

asked 2017-11-16 09:05:39 -0600

AhmedSh3ban gravatar image

updated 2017-11-16 09:22:52 -0600

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 flag offensive close merge delete

Comments

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.

berak gravatar imageberak ( 2017-11-16 10:06:31 -0600 )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.

sjhalayka gravatar imagesjhalayka ( 2017-11-16 10:13:14 -0600 )edit

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

berak gravatar imageberak ( 2017-11-16 10:18:42 -0600 )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...

sjhalayka gravatar imagesjhalayka ( 2017-11-16 10:27:13 -0600 )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.

AhmedSh3ban gravatar imageAhmedSh3ban ( 2017-11-16 10:58:58 -0600 )edit

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

berak gravatar imageberak ( 2017-11-16 11:01:48 -0600 )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:

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.

sjhalayka gravatar imagesjhalayka ( 2017-11-16 11:18:54 -0600 )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?

sjhalayka gravatar imagesjhalayka ( 2017-11-16 14:56:02 -0600 )edit

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

sjhalayka gravatar imagesjhalayka ( 2017-11-17 10:23:51 -0600 )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.

berak gravatar imageberak ( 2017-11-17 11:04:03 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-11-16 09:55:07 -0600

vps gravatar image

updated 2017-11-16 09:56:13 -0600

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.

edit flag offensive delete link more

Question Tools

1 follower

Stats

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

Seen: 476 times

Last updated: Nov 16 '17