diff --git a/README.md b/README.md index b42121a..95ddc0f 100644 --- a/README.md +++ b/README.md @@ -40,27 +40,29 @@ $ dotnet run -in /input/path -out /output/path -agent=no -unit=anygpu gauss sha ## Examples -The final result for all types of tranformations: +The final result for all types of transformations and filters: + |Original|Sharpen| |:-------|:------| -| ![image](https://github.com/PolinaSavelyeva/ImageProcessing/blob/main/resources/david-clode-78YxP3PP05A-unsplash2.jpg) | ![image](https://github.com/PolinaSavelyeva/ImageProcessing/blob/main/resources/david-clode-78YxP3PP05A-unsplashSharpen.jpg) | +| ![image](https://raw.githubusercontent.com/PolinaSavelyeva/ImageProcessing/main/resources/david-clode-78YxP3PP05A-unsplash2.jpg) | ![image](https://raw.githubusercontent.com/PolinaSavelyeva/ImageProcessing/main/resources/david-clode-78YxP3PP05A-unsplashSharpen.jpg) | |Gauss|Edges| |:-------|:------| -| ![image](https://github.com/PolinaSavelyeva/ImageProcessing/blob/main/resources/david-clode-78YxP3PP05A-unsplashGauss.jpg) | ![image](https://github.com/PolinaSavelyeva/ImageProcessing/blob/main/resources/david-clode-78YxP3PP05A-unsplashEdges.jpg) | +| ![image](https://raw.githubusercontent.com/PolinaSavelyeva/ImageProcessing/main/resources/david-clode-78YxP3PP05A-unsplashGauss.jpg) | ![image](https://raw.githubusercontent.com/PolinaSavelyeva/ImageProcessing/main/resources/david-clode-78YxP3PP05A-unsplashEdges.jpg) | |Darken|Lighten| |:-------|:------| -| ![image](https://github.com/PolinaSavelyeva/ImageProcessing/blob/main/resources/david-clode-78YxP3PP05A-unsplashDarken.jpg) | ![image](https://github.com/PolinaSavelyeva/ImageProcessing/blob/main/resources/david-clode-78YxP3PP05A-unsplashLighten.jpg) | +| ![image](https://raw.githubusercontent.com/PolinaSavelyeva/ImageProcessing/main/resources/david-clode-78YxP3PP05A-unsplashDarken.jpg) | ![image](https://raw.githubusercontent.com/PolinaSavelyeva/ImageProcessing/main/resources/david-clode-78YxP3PP05A-unsplashLighten.jpg) | |Rotation R|Rotation L| |:-------|:------| -| ![image](https://github.com/PolinaSavelyeva/ImageProcessing/blob/main/resources/david-clode-78YxP3PP05A-unsplashRotation.jpg) | ![image](https://github.com/PolinaSavelyeva/ImageProcessing/blob/main/resources/david-clode-78YxP3PP05A-unsplashRotationF.jpg) | +| ![image](https://raw.githubusercontent.com/PolinaSavelyeva/ImageProcessing/main/resources/david-clode-78YxP3PP05A-unsplashRotation.jpg) | ![image](https://raw.githubusercontent.com/PolinaSavelyeva/ImageProcessing/main/resources/david-clode-78YxP3PP05A-unsplashRotationF.jpg) | |Flip H|Flip V| |:-------|:------| -| ![image](https://github.com/PolinaSavelyeva/ImageProcessing/blob/main/resources/david-clode-78YxP3PP05A-unsplashFlipF.jpg) | ![image](https://github.com/PolinaSavelyeva/ImageProcessing/blob/main/resources/david-clode-78YxP3PP05A-unsplashFlip.jpg) | +| ![image](https://raw.githubusercontent.com/PolinaSavelyeva/ImageProcessing/main/resources/david-clode-78YxP3PP05A-unsplashFlipF.jpg) | ![image](https://raw.githubusercontent.com/PolinaSavelyeva/ImageProcessing/main/resources/david-clode-78YxP3PP05A-unsplashFlip.jpg) | + ### Template To find more building and running options take a look at the [MiniScaffold](https://github.com/TheAngryByrd/MiniScaffold) template. diff --git a/docs/Tutorials/Getting_Started.html b/docs/Tutorials/Getting_Started.html index d516bc8..eaac19c 100644 --- a/docs/Tutorials/Getting_Started.html +++ b/docs/Tutorials/Getting_Started.html @@ -142,18 +142,210 @@

Getting Started

-
open GPUImageProcessing
-let foo = ()
-let myAge = 21
-let color = Say.FavoriteColor.Red
-
-

Here is the path to downloading

-
paket install GPUImageProcessing
+

Prepearing

+

Requirements

+

First of all, make sure the following requirements are installed on your system:

+ +

To find more building and running options take a look at the MiniScaffold template.

+

Package Adding

+

Go to directory with your build.fsproj (or build.csproj) file and install ImageProcessing using command line:

+
dotnet add package ImageProcessing --version 1.0.0
+
+

For more information visit package main GitHub page.

+

Simple Usage

+

Using CLI

+

Before usage, go to specify directory:

+
$ cd /path/to/ImageProcessing/src/ImageProcessing
 
+

To process images from one directory and save them to another, you can use the following commands.

+
    +
  • +#### Оne transformation applied to each image in the directory +sh +$ dotnet run -in /input/path -out /output/path -agent=full -unit=cpu gauss +
  • +
  • +#### List of transformations that are sequentially applied +sh +$ dotnet run -in /input/path -out /output/path -agent=no -unit=anygpu gauss sharpen +More details about CLI processing you can find here. +
  • +
+

Using Your Own Code

+

Open library and load image to process:

+
open ImageProcessing
+
+let myImage = MyImage.load ("Full/Path/To/Images/Folder/image_name.jpg")
+
+

Create new function which sequentially applies blur filter and clockwise rotation to images and saves it on CPU:

+
let applyCustomFilterOnCPU (image: MyImage) (pathToSave : string) = 
+    let blurredImage = image |> CPU.applyFilter gaussianBlurKernel
+    let rotatedImage = blurredImage |> CPU.rotate true
+    
+    MyImage.save rotatedImage pathToSave
+
+

Create the same function for GPU. But before it we need to do some steps for diagnosing graphical device.

+

Define the device value by specifying the brand of your GPU or whatever the program finds (embedded graphics cards are also suitable). And make OpenCL context of it:

+
let device = Brahma.FSharp.ClDevice.GetFirstAppropriateDevice()
+let clContext = Brahma.FSharp.ClContext(device)
+
+

Next, define new values for filter and rotation functions. This action is necessary because of compiling kernel function once:

+
let applyFilterGPU = GPU.applyFilter clContext 64
+let rotateGPU = GPU.rotate clContext 64
+
+

And the final function:

+
let applyCustomFilterOnGPU (image: MyImage) (pathToSave : string) = 
+    let blurredImage = image |> applyFilterGPU gaussianBlurKernel
+    let rotatedImage = blurredImage |> rotateGPU true
+    
+    MyImage.save rotatedImage pathToSave
+
+

The result:

+
open ImageProcessing
+
+let myImage = MyImage.load ("Full/Path/To/Images/Folder/image_name.jpg")
+
+let applyCustomFilterOnCPU (image: MyImage) (pathToSave : string) = 
+    let blurredImage = image |> CPU.applyFilter gaussianBlurKernel
+    let rotatedImage = blurredImage |> CPU.rotate true
+    
+    MyImage.save rotatedImage pathToSave
+
+let device = Brahma.FSharp.ClDevice.GetFirstAppropriateDevice()
+let clContext = Brahma.FSharp.ClContext(device)
+
+let applyCustomFilterOnGPU (image: MyImage) (pathToSave : string) = 
+    let blurredImage = image |> applyFilterGPU gaussianBlurKernel
+    let rotatedImage = blurredImage |> rotateGPU true
+    
+    MyImage.save rotatedImage pathToSave
+ 
+let pathToSave = "Path/To/Directory/image_name.jpg"
+applyCustomFilterOnCPU myImage pathToSave
+applyCustomFilterOnGPU myImage pathToSave
+
+

Features

+

The following features are implemented, even for CPU and GPU:

+
    +
  • +Filters +
      +
    • Gaussian Blur
    • +
    • Edges
    • +
    • Sharpen
    • +
    • Lighten
    • +
    • Darken
    • +
    +
  • +
+
    +
  • +Transformations +
      +
    • Clockwise rotation
    • +
    • Counterclockwise rotation
    • +
    • Vertical flip (Y-axis)
    • +
    • Horizontal flip (X-axis)
    • +
    +
  • +
+
    +
  • +Multithreaded processing tools +
      +
    • Saving agent
    • +
    • Processing agent
    • +
    • Full processing agent, i.e saving plus processing
    • +
    • Events logger
    • +
    +
  • +
+
    +
  • Directory with pictures processing tool
  • +
+

For detailed descriptions of all features above visit Api Reference.

+

The final result for all types of transformations and filters:

+ + + + + + + + + + + + + +

Original

Sharpen

image

image

+ + + + + + + + + + + + + + +

Gauss

Edges

image

image

+ + + + + + + + + + + + + + +

Darken

Lighten

image

image

+ + + + + + + + + + + + + + +

Rotation R

Rotation L

image

image

+ + + + + + + + + + + + + + +

Flip H

Flip V

image

image

+ -
val foo: unit
-
val myAge: int
-
val color: obj
+
Multiple items
val string: value: 'T -> string

--------------------
type string = System.String
diff --git a/docs/index.html b/docs/index.html index b677e04..eb5e36e 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,7 +3,7 @@ - ImageProcessing + <title>Introduction to ImageProcessing @@ -141,43 +141,50 @@
-

ImageProcessing

+

Introduction to ImageProcessing


What is ImageProcessing?

ImageProcessing is an easy-to-use F# package that utilizes Brahma.FSharp and SixLabors.ImageSharph. It offers two primary image processing options: CPU and GPU or agent-supported processing, all accessible within the included console application.

Why use ImageProcessing?

-

I created it because I had to solve an issue with this other thing.

+

It can helps you to process your images quickly using GPU or only command-line.

+

There is some of the features implemented in ImageProcessing. +- Loading images from a local source and saving them. +- Processing all images within a specified directory. +- Filtering using one of five kernels, including "Gaussian blur" and "edges". +- Other edits such as 90-degree rotation and flipping. +- Combinations of existing transformations in four different scenarios. +- Ability to utilize all of the features solely through the command line.


-
Tutorials
-

Takes you by the hand through a series of steps to create your first thing.

+
How-To make your own code
+

Create new processing function using "bricks" via ImageProcessing.

-
How-To Guides
-

Guides you through the steps involved in addressing key problems and use-cases.

+
How-To use CLI
+

Quickly process your images using command line.

-
Explanations
-

Discusses key topics and concepts at a fairly high level and provide useful background information and explanation..

+
Library structure
+

Helps you better understanding library's functions, modules and structures dependencies.