Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9535 > unrolled thread

Image Processing Pixel Values Export Question

Started byPhysica <oren.sternberg@gmail.com>
First post2012-04-10 06:27 +0000
Last post2012-04-11 22:16 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Image Processing Pixel Values Export Question Physica <oren.sternberg@gmail.com> - 2012-04-10 06:27 +0000
    Re: Image Processing Pixel Values Export Question David Bailey <dave@removedbailey.co.uk> - 2012-04-11 22:16 +0000

#9535 — Image Processing Pixel Values Export Question

FromPhysica <oren.sternberg@gmail.com>
Date2012-04-10 06:27 +0000
SubjectImage Processing Pixel Values Export Question
Message-ID<jm0jt9$adb$1@smc.vnet.net>
Hello,

I am trying to store a bunch of values (pixels) into a file everything
seems ok until I try to push the value to XLS file the XLS file just
stores the variable name instead of the values. Can someone help me
with pushing the right values

Codes loads a movie (H264) records the pixels of one channel and
stores the values per frame, then it supposed to store the values into
xls file


----------------------------------------------------

(* Import Video *)
VideoL = Import[
   "D:\\experiment\\XYZ.mov", {{"BitDepth", "ColorSpace",
     "Duration", "FrameCount", "FrameRate", "ImageSize",
     "VideoEncoding"}}];

FrameCount = VideoL[[4]];
(* Enter how many frames you wish to load *)
nFrames = Array[0 + # &, 3];
lFrames = Length[nFrames]
(* Reload Image*)
h = Import[
   "D:\\experiment\\XYZ.mov", {"QuickTime", "Frames", nFrames}];
(* jCount = 1;
iCount = 1;
PixelValues = ImageData[h[[jCount]]][[170, 101]][[iCount]]; *)
Table[PV[i], {i, 1, lFrames, 1}];

For[i = 1, i <= lFrames, i++,
 PV[i] = ImageData[h[[i]]][[170, 101]][[1]]]

Export["mfile.xls", PV, "XLS"]



[toc] | [next] | [standalone]


#9560

FromDavid Bailey <dave@removedbailey.co.uk>
Date2012-04-11 22:16 +0000
Message-ID<jm4vs1$2je$1@smc.vnet.net>
In reply to#9535
On 10/04/2012 07:27, Physica wrote:
> Hello,
>
> I am trying to store a bunch of values (pixels) into a file everything
> seems ok until I try to push the value to XLS file the XLS file just
> stores the variable name instead of the values. Can someone help me
> with pushing the right values
>
> Codes loads a movie (H264) records the pixels of one channel and
> stores the values per frame, then it supposed to store the values into
> xls file
>
>
> ----------------------------------------------------
>
> (* Import Video *)
> VideoL = Import[
>     "D:\\experiment\\XYZ.mov", {{"BitDepth", "ColorSpace",
>       "Duration", "FrameCount", "FrameRate", "ImageSize",
>       "VideoEncoding"}}];
>
> FrameCount = VideoL[[4]];
> (* Enter how many frames you wish to load *)
> nFrames = Array[0 + #&, 3];
> lFrames = Length[nFrames]
> (* Reload Image*)
> h = Import[
>     "D:\\experiment\\XYZ.mov", {"QuickTime", "Frames", nFrames}];
> (* jCount = 1;
> iCount = 1;
> PixelValues = ImageData[h[[jCount]]][[170, 101]][[iCount]]; *)
> Table[PV[i], {i, 1, lFrames, 1}];
>
> For[i = 1, i<= lFrames, i++,
>   PV[i] = ImageData[h[[i]]][[170, 101]][[1]]]
>
> Export["mfile.xls", PV, "XLS"]
>
>
>
>
Your code defines a function PV, rather than an array (there may be 
other problems as well, I have not tested it). Try:

PV=Table[ImageData[h[[i]]][[170, 101]][[1]]],{i,1,lFrames}]

Note that PV[i]=... defines a function.
PV[[i]]=... sets an element of an array stored in PV (but PV must 
already be initialised with an array - e.g. using ConstantArray.

Finally, it seems rather strange to store pixel values in an XL file - 
is there a reason for doing this, rather than writing them to a text 
file (or even a binary file, for maximum speed). Exporting to XL will 
certainly be slower, and if you are processing video, performance is 
likely to be important!

David Bailey
http://www.dbaileyconsultancy.co.uk

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web