Image PixelS2

M.Oostrik's picture

For those who still use it here's a slightly modified Image PixelS plugin and an OpenCL patch with the same functionality.

The plugin is modified to have a clearer output. http://en.wikipedia.org/wiki/Grayscale

Also added a Boost input that multiplies the values

Xcode source included

Cheers!

PreviewAttachmentSize
IPS2.zip67.21 KB

monobrau's picture
Re: Image PixelS2

straaaakkk!

dust's picture
Re: Image PixelS2

nice ties, i do see people using pixelS that do not have open cl enabled machines. i think the most recent patch is the color centroid patch by jstreker and smorkis which pixelS plays an integral role in. i think most people have this plugin. i think a few people may use some of my plugs i don't know but i'm sure it feels nice to contribute and to see people using your work. i have a few answers to your questions.

sorry i couldn't get back to you today. had to present one of my groups finals i made with qc and java. i think it was the hardest project i have done so far. natural language process syntax with tangible physical computing as a programming language. sort of multi-touch with custom fiducials that make method statement when put together to drive animations etc. sort of noun verb adverb type of blocks made for kids. like noun is the object verb is action and adverb the modifier to the action.

hard to explain to explain but to make the long story longer. i got home got your message but fell asleep. hit me up tomorrow, i will be in air on my way to los angeles so should have time to discuss.

monobrau's picture
Re: Image PixelS2

Just wondering,

would it be possible to just output a structure with only the pixelnumbers that are for instance >0.5 in brightness? Would be nice for tracking purposes.

M.Oostrik's picture
Re: Image PixelS2

Yes indeed, used that functionality a lot.

Something like this?

PreviewAttachmentSize
PixelS2 CL Step.qtz25.51 KB

monobrau's picture
Re: Image PixelS2

This but then that the output structure only contains the pixelnumbers/locs that are currently >0.5, leaving the <0.5 out of the list.

Looping trough such a big structure with javascript trying find the 1's is quite heavy. If the opencl script would only output the active pixel locations it'll be a bit easier to process.

(oh, and with pixelnumbers I mean the output structure index number's)

M.Oostrik's picture
Re: Image PixelS2

That would be be a good addition for sure, but i don't think it can be done from the OpenCL patch in a straightforward way. As far as i know the dimensions of the output cannot be set from inside the patch.

It could be added to the plugin, but i doubt if this will help, giving the plugin is much slower than the CL patch.

M.Oostrik's picture
Re: Image PixelS2

Maybe it could be done with 2 CL patches. The first patch counting the amount of 1 values and setting the output dimension of a second patch. I'll look into that later...

jersmi's picture
Re: Image PixelS2

Having an odd problem with the Image PixelS2 plugin with the comp posted here: http://kineme.net/composition/jstrecker/Findlocationofuniquelycoloredobj...

It appears that on my machine the plugin resets itself to RGB (Luminance) for comps that used the original Image PixelS? Also experiencing an offset of the tracking point not originally present. Help?

jersmi's picture
Re: Image PixelS2

Here's a comp noting differences between old and new Image PixelS plugin.

PreviewAttachmentSize
color region centroid test2.qtz25.36 KB

philwues's picture
Re: Image PixelS2

Hi,

I have a question. I saw this video and lost the URL. It's probably made with this plugin.

So there is a whole grid of 10 by 10 squares. On each square their is the video input (webcam) playing. But the last video has a latency of lets say 30 seconds, then 28 seconds, ... until the first on is real time.

Any ideas? Much appreciated.

philwues's picture
Re: Image PixelS2

Thx

M.Oostrik's picture
Image PixelS2.1b

Working on a modified version of PixelS2.

  • It can exist side by side with the original plugin.
  • There is a separate plugin that gives RGBA values much like the Image Pixel patch.
  • "boost" is removed because i didn't feel it was necessary
  • There is again an RGB average type to make it more compatible with the original plugin

I also changed the CGColorSpaceRef to kCGColorSpaceGenericRGBLinear. This colorspace is also used in the Image Pixel Patch. I was wondering how i should approach the other 2 options from the patch. Image Native and Rendering Destination. How can i check for these in Objective C?

I would like to have the result of the PixelS2 plugin to resemble the result of the OpenCL patch.

(New plugins and example comp in zip)

PreviewAttachmentSize
PixelS2.png
PixelS2.png28.59 KB
PixelSCL.png
PixelSCL.png28.75 KB
Image PixelS 2.1b.zip115.81 KB

cybero's picture
Re: Image PixelS2.1b

Brilliant :-).

I've got a feeling that's going to be very useful indeed.

Source code included too - sweet.

Thanks for sharing.

jersmi's picture
Re: Image PixelS2.1b

Thanks for this.

benoitlahoz's picture
Re: Image PixelS2.1b

Thanks so much for your work. I use it a lot (see http://kineme.net/forum/Discussion/DevelopingCompositions/Javascripthitt...).

Just one thing : for another purpose I was really using the "boost". Didn't try though with this new plugin and no boost, but on an already thresholded "shadow" it was very useful.

M.Oostrik's picture
Re: Image PixelS2.1b

You're welcome! Fantastic line of compositions you're working on!

I decided to take out the boost to keep the patch as clean as possible.

The same thing could be achieved by inserting a exposure patch before the plugin. Another way of doing it and filter out noise at the same time is using the openCL step function. You get something like this:

__kernel void Mono(__rd image2d_t srcimg, float edge, __wr image2d_t dstimg)
{
   int2   pos = (int2)(get_global_id(0), get_global_id(1));
   float4   srccolor = read_imagef(srcimg, CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST, pos);
   float    grey = step(edge, (srccolor.x + srccolor.y + srccolor.z) /3);
   float4    dstcolor = (float4)(grey, grey, grey, 1);
 
   write_imagef(dstimg, pos, dstcolor);
}

(example comp attached)

This results in a monochrome image, where the pixels brighter than edge are white and all the other pixels are black.

If you need the boost function i could send you a version of the plugin with boost or even put the boost back into the plugin all together.

By the way you really should try to get the hang of openCL. It's kind of hard to poke through at first, but once you do it opens up many new possibilities and speed enhancements, especially with the kind of work you do with your tracking edges. This quick reference card helped me a lot: http://www.khronos.org/files/opencl-quick-reference-card.pdf

PreviewAttachmentSize
Step.qtz2.93 KB

benoitlahoz's picture
Re: Image PixelS2.1b

Your "step" threshold script is really powerful. It may be OK with this. Thank you !

Learning openCL is one of my calendar next task :-) ...I shall give it a try. But, ouch yes, it seems kind of hard...

Thanks for the reference card. I'll look for some tutorials and inspect the big openCL kernels there's around here on kineme.