New answers tagged

2

As a general feedback, the script looks quite good. I will nevertheless share a few of my thoughts with you. shebang Since you are using Python 3, the initial shebang should be #!/usr/bin/env python3. Otherwise it will depend on the system which interpreter is used to execute the script once the file is marked as executable. Documentation Only ...


1

// Not following Swift naming conventions, should be bytesPerPixel let BytesPerPixel = 4 // Better to make function throwable and throw specific error. guard let srcProv = srcImg.dataProvider else { fatalError("dataProvider is nil") } guard let srcProvData = srcProv.data else { fatalError("dataProvider.data is nil") } For unwrap of srcImg.colorSpace! is ...


3

assorted findings your code does not document what predict() accomplishes • I don't even get how the name predict is telling/helpful • your code documents neither the approach chosen nor alternatives disregarded comparing a cheaper monotone function of Euclidean distance: nice • naming the variables without fussing that it's equivalent Euclidean at the end ...


3

I don't know much about C#, so this answer will focus solely on generic stuff. Performance problems in image processing applications usually happen inside loops over all pixels. I'm focusing on this section of the code: for (int x = 0; x < tempImg.Width; x++) { for (int y = 0; y < tempImg.Height; y++) { double distence = GetDistance(...


3

There is a lot of unnecessary noise in the function. If the base path is not expected to change it can be moved out into a constant. System.IO.Path can be used to construct the path to the desired image. To avoid null reference errors when consuming this function, try to avoid returning null. An empty array should be returned. const string BASEIMAGEPATH =...


Top 50 recent answers are included