Jump to content
Developer Wiki and Function Reference Links ×

Can Marionette parse or read raster file data - ie count pixels


unearthed

Recommended Posts

I have not yet tried this but have not found anything in help files or other questions and no sense reinventing the wheel if someone's managed it.

 

I want to know if Marionette can parse or read raster file data, e.g. count pixels of a given colour/color and produce summed counts of those colours. E.g. from this simple 4 colour + white image:

 

Why I'm doing this is I'm producing planview landscape planting concepts in a digital painting program, thresholding the artwork to reduce the colour space to represent plant zones (eg 4 colours > 4 zone types in encl.), and then counting pixels via imagemagick to work out planting areas. But then have recently wondered if Marionette can count pixels.

poster_output12.jpg

Link to comment

You can count pixels of an image by using the pillow library for python. You could install that library in 2023 with the new installer from Marionette. Some of the earlier installation nodes (from me and others) fails because of different reasons (wrong wheele Files, ssl incompatibilities etc.) But once your pillow library was working you can do that. You cant count the pixels and colors. Maybe you have to "round" color because not every green pixels have the same green etc.
but it is possible with low or maximum medium effort. Some existing examples:

1. How to digitizing an Image: It counts the pixels and the the rgb values.


2. An Example how to seperate Clusters of Points.

 
3. An Example how to create a Hull around a "cloud" of Points.  If you have generated points out of your image, you could make a shape out of this points with that.




A note about Example #2 and #3. This is perfectly already solved by using an external Library like shapely etc. They can generate convex and concave shapes out of points. Also There are many other Libraries that can vectorize your images pretty good. 

 

  • Like 2
Link to comment

Hi
I wrote "low effort" so I triggered myself to try it. Here your example. I count here every 20th pixel. this is the input "Rasterabstand".
What is not solved is, that the blue pixels as example not have exactly the same value. Also it counts also the white pixels. But it is a base, just to answer the initial question.

Oh yes, Marionette can. 
image.thumb.png.8e592ef5fe0622cf14d04afdfc8f0697.png

counting pixel.vwx

 

 

The Picture have 51 different colors. Here the counts:
image.thumb.png.441c020d1cdf63e483985fd29632bb06.png

Edited by DomC
  • Like 2
Link to comment

That looks great DomC!

I'm still working out how to reduce image colours to make them more readable and looking at using a minimal set of colours via a colortable to reduce my wider range of colours to that - probably using nine colours. I'm feeling more hopeful about this being achievable now. I'm asking other questions re other aspects of this process and will come back.

 

I'm only on 2018, although it looks like I have a 2022 serial from when I purchased VW 2018.

 

You have made some very very interesting Marionette nodes esp. text manipulation and shape packing.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...