I'm editing my post by giving all the code I have until now. I'd like to write a program which "unravels" randomly and piece by piece a given image. At the moment, I'm using an image randomly created with Image[] (endImage), and I'm starting with a grey background (whitePart and beginImage). I divide the image in partNumber x partNumber parts (here 10):
partNumber = 10;
allParts = Flatten[Outer[List, Range[1, partNumber], Range[1, partNumber]], 1];
endImage = ImagePartition[
Image@RandomReal[1, {400, 400}]
,
400/partNumber];
whitePart = Image@Table[0.5, {400/partNumber}, {400/partNumber}];
beginImage = Table[whitePart, {partNumber}, {partNumber}];
(* After that, I create a random ordering of the unraveling of the parts with *)
replaceOrdering = RandomSample[allParts];
(* Then, a short function which replaces beginImage
part number indexNumber
with endImage
part indexNumber
: *)
replacePartWithNumber[tableOfParts_, indexNumber_] :=
ReplacePart[tableOfParts,
replaceOrdering[[indexNumber]] ->
endImage[[Apply[Sequence, replaceOrdering[[indexNumber]]]]]]
(* Creation of the list with recursion: *)
stage[1] = replacePartWithNumber[ beginImage, 1];
stage[n_] := replacePartWithNumber[stage[n - 1], n]
(* which finally gives the Animate
command: *)
Animate[
ImageAssemble@stage[n]
,
{n, 1, Length@replaceOrdering, 1}
, DefaultDuration -> 10
, AnimationRepetitions -> 1]
This works for values of partNumber
till ca. 25. But with partNumber = 40
or =50
, Mathematica crashes immediately...
Any idea why this is? Any help greatly appreciated!
sequence
is defined. $\endgroup$ – m_goldberg Nov 19 '13 at 8:56sequence
? Your error message does not seem to be memory-related, are the frames generated by a function or issequence
an array of images? $\endgroup$ – Yves Klett Nov 19 '13 at 8:56n = 0
. Perhaps that's what's wrong... $\endgroup$ – cormullion Nov 19 '13 at 9:58n=1
, Mathematica still crashes... $\endgroup$ – Gabriel Nov 19 '13 at 10:01