Dynamo Challenge Library

This post contains all of the submissions for the Dynamo Challenges :jigsaw: for you to explore, learn from and take inspiration for the next set of Challenges upcoming.

Summer 2022 Dynamo Forum Challenges:

Vikram's code
img1 = Image.ReadFromFile(f01);
dm1 = Image.Dimensions(img1)["width"];
pxl1 = List.Flatten(Image.Pixels(img1,dim1,dim1));
pxl2 = Math.Average(List.Transpose([pxl1.Red,pxl1.Green,pxl1.Blue]));

F# Code to create the dll

namespace integerImage
open System.IO
module integerML =
    type Example = {
        Label : int
        Pixels : int []
    }
    
    let readExamples path = 
        path
        |> File.ReadAllLines
        |> Array.map (fun line -> line.Split ',')
        |> Array.map (fun line -> line |> Array.map int)
        |> Array.map (fun line -> {Label = line.[0]; Pixels = line.[1..]} )

    let distance (img1 : int[]) (img2 : int[]) =
        Array.map2 (fun pix1 pix2 -> abs(pix1 - pix2)) img1 img2
        |> Array.sum
    
    let classify (img : int[]) = 
        let bestMatch =
                readExamples (__SOURCE_DIRECTORY__ + "/train.csv")
                |> Array.minBy (fun x -> distance x.Pixels img)
        bestMat
TSplineSurface.BuildPipes(List.Flatten(Line.ByBestFitThroughPoints(List.DropItems(List.Sublists(Point.ByCoordinates([[-30,-20,-25,25,20,30],[-30,-20,-20,0,-20,20,0,20,20,30]],[[30,20,25,25,20,30],[-30,-20,20,0,-20,-20,0,20,-20,-30]],[[12,45,80,80,45,12],[12,45,45,45,45,45,45,45,45,12]])<1>,0..1,1)<1>,-1)),-1), 2, 0.001, null, false, false, 1, 1, 2, 3, 3, 3, true);

Check back in the not-to-distant future for yet more awesome Dynamo Challenges as we seek to crown the next winning designs :trophy:

10 Likes