extracting pixels value from an image

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

extracting pixels value from an image

rona baron
Hi all,

I used the thershold command to classify and count cells on my image. Then I
converted it into binary image (so all the objectes are set to 1...)
I would like to have a list with the pixels location and its intensity (1 or
0).
How do I do it?

Thanks
Rona
Reply | Threaded
Open this post in threaded view
|

Re: extracting pixels value from an image

David Webster
Rona,

Hmm! Someone asked a question like this a few weeks ago. I don't know about
existing plugins, but you can convert the code below to a macro. Do
Plugins/New/Macro, paste the code into the macro edit window, and then run
it using Macro/Run Macro.

David

for(x=0;x<getWidth();x++)
{
 for(y=0;y<getHeight();y++)
 {
  value = getPixel(x,y);
  print(x,y,value);
 }
}

On Thu, Jan 14, 2010 at 6:14 AM, rona baron <[hidden email]> wrote:

> Hi all,
>
> I used the thershold command to classify and count cells on my image. Then
> I
> converted it into binary image (so all the objectes are set to 1...)
> I would like to have a list with the pixels location and its intensity (1
> or
> 0).
> How do I do it?
>
> Thanks
> Rona
>
Reply | Threaded
Open this post in threaded view
|

Re: extracting pixels value from an image

Mike Cowperthwaite
That will certainly work to print out a list, but I have to say: I
cannot imagine any real situation where such a list would be actually
useful.  No human wants to read a big bunch of numbers, and the
printed-out version is of no use to the computer.

Broadly speaking, the binary image *is* a list of the pixels.  (Yes, I
know, it's an array not a list; shut up, geeks.)  The real question is,
what purpose would such a list be put to?  Better advice can be
dispensed with a proper understanding of the problem.


On 14-Jan-10 9:56 am, David Webster wrote:

> Hmm! Someone asked a question like this a few weeks ago. I don't know about
> existing plugins, but you can convert the code below to a macro. Do
> Plugins/New/Macro, paste the code into the macro edit window, and then run
> it using Macro/Run Macro.
>
> for(x=0;x<getWidth();x++)
> {
>   for(y=0;y<getHeight();y++)
>   {
>    value = getPixel(x,y);
>    print(x,y,value);
>   }
> }
>
>
> On Thu, Jan 14, 2010 at 6:14 AM, rona baron wrote:
>
>> Hi all,
>>
>> I used the thershold command to classify and count cells on my image. Then
>> I converted it into binary image (so all the objectes are set to 1...)
>> I would like to have a list with the pixels location and its intensity (1
>> or 0).
>> How do I do it?

--
Mike Cowperthwaite
Lathrop Engineering, San Jose CA
Reply | Threaded
Open this post in threaded view
|

Re: extracting pixels value from an image

Madeline Pool
I'm guessing here about the actual desired data but if you wanted locations for the objects (which would probably be more useful information than a list of zeros and ones), you could run "Analyze particles" with the "Record starts" and "Display results" options checked. If you wanted coordinates close to the centre of the objects, you could run "Find maxima" (in the "Process - Binary" submenu) before the "Analyze particles" command.

Madeline

On 2010-01-14, at 2:34 PM, Mike Cowperthwaite wrote:

> That will certainly work to print out a list, but I have to say: I
> cannot imagine any real situation where such a list would be actually
> useful.  No human wants to read a big bunch of numbers, and the
> printed-out version is of no use to the computer.
>
> Broadly speaking, the binary image *is* a list of the pixels.  (Yes, I
> know, it's an array not a list; shut up, geeks.)  The real question is,
> what purpose would such a list be put to?  Better advice can be
> dispensed with a proper understanding of the problem.
>
>
> On 14-Jan-10 9:56 am, David Webster wrote:
>> Hmm! Someone asked a question like this a few weeks ago. I don't know about
>> existing plugins, but you can convert the code below to a macro. Do
>> Plugins/New/Macro, paste the code into the macro edit window, and then run
>> it using Macro/Run Macro.
>>
>> for(x=0;x<getWidth();x++)
>> {
>>  for(y=0;y<getHeight();y++)
>>  {
>>   value = getPixel(x,y);
>>   print(x,y,value);
>>  }
>> }
>>
>>
>> On Thu, Jan 14, 2010 at 6:14 AM, rona baron wrote:
>>
>>> Hi all,
>>>
>>> I used the thershold command to classify and count cells on my image. Then
>>> I converted it into binary image (so all the objectes are set to 1...)
>>> I would like to have a list with the pixels location and its intensity (1
>>> or 0).
>>> How do I do it?
>
> --
> Mike Cowperthwaite
> Lathrop Engineering, San Jose CA
Reply | Threaded
Open this post in threaded view
|

Re: extracting pixels value from an image

puzzlebobble
In reply to this post by Mike Cowperthwaite
Hi Mike,

David's suggestion looks good to me. For each pixel it prints the x location, the y location and the value of the pixels "(print x, y, value)" which is what it reads to me you asked for.

If you wanted to rearrange the data after that then it would be quite easy (at least in java; I've no personal experience of using macros).

BW