Skip to content

Conversation

@Gitubrr
Copy link
Owner

@Gitubrr Gitubrr commented Dec 17, 2024

Made kernels for image processing.
The kernels can be used in any order from the console.
Tests for them have been written

@Gitubrr Gitubrr requested a review from gsvgit December 17, 2024 19:28
type CmdArgs =
| [<Mandatory>] Input_File of string
| [<Mandatory>] Out_File of string
| [<Mandatory>] Filter of string
Copy link
Collaborator

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 ?


Arb.fromGen array2DGen

type SmallImage() =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А их точно нельзя как-то параметризовать размером?


[<Property(Arbitrary = [| typeof<Image> |])>]
member _.trivialComposition (image: Rgba32[,]) =
let trivial1and2 = applyFilter kernelTrivial1 image |> applyFilter kernelTrivial2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну у этих фильтров вполне есть смысл. Стало быть, их можно нормально назвать.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

я пыталась, это лучшее что мне пришло в голову..

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну это же сдвиги


[<Fact>]
let filterDoesntChangeSize () =
let imageAfterFilter = applyFilter gaussianBlur image1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А чем эти тесты отличаются от свойств? В чём их смысл?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По идеи ничем не отличаются, не считая того, что здесь мы не используем случайные данные.
Смысл в том, чтобы проверить, не меняется ли размер изображения после применения фильтра.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В такой постановке выглядят избыточным.

Copy link
Owner Author

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 =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не надо так. IКто-то-там в дотенет --- это интерфейс.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а что не так(

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Стиль названия модуля IXyz -- это стиль для имён интерфейсов

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так только в дотнет или впринцепи везде?

Copy link
Collaborator

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')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А нельзя ли изображение не обходить несколько раз?

@Gitubrr Gitubrr requested a review from gsvgit December 19, 2024 14:17
let resultImage =
filters |> List.fold (fun img filter ->
match filter with
| "gaussianBlur" -> applyFilter gaussianBlur img
Copy link
Collaborator

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

type Arguments =
| [<Mandatory>] Input_File of string
| [<Mandatory>] Out_File of string
| [<Mandatory>] Filter of string list
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filters

Assert.Equal(true, imageIsBlack imageBlack)

[<Fact>]
let trivialComposition () =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Часть тестов, кажется, не нужна, а часть надо переелать на сравнение с эталонным результатом

fixed all according pull request

enum filters

help

rebased HW5 into master

sa

s
@Gitubrr Gitubrr merged commit f0cf40d into master Dec 27, 2024
2 checks passed
@Gitubrr Gitubrr deleted the HomeWork_5 branch December 27, 2024 13:17
Gitubrr added a commit that referenced this pull request Mar 6, 2025
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
Gitubrr added a commit that referenced this pull request Aug 12, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants