unearthed Posted November 19, 2022 Share Posted November 19, 2022 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. Quote Link to comment
Pat Stanford Posted November 19, 2022 Share Posted November 19, 2022 I don't believe that any of the default Marionette nodes can count pixels. But Nodes are written in Python and I am certain that there are Python libraries that could do this with just a few lines of code. And no, this is one that I am not volunteering to work on. 😉 2 Quote Link to comment
DomC Posted November 19, 2022 Share Posted November 19, 2022 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. 2 Quote Link to comment
DomC Posted November 19, 2022 Share Posted November 19, 2022 (edited) 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. counting pixel.vwx The Picture have 51 different colors. Here the counts: Edited November 19, 2022 by DomC 2 Quote Link to comment
unearthed Posted November 19, 2022 Author Share Posted November 19, 2022 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. Quote Link to comment
Recommended Posts
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.