-
Notifications
You must be signed in to change notification settings - Fork 0
HomeWork_5 #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HomeWork_5 #14
Conversation
src/ImageProcessing/Program.fs
Outdated
| type CmdArgs = | ||
| | [<Mandatory>] Input_File of string | ||
| | [<Mandatory>] Out_File of string | ||
| | [<Mandatory>] Filter of string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Во-первых, название. А во-вторых, почему не https://fsprojects.github.io/Argu/tutorial.html#Optional-and-List-parameters ?
Tests/PropertyImageProcessing.fs
Outdated
|
|
||
| Arb.fromGen array2DGen | ||
|
|
||
| type SmallImage() = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А их точно нельзя как-то параметризовать размером?
Tests/PropertyImageProcessing.fs
Outdated
|
|
||
| [<Property(Arbitrary = [| typeof<Image> |])>] | ||
| member _.trivialComposition (image: Rgba32[,]) = | ||
| let trivial1and2 = applyFilter kernelTrivial1 image |> applyFilter kernelTrivial2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ну у этих фильтров вполне есть смысл. Стало быть, их можно нормально назвать.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я пыталась, это лучшее что мне пришло в голову..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ну это же сдвиги
Tests/UnitImageProcessing.fs
Outdated
|
|
||
| [<Fact>] | ||
| let filterDoesntChangeSize () = | ||
| let imageAfterFilter = applyFilter gaussianBlur image1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А чем эти тесты отличаются от свойств? В чём их смысл?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
По идеи ничем не отличаются, не считая того, что здесь мы не используем случайные данные.
Смысл в том, чтобы проверить, не меняется ли размер изображения после применения фильтра.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В такой постановке выглядят избыточным.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А почему избыточно?
Вообще тесты на размер убрать или только юнит?
| Image(data, width, height, "New Image") | ||
|
|
||
|
|
||
| module IProcessing = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не надо так. IКто-то-там в дотенет --- это интерфейс.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а что не так(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Стиль названия модуля IXyz -- это стиль для имён интерфейсов
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Так только в дотнет или впринцепи везде?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Честно говоря, не обирал статистику. Знаю, что бывает и не так. В целом, так делают и в плюсах, и в Java. Просто в .NET это принято чуть ли не на уровне системной библиотеке, а в других языках, вроде, нет.
| Array.fold2 (fun s x y -> s + x * y) 0.0f filter dataToHandle | ||
|
|
||
| Array2D.mapi (fun x y _ -> | ||
| let r = byte (processPixel x y 'R') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А нельзя ли изображение не обходить несколько раз?
src/ImageProcessing/Program.fs
Outdated
| let resultImage = | ||
| filters |> List.fold (fun img filter -> | ||
| match filter with | ||
| | "gaussianBlur" -> applyFilter gaussianBlur img |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно ли тут применить enums: https://fsprojects.github.io/Argu/tutorial.html#Enumeration-parameters
src/ImageProcessing/Program.fs
Outdated
| type Arguments = | ||
| | [<Mandatory>] Input_File of string | ||
| | [<Mandatory>] Out_File of string | ||
| | [<Mandatory>] Filter of string list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filters
Tests/UnitImageProcessing.fs
Outdated
| Assert.Equal(true, imageIsBlack imageBlack) | ||
|
|
||
| [<Fact>] | ||
| let trivialComposition () = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Часть тестов, кажется, не нужна, а часть надо переелать на сравнение с эталонным результатом
Rename 5.pdf to presentation.pdf merged HW6 to master * made Trees funcs * made empty tests files * made tests * changed all according pull request * char << ((+) 1 << int) divided all test files into folders HomeWork_5 (#14) * HW5 fixed all according pull request enum filters help rebased HW5 into master sa s * couldnt fix parametr for generators + HomeWork 7 * done * made structure Matrix, removed size from QTrees * removed unnecessary data * fixed :) * removed cached edit a ghg a
Rename 5.pdf to presentation.pdf merged HW6 to master * made Trees funcs * made empty tests files * made tests * changed all according pull request * char << ((+) 1 << int) divided all test files into folders HomeWork_5 (#14) * HW5 fixed all according pull request enum filters help rebased HW5 into master sa s * couldnt fix parametr for generators + HomeWork 7 * done * made structure Matrix, removed size from QTrees * removed unnecessary data * fixed :) * removed cached edit a ghg a
Made kernels for image processing.
The kernels can be used in any order from the console.
Tests for them have been written