Reading Image Sequence from CSV

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Reading Image Sequence from CSV

Brian Feeny
I have a CSV file of 28000 images.

Each image is a row with 784 comma separated 8-bit values, so it looks like:

row0: 0, 255, 128, 100, 98, etc


This is MNIST data in this format.  I have tried to Input Raw, and tell it 28x28, 8-bit, offsets, etc  but it does not seem to display properly

Please let me know what to try, this is a very basic format, each cell is a 0-255 coded pixel, 784 entries per line, each line is a separate image.

Brian

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Reading Image Sequence from CSV

Michael Schmid
Hi Brian,

Import>Raw opens images with Binary data. If you have ascii data, you need Import>Text Image. This will read each line or the text into one row of pixels, however.

Here is a short macro that converts it to 28x28 pixels via saving and reading:

filename=getDirectory("temp")+"temp-784-to-28x28.raw";
setMinAndMax(0, 255);
run("8-bit");
saveAs("Raw Data", filename);
run("Raw...", "open=["+filename+"] image=8-bit width=28 height=28 offset=0 number=0 gap=0 little-endian"); //should be one line starting with 'run("Raw...",'


Michael
________________________________________________________________
On Dec 1, 2012, at 03:30, Brian Feeny wrote:

> I have a CSV file of 28000 images.
>
> Each image is a row with 784 comma separated 8-bit values, so it looks like:
>
> row0: 0, 255, 128, 100, 98, etc
>
>
> This is MNIST data in this format.  I have tried to Input Raw, and tell it 28x28, 8-bit, offsets, etc  but it does not seem to display properly
>
> Please let me know what to try, this is a very basic format, each cell is a 0-255 coded pixel, 784 entries per line, each line is a separate image.
>
> Brian
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Reading Image Sequence from CSV

Brian Feeny
Will this method work with a file that has a sequence of images?  My file has 28000 lines, each line is an image.

Brian

On Dec 3, 2012, at 3:56 AM, Michael Schmid <[hidden email]> wrote:

> Hi Brian,
>
> Import>Raw opens images with Binary data. If you have ascii data, you need Import>Text Image. This will read each line or the text into one row of pixels, however.
>
> Here is a short macro that converts it to 28x28 pixels via saving and reading:
>
> filename=getDirectory("temp")+"temp-784-to-28x28.raw";
> setMinAndMax(0, 255);
> run("8-bit");
> saveAs("Raw Data", filename);
> run("Raw...", "open=["+filename+"] image=8-bit width=28 height=28 offset=0 number=0 gap=0 little-endian"); //should be one line starting with 'run("Raw...",'
>
>
> Michael
> ________________________________________________________________
> On Dec 1, 2012, at 03:30, Brian Feeny wrote:
>
>> I have a CSV file of 28000 images.
>>
>> Each image is a row with 784 comma separated 8-bit values, so it looks like:
>>
>> row0: 0, 255, 128, 100, 98, etc
>>
>>
>> This is MNIST data in this format.  I have tried to Input Raw, and tell it 28x28, 8-bit, offsets, etc  but it does not seem to display properly
>>
>> Please let me know what to try, this is a very basic format, each cell is a 0-255 coded pixel, 784 entries per line, each line is a separate image.
>>
>> Brian
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html