Problem of large adjacency matrix

Hi,
I need to deal with a very large adjacency matrix in Matlab, i have a image matrix of size 321x481, and i want te generate the adjacency matrix from this image, its size is 321*481 x 321*481, but matlab give the message error Out of memory, can anybody give me a solution o that. My code is like that:
I= imread(Myimage);
A= Adjaceny_Matrix(I);
My treatement
Thank a Lot.

답변 (2개)

John D'Errico
John D'Errico 2015년 10월 11일

0 개 추천

Just wanting to solve a large problem is not enough.
You lack sufficient memory. What is the size of that matrix?
321*481 * 321*481*8
ans =
1.9072e+11
So roughly 190 GIGABYTES of memory. Be careful not to make a copy of that matrix along the way too.
Computers are not infinitely large or infinitely fast.
Walter Roberson
Walter Roberson 2015년 10월 11일

0 개 추천

You can use a sparse() array. Each entry is connected to 8 others if you are using standard 8-connectivity and you should be able to fit that easily.
However I recommend you reconsider whether you really need the adjacency matrix. For any one entry, the connected elements can be calculated fairly easily: for logical index K on the interior of the matrix, the logical index of the entry "above" is K-1, below is K+1, left is K-321, right is K+321, and diagonals are K-322, K+320, K-320, K+322 . With the connections easily calculated it does not seem appropriate to use a lot of memory to store them.

댓글 수: 1

Mourchid
Mourchid 2015년 10월 11일
편집: Mourchid 2015년 10월 11일
Thank you Wlater Roberson for your respense, can you please give me the matlab code to doing it. for example i have the matlab code:
I=imread(Myimage); what i will do after ?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

2015년 10월 11일

편집:

2015년 10월 11일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by