Get the pixel values of a color or grayscale image

Hi,

Is it possible to retrieve the pixels of an image using the currently available nodes in the nodes library?

Below is a simple motion sensor sketch but I would like to get the average 2D points of pixels that are not black. If I can do this I could then place a marker on the image and track the moving object in Vuo coordinates.

MotionDetetcor.vuo (3.71 KB)

Sample Color from Image?

Thanks for your help @jmcc.

I would like to access the raw pixels so that I can use their coordinates - clearer below.

For example, in the image below I know the coordinates of every white pixel, and through averaging their x and y positions I can calculate the centre of mass (3,3) . I’d like to perform this method on a thresholded video image so that I can place a marker at the centre of mass of the moving object.

I need to learn to create my own nodes, but at this point I was playing around with readily available ones.  

Did you have a look at @scratchpole’s motion detection comp in the composition library? It uses a deprecated node to average lists, but you can at least see a method.  

MM ListTools isn’t deprecated :)

1 Like

There is a feature request for Tracking blobs, or “finding the image’s centroid”, which is what we think you are asking. One of my teammates created a composition that samples many colors from the image inside a Process List loop, then take the average of the sampled point positions weighted by the brightness at each position.

Implementing the feature request should provide better performance and better resolution, and more advanced region detection.

centroid.zip (819 KB)

2 Likes

MM ListTools isn’t deprecated :)

Had a feeling someone might say that – should have said “a node that will not open on my (M1) machine”, wonder why…

@jmcc – that is a very good comp to see. Kinda wishing examples like this from Team Vuo could (also) be in the composition library….

Edit: attached a comp, added some smoothing in attempt to address blob jitter. More could be done.  

centroid-smooth.vuo (11.5 KB)

2 Likes

Thanks @jmcc and @jersmi for the ‘centroid-smooth.vuo’ I’ll check it out.  

@jersmi,

Feel free to post your modified composition in the gallery.

2 Likes

Done – with extras! :-)  

1 Like

Hi @jersmi, @jmcc, @scratchpole

My iMac broke yesterday just as I started on this…

So here’s my own version based on the grid system.

Method:

  1. Creates a 10x10 grid over the video frames. The grid acts like a CCD sensor.
  2. Loop over the grid, sample the colour at each coordinate and width, and colorise the corresponding grid element with an average colour.
  3. If it is greater than black (0) then obtain the grid(s) coordinate and dimensions
  4. Overlay a rectangle with this position and dimension.
  5. Aimed result: a rectangle which adjusts its size and location in relation to the blob in the video…smoothing filter for rectangle motion not implemented here.

Problems:

  1. Seems to be a glitch in the way the grid are colored - some reddening to the top grids
  2. Interference from 1 causes the resulting green rectangle to jump about a bit
  3. My composition is a bit slow so I;ve had to reduce the video rate.

Can you guys help with the problems?

 

5_Sample_BW_Video_WithRectangle.vuo (19.4 KB)