From eb3da63d1e21d77a1836543827bf227e41f307f5 Mon Sep 17 00:00:00 2001 From: Michael Lachut Date: Fri, 24 Nov 2023 10:25:32 -0500 Subject: [PATCH] moar guides --- .../doc/docs/opencv/bitwise-operations.md | 32 ++++++++ HelpPage/doc/docs/opencv/blob-and-edge.md | 11 +++ HelpPage/doc/docs/opencv/common-methods.md | 76 +++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 HelpPage/doc/docs/opencv/bitwise-operations.md create mode 100644 HelpPage/doc/docs/opencv/blob-and-edge.md create mode 100644 HelpPage/doc/docs/opencv/common-methods.md diff --git a/HelpPage/doc/docs/opencv/bitwise-operations.md b/HelpPage/doc/docs/opencv/bitwise-operations.md new file mode 100644 index 000000000000..00a1b3598f10 --- /dev/null +++ b/HelpPage/doc/docs/opencv/bitwise-operations.md @@ -0,0 +1,32 @@ +--- +sidebar_position: 5 +title: Bitwise Operations +sidebar_label: Bitwise Operations +--- + +# Bitwise Operations + +Bitwise operations are operations that are performed on the binary representation of a number. They are very useful for +combining images, using masks, and more. + +There are two most common bitwise operations: `and` and `not`. + +There is also `or` and `xor`, but I have yet to find a use for these, so I will not be covering them. You can google them if you want to learn more. + +## And + +The `and` operation is used to combine two images. This allows us to use masks to only show certain parts of an image. +A common use is to have a mask (say one provided by the `inRange` method) and use it to only show the parts of the image +where the mask is white. + +```java +Core.bitwise_and(Mat src1, Mat src2, Mat dst) +``` + +## Not + +The `not` operation is used to invert an image. + +```java +Core.bitwise_not(Mat src, Mat dst) +``` \ No newline at end of file diff --git a/HelpPage/doc/docs/opencv/blob-and-edge.md b/HelpPage/doc/docs/opencv/blob-and-edge.md new file mode 100644 index 000000000000..bfde9a1abb1f --- /dev/null +++ b/HelpPage/doc/docs/opencv/blob-and-edge.md @@ -0,0 +1,11 @@ +--- +sidebar_position: 6 +title: Blob and Edge Detection +sidebar_label: Blob and Edge Detection +--- + +# WIP + +This section is work in progress. Please check back later. + +For now just google it (or use github copilot) \ No newline at end of file diff --git a/HelpPage/doc/docs/opencv/common-methods.md b/HelpPage/doc/docs/opencv/common-methods.md new file mode 100644 index 000000000000..c6da1aa8830e --- /dev/null +++ b/HelpPage/doc/docs/opencv/common-methods.md @@ -0,0 +1,76 @@ +--- +sidebar_position: 4 +title: Common Methods +sidebar_label: Common Methods +--- + +# Common Methods + +While we can't go over every single method in OpenCV, we will briefly go over some of the more common methods that will +depend on what you are trying to accomplish. + +We are always adding more methods to this page, but if you don't see a method you need, you can always google it. + +## Mean value +```java +Core.mean(Mat mat) +``` + +Find the mean value of an image. + +**Parameters:** +- `mat`: The image to find the mean value of. + +**Returns:** A `Scalar` object containing the mean value of the image, seperated by channel. + +**Example:** +```java +Scalar mean = Core.mean(input); + +mean.val[0]; // Mean value of the first channel +mean.val[1]; // Mean value of the second channel +mean.val[2]; // Mean value of the third channel +``` + +## In Range +```java +Core.inRange(Mat src, Scalar lowerBound, Scalar upperBound, Mat dst) +``` + +Get a binary image of the pixels in a certain range. If the pixel is in the range, it will be white, otherwise it will be black. + +**Parameters:** +- `src`: The image to find the mean value of. +- `lowerBound`: The lower bound of the range. +- `upperBound`: The upper bound of the range. +- `dst`: The output image. + +**Returns:** None + +**Example:** +```java +Scalar lowerBound = new Scalar(0, 0, 0); +Scalar upperBound = new Scalar(255, 255, 255); +Mat dst = new Mat(); + +Core.inRange(input, lowerBound, upperBound, dst); +``` + +## Split +```java +Core.split(Mat src, List dst) +``` + +Split an image into its channels. + +**Parameters:** +- `src`: The image to split. +- `dst`: The list of images to store the channels in. + +**Returns:** None + +**Example:** +```java +ArrayList channels = new ArrayList<>(); +Core.split(input, channels); +``` \ No newline at end of file