4 deleted 439 characters in body
source | link

I have a large set (>10000) of uncompressed 8 bit images. Their size is 1600*1200 pixels.

The first 24 pixels in the upper most line starting from left contain some important information (time stamp etc.) about the image.

I want to read out all byte values of these 24 pixels.

Finally I want to save all byte data as right aligned numbers into a text file, a single line with 24 numbers for each image.

I CANNOT READ IN ALL IMAGES INTO THE MEMORY AT ONCE BECAUSE OF MEMORY PROBLEMS.

For testing I have uploaded a set of 1000 cropped images, each having a dimension of 50*50 pixels. They can be downloaded from here: https://drive.google.com/open?id=0B9wKP6yNcpyfUUlsQU1iVWJ0b2M

I have two questions:

- howHow can I improve (speed up) my code?

- what is the most straightforward solution to save the byte values right aligned into a text file?

My code is:

ChoiceDialog[{FileNameSetter[Dynamic[imageDir], "Directory"], Dynamic[imageDir]}];
SetDirectory[imageDir];

fNames = FileNames["*.png"];
n = Length[fNames];

timeStampValues = Array[0 &, {n, 24}];
SetSharedVariable[timeStampValues];

ParallelDo[

   byteValues = Import[fNames[[i]], "Data"];
   timeStampValues[[i, All]] = Flatten@byteValues[[1, 1 ;; 24]];

   , {i, 1, n}
]; // AbsoluteTiming

{17.7253, Null}

(* Saving byte values into text file - can that be done easier?*)

formatted = Map[NumberForm[#, {3, 0}, NumberPadding -> {" ", "0"}, 
   NumberPoint -> ""] &, timeStampValues, {2}]

Export[StringJoin[imageDir, "\\timeStampBytes.txt"], formatted, "Table"];

I have a large set (>10000) of uncompressed 8 bit images. Their size is 1600*1200 pixels.

The first 24 pixels in the upper most line starting from left contain some important information (time stamp etc.) about the image.

I want to read out all byte values of these 24 pixels.

Finally I want to save all byte data as right aligned numbers into a text file, a single line with 24 numbers for each image.

I CANNOT READ IN ALL IMAGES INTO THE MEMORY AT ONCE BECAUSE OF MEMORY PROBLEMS.

For testing I have uploaded a set of 1000 cropped images, each having a dimension of 50*50 pixels. They can be downloaded from here: https://drive.google.com/open?id=0B9wKP6yNcpyfUUlsQU1iVWJ0b2M

I have two questions:

- how can I improve (speed up) my code?

- what is the most straightforward solution to save the byte values right aligned into a text file?

My code is:

ChoiceDialog[{FileNameSetter[Dynamic[imageDir], "Directory"], Dynamic[imageDir]}];
SetDirectory[imageDir];

fNames = FileNames["*.png"];
n = Length[fNames];

timeStampValues = Array[0 &, {n, 24}];
SetSharedVariable[timeStampValues];

ParallelDo[

   byteValues = Import[fNames[[i]], "Data"];
   timeStampValues[[i, All]] = Flatten@byteValues[[1, 1 ;; 24]];

   , {i, 1, n}
]; // AbsoluteTiming

{17.7253, Null}

(* Saving byte values into text file - can that be done easier?*)

formatted = Map[NumberForm[#, {3, 0}, NumberPadding -> {" ", "0"}, 
   NumberPoint -> ""] &, timeStampValues, {2}]

Export[StringJoin[imageDir, "\\timeStampBytes.txt"], formatted, "Table"];

I have a large set (>10000) of uncompressed 8 bit images. Their size is 1600*1200 pixels.

The first 24 pixels in the upper most line starting from left contain some important information (time stamp etc.) about the image.

I want to read out all byte values of these 24 pixels.

Finally I want to save all byte data as right aligned numbers into a text file, a single line with 24 numbers for each image.

I CANNOT READ IN ALL IMAGES INTO THE MEMORY AT ONCE BECAUSE OF MEMORY PROBLEMS.

For testing I have uploaded a set of 1000 cropped images, each having a dimension of 50*50 pixels. They can be downloaded from here: https://drive.google.com/open?id=0B9wKP6yNcpyfUUlsQU1iVWJ0b2M

How can I improve (speed up) my code?

ChoiceDialog[{FileNameSetter[Dynamic[imageDir], "Directory"], Dynamic[imageDir]}];
SetDirectory[imageDir];

fNames = FileNames["*.png"];
n = Length[fNames];

timeStampValues = Array[0 &, {n, 24}];
SetSharedVariable[timeStampValues];

ParallelDo[

   byteValues = Import[fNames[[i]], "Data"];
   timeStampValues[[i, All]] = Flatten@byteValues[[1, 1 ;; 24]];

   , {i, 1, n}
]; // AbsoluteTiming

{17.7253, Null}
3 added 73 characters in body
source | link

I have a large set (>10000) of uncompressed 8 bit images. Their size is 1600*1200 pixels.

The first 24 pixels in the upper most line starting from left contain some important information (time stamp etc.) about the image.

I want to read out all byte values of these 24 pixels.

Finally I want to save all byte data as right aligned numbers into a text file, a single line with 24 numbers for each image.

I CANNOT READ IN ALL IMAGES INTO THE MEMORY AT ONCE BECAUSE OF MEMORY PROBLEMS.

For testing I have uploaded a set of 1000 cropped images, each having a dimension of 50*50 pixels. They can be downloaded from here: https://drive.google.com/open?id=0B9wKP6yNcpyfUUlsQU1iVWJ0b2M

I have two questions:

- how can I improve (speed up) my code?

- how can Iwhat is the most straightforward solution to save the byte values right aligned into a text file?

My code is:

ChoiceDialog[{FileNameSetter[Dynamic[imageDir], "Directory"], Dynamic[imageDir]}];
SetDirectory[imageDir];

fNames = FileNames["*.png"];
n = Length[fNames];

timeStampValues = Array[0 &, {n, 24}];
SetSharedVariable[timeStampValues];

ParallelDo[

   byteValues = Import[fNames[[i]], "Data"];
   timeStampValues[[i, All]] = Flatten@byteValues[[1, 1 ;; 24]];

   , {i, 1, n}
]; // AbsoluteTiming

{17.7253, Null}

(* Saving byte values into text file - can that be done easier?*)

Export[StringJoin[imageDirformatted = Map[NumberForm[#, "\\timeStampBytes.txt"]{3, 0}, NumberPadding -> {" ", "0"}, 
   FlattenNumberPoint /@-> timeStampValues""] &, "Table"]timeStampValues, //{2}]

Export[StringJoin[imageDir, Import"\\timeStampBytes.txt"], //formatted, Dimensions"Table"];

The exported file containes the numbers in columns, but they are left aligned.

I have a large set (>10000) of uncompressed 8 bit images. Their size is 1600*1200 pixels.

The first 24 pixels in the upper most line starting from left contain some important information (time stamp etc.) about the image.

I want to read out all byte values of these 24 pixels.

Finally I want to save all byte data as right aligned numbers into a text file, a single line with 24 numbers for each image.

I CANNOT READ IN ALL IMAGES INTO THE MEMORY AT ONCE BECAUSE OF MEMORY PROBLEMS.

For testing I have uploaded a set of 1000 cropped images, each having a dimension of 50*50 pixels. They can be downloaded from here: https://drive.google.com/open?id=0B9wKP6yNcpyfUUlsQU1iVWJ0b2M

I have two questions:

- how can I improve (speed up) my code?

- how can I save the byte values right aligned into a text file?

My code is:

ChoiceDialog[{FileNameSetter[Dynamic[imageDir], "Directory"], Dynamic[imageDir]}];
SetDirectory[imageDir];

fNames = FileNames["*.png"];
n = Length[fNames];

timeStampValues = Array[0 &, {n, 24}];
SetSharedVariable[timeStampValues];

ParallelDo[

   byteValues = Import[fNames[[i]], "Data"];
   timeStampValues[[i, All]] = Flatten@byteValues[[1, 1 ;; 24]];

   , {i, 1, n}
]; // AbsoluteTiming

{17.7253, Null}

(* Saving into text file *)

Export[StringJoin[imageDir, "\\timeStampBytes.txt"], 
   Flatten /@ timeStampValues, "Table"] // Import // Dimensions

The exported file containes the numbers in columns, but they are left aligned.

I have a large set (>10000) of uncompressed 8 bit images. Their size is 1600*1200 pixels.

The first 24 pixels in the upper most line starting from left contain some important information (time stamp etc.) about the image.

I want to read out all byte values of these 24 pixels.

Finally I want to save all byte data as right aligned numbers into a text file, a single line with 24 numbers for each image.

I CANNOT READ IN ALL IMAGES INTO THE MEMORY AT ONCE BECAUSE OF MEMORY PROBLEMS.

For testing I have uploaded a set of 1000 cropped images, each having a dimension of 50*50 pixels. They can be downloaded from here: https://drive.google.com/open?id=0B9wKP6yNcpyfUUlsQU1iVWJ0b2M

I have two questions:

- how can I improve (speed up) my code?

- what is the most straightforward solution to save the byte values right aligned into a text file?

My code is:

ChoiceDialog[{FileNameSetter[Dynamic[imageDir], "Directory"], Dynamic[imageDir]}];
SetDirectory[imageDir];

fNames = FileNames["*.png"];
n = Length[fNames];

timeStampValues = Array[0 &, {n, 24}];
SetSharedVariable[timeStampValues];

ParallelDo[

   byteValues = Import[fNames[[i]], "Data"];
   timeStampValues[[i, All]] = Flatten@byteValues[[1, 1 ;; 24]];

   , {i, 1, n}
]; // AbsoluteTiming

{17.7253, Null}

(* Saving byte values into text file - can that be done easier?*)

formatted = Map[NumberForm[#, {3, 0}, NumberPadding -> {" ", "0"}, 
   NumberPoint -> ""] &, timeStampValues, {2}]

Export[StringJoin[imageDir, "\\timeStampBytes.txt"], formatted, "Table"];
2 edited body; edited tags
source | link

I have a large set (>10000) of uncompressed 8 bit images. Their size is 1600*1200 pixels.

The first 24 pixels in the upper most line starting from left contain some important information (time stamp etc.) about the image.

I want to read out all byte vlauesvalues of these 24 pixels.

Finally I want to save all byte data as right alignesaligned numbers into a text file, a single line with 24 numbers for each image.

I CANNOT READ IN ALL IMAGES INTO THE MEMORY AT ONCE BECAUSE OF MEMORY PROBLEMS.

For testing I have uploaded a set of 1000 cropped images, each having a dimension of 50*50 pixels. They can be downloaded from here: https://drive.google.com/open?id=0B9wKP6yNcpyfUUlsQU1iVWJ0b2M

I have two questions:

- how can I improve (speed up) my code?

- how can I save the byte values right aligned into a text file?

My code is:

ChoiceDialog[{FileNameSetter[Dynamic[imageDir], "Directory"], Dynamic[imageDir]}];
SetDirectory[imageDir];

fNames = FileNames["*.png"];
n = Length[fNames];

timeStampValues = Array[0 &, {n, 24}];
SetSharedVariable[timeStampValues];

ParallelDo[

   byteValues = Import[fNames[[i]], "Data"];
   timeStampValues[[i, All]] = Flatten@byteValues[[1, 1 ;; 24]];

   , {i, 1, n}
]; // AbsoluteTiming

{17.7253, Null}

(* Saving into text file *)

Export[StringJoin[imageDir, "\\timeStampBytes.txt"], 
   Flatten /@ timeStampValues, "Table"] // Import // Dimensions

The exported file containes the numbers in columns, but they are left aligned.

I have a large set (>10000) of uncompressed 8 bit images. Their size is 1600*1200 pixels.

The first 24 pixels in the upper most line starting from left contain some important information (time stamp etc.) about the image.

I want to read out all byte vlaues of these 24 pixels.

Finally I want to save all byte data as right alignes numbers into a text file, a single line with 24 numbers for each image.

I CANNOT READ IN ALL IMAGES INTO THE MEMORY AT ONCE BECAUSE OF MEMORY PROBLEMS.

For testing I have uploaded a set of 1000 cropped images, each having a dimension of 50*50 pixels. They can be downloaded from here: https://drive.google.com/open?id=0B9wKP6yNcpyfUUlsQU1iVWJ0b2M

I have two questions:

- how can I improve (speed up) my code?

- how can I save the byte values right aligned into a text file?

My code is:

ChoiceDialog[{FileNameSetter[Dynamic[imageDir], "Directory"], Dynamic[imageDir]}];
SetDirectory[imageDir];

fNames = FileNames["*.png"];
n = Length[fNames];

timeStampValues = Array[0 &, {n, 24}];
SetSharedVariable[timeStampValues];

ParallelDo[

   byteValues = Import[fNames[[i]], "Data"];
   timeStampValues[[i, All]] = Flatten@byteValues[[1, 1 ;; 24]];

   , {i, 1, n}
]; // AbsoluteTiming

{17.7253, Null}

(* Saving into text file *)

Export[StringJoin[imageDir, "\\timeStampBytes.txt"], 
   Flatten /@ timeStampValues, "Table"] // Import // Dimensions

The exported file containes the numbers in columns, but they are left aligned.

I have a large set (>10000) of uncompressed 8 bit images. Their size is 1600*1200 pixels.

The first 24 pixels in the upper most line starting from left contain some important information (time stamp etc.) about the image.

I want to read out all byte values of these 24 pixels.

Finally I want to save all byte data as right aligned numbers into a text file, a single line with 24 numbers for each image.

I CANNOT READ IN ALL IMAGES INTO THE MEMORY AT ONCE BECAUSE OF MEMORY PROBLEMS.

For testing I have uploaded a set of 1000 cropped images, each having a dimension of 50*50 pixels. They can be downloaded from here: https://drive.google.com/open?id=0B9wKP6yNcpyfUUlsQU1iVWJ0b2M

I have two questions:

- how can I improve (speed up) my code?

- how can I save the byte values right aligned into a text file?

My code is:

ChoiceDialog[{FileNameSetter[Dynamic[imageDir], "Directory"], Dynamic[imageDir]}];
SetDirectory[imageDir];

fNames = FileNames["*.png"];
n = Length[fNames];

timeStampValues = Array[0 &, {n, 24}];
SetSharedVariable[timeStampValues];

ParallelDo[

   byteValues = Import[fNames[[i]], "Data"];
   timeStampValues[[i, All]] = Flatten@byteValues[[1, 1 ;; 24]];

   , {i, 1, n}
]; // AbsoluteTiming

{17.7253, Null}

(* Saving into text file *)

Export[StringJoin[imageDir, "\\timeStampBytes.txt"], 
   Flatten /@ timeStampValues, "Table"] // Import // Dimensions

The exported file containes the numbers in columns, but they are left aligned.

1
source | link