Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
21 changes: 13 additions & 8 deletions docs/basics/working-with-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@ In the context of digital technology and computing, images are represented as a

- Currently ImageJS supports images with these characteristics:

| | TIFF | JPEG | PNG | BMP |
| -------------------------------- | ---------------- | ------- | ---------------- | -------- |
| **Bits per channel** | 8 or 16 bits | 8 bits | 8 or 16 bits | 1 bit |
| **Alpha channel** | yes | no | yes | no |
| **Lossy compression** | can be either | yes | no | no |
| **Color Model** | RGB or grayscale | RGB | RGB or grayscale | N/A |
| **Can be loaded in this format** | ✅ | ✅ | ✅ | ❌ |
| **Can be saved in this format** | ❌ | ✅ | ✅ | ✅ |
| | TIFF | JPEG | PNG[^1] | BMP |
| -------------------------------- | --------------------------- | -------- | --------------------------- | --------------------------- |
| **Can be loaded in this format** | ✅ | ✅ | ✅ | ✅ |
| **Can be saved in this format** | ❌ | ✅ | ✅ | ✅ |
| **Bits per channel** | 1, 8 or 16 bits | 8 bits | 1, 2, 4, 8 or 16 bits | 1 or 8 bits |
| **Alpha channel** | ✅ | ❌ | ✅ | ✅ |
| **Palette images** | ✅ | ❌ | ✅ | ❌ |
| **Lossy compression** | can be either | ✅ | ❌ | ❌ |
| **Color Model** | Binary[^2],RGB or grayscale | RGB | Binary[^2],RGB or grayscale | Binary[^2],RGB or grayscale |

[^1]: ImageJS can also **decode** [APNG images](https://en.wikipedia.org/wiki/APNG).

[^2]: While binary images can be decoded, for technical reasons image is decoded as a grayscale image.

### Image coordinates

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ThresholdMaskDemo from './demos/thresholdMask.demo.tsx'
import CannyMaskDemo from './demos/cannyEdgeMask.demo.tsx'
import ThresholdMaskDemo from './demos/thresholdMask.demo.tsx';
import CannyMaskDemo from './demos/cannyEdgeMask.demo.tsx';

# Working with Masks

Expand All @@ -23,7 +23,7 @@ const mask = new Mask(500, 500); // Creates a simple mask filled with 0s of size

### Use `threshold()` method

Another approach is to obtain a mask by using [`threshold` method](../features/operations/threshold.md 'internal link on threshold') on an image.
Another approach is to obtain a mask by using [`threshold` method](../features/operations/threshold.mdx 'internal link on threshold') on an image.

```ts
const mask = image.threshold(); // returns a mask
Expand All @@ -39,7 +39,7 @@ In most cases, thresholding is your go-to method to get a mask from an image.

### Use `cannyEdgeDetector()` method

There is also a third way to get a mask. It is to use [`cannyEdgeDetector` method](../features/morphology/canny-edge-detector.md 'internal link on canny edge detector').
There is also a third way to get a mask. It is to use [`cannyEdgeDetector` method](../features/morphology/canny-edge-detector.mdx 'internal link on canny edge detector').

```ts
const mask = image.cannyEdgeDetector(); // returns a mask
Expand Down
2 changes: 1 addition & 1 deletion docs/basics/working-with-rois.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ _A region of interest (ROI) represents an area of contiguous pixels within the d

There are currently two ways ROIs can be generated in ImageJS:

- From [masks](./working-with-masks.md 'internal link on working with mask') by identifying contiguous black or white pixels within it.
- From [masks](./working-with-masks.mdx 'internal link on working with mask') by identifying contiguous black or white pixels within it.
<!-- TODO: add links to the relevant sections once they exist -->
- By identifying starting points of interest (for example by finding and filtering local extrema) and running the [watershed algorithm](../features/operations/watershed.md 'internal link on watershed') on them.
- By identifying starting points of interest (for example by finding and filtering local extrema) and running the [watershed algorithm](../features/operations/watershed.md 'internal link on watershed') on them.
Expand Down
2 changes: 1 addition & 1 deletion docs/features/comparison/addition.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _Add two images together._

[🖼️ Image options and parameters of `add` method](https://api.image-js.org/classes/index.Image.html#add)

`add` method, opposed to [subtraction](./subtraction.md 'internal link on subtract'), takes another Image and makes an addition between each respective pixel value.
`add` method, opposed to [subtraction](./subtraction 'internal link on subtract'), takes another Image and makes an addition between each respective pixel value.
It works like this:

```ts
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 30
---

import BlurDemo from './demos/blur.demo.tsx'
import BlurDemo from './demos/blur.demo.tsx';

# Blur

Expand All @@ -15,7 +15,7 @@ Blur, also known as average blur or box blur, is a simple image processing techn
<BlurDemo />

Box blur is particularly effective in reducing [salt-and-pepper](https://en.wikipedia.org/wiki/Salt-and-pepper_noise 'wikipedia link on salt and pepper noise') noise (random black and white pixels) and minor imperfections in an image. However, it also leads to loss of finer details, so the choice of [kernel](../../glossary.md#kernel 'glossary link on kernel') size is important.
More advanced blurring techniques, such as [Gaussian blur](./gaussian-blur.md 'internal link to gaussian blur') or [bilateral filter](https://en.wikipedia.org/wiki/Bilateral_filter 'wikipedia link on bilateral filters'), are often used for better results in various applications.
More advanced blurring techniques, such as [Gaussian blur](./gaussian-blur 'internal link to gaussian blur') or [bilateral filter](https://en.wikipedia.org/wiki/Bilateral_filter 'wikipedia link on bilateral filters'), are often used for better results in various applications.

### Kinds of images compatible with algorithm

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 70
---

import DerivativeDemo from './demos//derivative.demo.tsx'
import DerivativeDemo from './demos//derivative.demo.tsx';

# Derivative

Expand Down
22 changes: 11 additions & 11 deletions docs/features/filters/filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ sidebar_position: 0

### Methods

| Can be applied on | Images | Masks |
| ------------------------------------------------------------------------------ | ------- | -------- |
| [Invert(`invert`)](./invert.md 'internal link on invert') | &#9989; | &#9989; |
| [Grayscale(`grey`)](./grayscale.md 'internal link on grayscale') | &#9989; | &#10060; |
| [Gradient(`gradient`)](./gradient.md 'internal link on gradient') | &#9989; | &#10060; |
| [Derivative(`derivative`)](./derivative.md 'internal link on derivative') | &#9989; | &#10060; |
| [Median(`median`)](./median.md 'internal link on median') | &#9989; | &#10060; |
| [Pixelate(`pixelate`)](./pixelate.md 'internal link on pixelate') | &#9989; | &#10060; |
| [Blur(`blur`)](./blur.md 'internal link on blur') | &#9989; | &#10060; |
| [Gaussian(`gaussianBlur`)](./gaussian-blur.md 'internal link on gaussianBlur') | &#9989; | &#10060; |
| [Level(`level`)](./level.md 'internal link on level') | &#9989; | &#10060; |
| Can be applied on | Images | Masks |
| ------------------------------------------------------------------------------- | ------- | -------- |
| [Invert(`invert`)](./invert.mdx 'internal link on invert') | &#9989; | &#9989; |
| [Grayscale(`grey`)](./grayscale.mdx 'internal link on grayscale') | &#9989; | &#10060; |
| [Gradient(`gradient`)](./gradient.mdx 'internal link on gradient') | &#9989; | &#10060; |
| [Derivative(`derivative`)](./derivative.mdx 'internal link on derivative') | &#9989; | &#10060; |
| [Median(`median`)](./median.mdx 'internal link on median') | &#9989; | &#10060; |
| [Pixelate(`pixelate`)](./pixelate.mdx 'internal link on pixelate') | &#9989; | &#10060; |
| [Blur(`blur`)](./blur.mdx 'internal link on blur') | &#9989; | &#10060; |
| [Gaussian(`gaussianBlur`)](./gaussian-blur.mdx 'internal link on gaussianBlur') | &#9989; | &#10060; |
| [Level(`level`)](./level.mdx 'internal link on level') | &#9989; | &#10060; |
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 40
---

import GaussianBlurDemo from './demos/gaussianBlur.demo.tsx'
import GaussianBlurDemo from './demos/gaussianBlur.demo.tsx';

# Gaussian Blur

Expand Down Expand Up @@ -61,7 +61,7 @@ The size of the Gaussian kernel and the standard deviation parameter (which cont

Here's how Gaussian blur is implemented in ImageJS:

_Kernel Definition_: The core concept of Gaussian blur involves [convolving](../../glossary.md#convolution 'glossary link on convolution') the image with a Gaussian [kernel](../../glossary.md#kernel 'glossary link on kernel'), also known as a Gaussian filter or mask. This kernel's values are arranged in a way that creates a symmetric, bell-shaped pattern around the center of the kernel to approximate Gaussian function.
_Kernel Definition_: The core concept of Gaussian blur involves [convolving](../../glossary#convolution 'glossary link on convolution') the image with a Gaussian [kernel](../../glossary.md#kernel 'glossary link on kernel'), also known as a Gaussian filter or mask. This kernel's values are arranged in a way that creates a symmetric, bell-shaped pattern around the center of the kernel to approximate Gaussian function.

_Convolution Operation_: The Gaussian kernel is applied to the image using a convolution operation. This involves placing the kernel's center over each pixel in the image and performing element-wise multiplication of the kernel's values with the corresponding pixel values in the neighborhood. The results of these multiplications are summed up to compute the new value for the central pixel.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 60
---

import GradientDemo from './demos/gradient.demo.tsx'
import GradientDemo from './demos/gradient.demo.tsx';

# Gradient

Expand Down Expand Up @@ -49,7 +49,7 @@ Keep in mind that gradient filters can be sensitive to noise and might result in

Here's how gradient filter is implemented in ImageJS:

_Grayscale Conversion_: Before applying a gradient filter, the color image is converted into [grayscale](./grayscale.md 'internal link on grayscale filter'). This simplifies the processing by reducing the image to a single channel representing pixel intensities.
_Grayscale Conversion_: Before applying a gradient filter, the color image is converted into [grayscale](./grayscale.mdx 'internal link on grayscale filter'). This simplifies the processing by reducing the image to a single channel representing pixel intensities.

_Kernel Operators_: Gradient filter consists of small convolution [kernels](../../glossary.md#kernel 'glossary link on kernel'). Normally, one for detecting horizontal changes and another for vertical changes, however user might indicate only one kernel to check only one of directions. These kernels are usually 3x3 matrices of numerical weights.

Expand All @@ -60,7 +60,7 @@ _Gradient Magnitude and Direction_: For each pixel, the gradient magnitude is ca
_Edge Detection_: The gradient magnitude values are used to identify regions of rapid intensity change, which correspond to edges in the image. Higher gradient magnitude values indicate stronger edges.

:::tip
_Thresholding_: To further refine the edges detected, a [thresholding](../operations/threshold.md 'internal link on threshold filter') step is often applied. Pixels with gradient magnitudes below a certain threshold are considered as non-edges, while those above the threshold are considered edges. This helps in reducing noise and emphasizing significant edges.
_Thresholding_: To further refine the edges detected, a [thresholding](../operations/threshold.mdx 'internal link on threshold filter') step is often applied. Pixels with gradient magnitudes below a certain threshold are considered as non-edges, while those above the threshold are considered edges. This helps in reducing noise and emphasizing significant edges.
:::

</details>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 20
---

import GrayDemo from './demos/grayscale.demo.tsx'
import GrayDemo from './demos/grayscale.demo.tsx';

# Grayscale

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 10
---

import InvertDemo from './demos/invert.demo.tsx'
import InvertDemo from './demos/invert.demo.tsx';

# Invert

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 80
---

import LevelDemo from './demos/level.demo.tsx'
import LevelDemo from './demos/level.demo.tsx';

# Level

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 50
---

import MedianDemo from './demos/median.demo.tsx'
import MedianDemo from './demos/median.demo.tsx';

# Median

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 90
---

import PixelateDemo from './demos/pixelate.demo.tsx'
import PixelateDemo from './demos/pixelate.demo.tsx';

# Pixelate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 30
---

import FlipDemo from './demos/flip.demo.tsx'
import FlipDemo from './demos/flip.demo.tsx';

# Flip

Expand Down
10 changes: 5 additions & 5 deletions docs/features/geometry/geometry.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ Geometric operations in image processing involve transforming the spatial coordi

| Can be applied on | Images | Masks |
| --------------------------------------------------------------------------------------------------------------------------- | ------- | -------- |
| [Flip(`flip`)](./flip.md 'internal link on flip') | &#9989; | &#10060; |
| [Resize(`resize`)](./resize.md 'internal link on resize') | &#9989; | &#10060; |
| [Rotate(`rotate`)](./rotate.md 'internal link on rotate') | &#9989; | &#10060; |
| [Transform(`transform`)](./transform.md 'internal link on transform') | &#9989; | &#10060; |
| [Transform and rotate(`transformRotate`)](./transform-and-rotate 'internal link on transformRotate') | &#9989; | &#10060; |
| [Flip(`flip`)](./flip.mdx 'internal link on flip') | &#9989; | &#10060; |
| [Resize(`resize`)](./resize.mdx 'internal link on resize') | &#9989; | &#10060; |
| [Rotate(`rotate`)](./rotate.mdx 'internal link on rotate') | &#9989; | &#10060; |
| [Transform(`transform`)](./transform.mdx 'internal link on transform') | &#9989; | &#10060; |
| [Transform and rotate(`transformRotate`)](./transform-and-rotate.mdx 'internal link on transformRotate') | &#9989; | &#10060; |
| [Get perspective warp matrix(`getPerspectiveWarp`)](./get-perspective-warp-matrix.md 'internal link on getPerspectiveWarp') | - | - |
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 10
---

import ResizeDemo from './demos/resize.demo.tsx'
import ResizeDemo from './demos/resize.demo.tsx';

# Resize

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 20
---

import RotateDemo from './demos/rotate.demo.tsx'
import RotateDemo from './demos/rotate.demo.tsx';

# Rotate

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
sidebar_position: 50
---

import TransRotateDemo from './demos/transformRotate.demo.tsx'
import TransRotateDemo from './demos/transformRotate.demo.tsx';

# Transform and Rotate

_Rotates an image by any angle._

[🖼️ Image options and parameters of `transformRotate` method](https://api.image-js.org/classes/index.Image.html#transformRotate)

`transformRotate` method rotates image anti-clockwise at any angle that user sets. It applies the same principle as [transform](./transform.md 'internal link on transform demo') method, but user only needs to pass a rotation angle as a parameter instead of the whole matrix.
`transformRotate` method rotates image anti-clockwise at any angle that user sets. It applies the same principle as [transform](./transform.mdx 'internal link on transform demo') method, but user only needs to pass a rotation angle as a parameter instead of the whole matrix.

<TransRotateDemo />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 40
---

import TransformDemo from './demos/transform.demo.tsx'
import TransformDemo from './demos/transform.demo.tsx';

# Transform

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 60
---

import BottomHatDemo from './demos/bottomHat.mask.demo.tsx'
import BottomHatDemo from './demos/bottomHat.mask.demo.tsx';

# Bottom Hat

Expand All @@ -11,7 +11,7 @@ _Enhances the fine details or small objects within an image by subtracting an op
[🖼️ Image options and parameters of `bottomHat` method](https://api.image-js.org/classes/index.Image.html#bottomHat)
[🎭 Mask options and parameters of `bottomHat` method](https://api.image-js.org/classes/index.Mask.html#bottomHat)

Similarly to [top hat](./top-hat.md 'internal link to top hat'), [bottom hat](https://en.wikipedia.org/wiki/Top-hat_transform 'wikipedia link to top hat') operation computes the difference between two images. However, if top hat was using [opening method](./opening.md 'internal link on open method'), bottom hat is using [closing method](./closing.md 'internal link on close method').
Similarly to [top hat](./top-hat 'internal link to top hat'), [bottom hat](https://en.wikipedia.org/wiki/Top-hat_transform 'wikipedia link to top hat') operation computes the difference between two images. However, if top hat was using [opening method](./opening 'internal link on open method'), bottom hat is using [closing method](./closing 'internal link on close method').
The purpose of bottom hat(or, as it is also called, _black-hat_) is to enhance and extract **darker** regions of the image.

<BottomHatDemo />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 80
---

import CannyEdgeDemo from './demos/cannyEdgeDetector.demo.tsx'
import CannyEdgeDemo from './demos/cannyEdgeDetector.demo.tsx';

# Canny Edge Detector

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 40
---

import CloseDemo from './demos/close.mask.demo.tsx'
import CloseDemo from './demos/close.mask.demo.tsx';

# Closing

Expand All @@ -11,7 +11,7 @@ _Combines a dilation filter followed by an erosion filter._
[🖼️ Image options and parameters of `close` method](https://api.image-js.org/classes/index.Image.html#close)
[🎭 Mask options and parameters of `close` method](https://api.image-js.org/classes/index.Mask.html#close)

Opposed to [opening](./opening.md 'internal link to open method'), [closing process](<https://en.wikipedia.org/wiki/Closing_(morphology)> 'wikipedia link on closing') first [erodes](./erosion.md 'internal link to erode method') an image and only then [dilates](./dilation.md 'internal link to dilate method') it.
Opposed to [opening](./opening.mdx 'internal link to open method'), [closing process](<https://en.wikipedia.org/wiki/Closing_(morphology)> 'wikipedia link on closing') first [erodes](./erosion 'internal link to erode method') an image and only then [dilates](./dilation 'internal link to dilate method') it.
It is a useful process for filling small holes in the image, while preserving the shape and size of large holes and objects.

<CloseDemo />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 20
---

import DilateDemo from './demos/dilate.mask.demo.tsx'
import DilateDemo from './demos/dilate.mask.demo.tsx';

# Dilation

Expand Down
Loading