ImageProvider
plantimager.controller.ImageProvider Link
ImageProvider Link
ImageProvider()
Bases: QQuickImageProvider
Provides images from memory to QML
Source code in plantimager/controller/ImageProvider.py
132 133 134 | |
compute_focus Link
compute_focus(image)
Computes the focus measure of an image using the Sobel filter.
This function calculates the gradient magnitude of an input image in the x and y directions, combining the results to estimate focus. The computed focus measure highlights edges and areas of high intensity change, which are often indicative of regions in focus.
see https://blog.roboflow.com/computer-vision-camera-focus-guide/#tenengrad-function
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
ndarray
|
A 2D array representing the input grayscale image whose focus measure is to be computed. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
A 2D array representing the gradient magnitude of the input image, where higher values correspond to more focused regions. |
Source code in plantimager/controller/ImageProvider.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | |
focus_highlight Link
focus_highlight(image, percentile)
Enhances the focus areas of an image by adding a red highlight to regions of the image that have a focus value greater than a specified percentile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
QImage
|
The input image to be processed. Must be in the QImage format. |
required |
percentile
|
float
|
The percentile threshold for selecting focus areas. Focus values above this percentile will be highlighted. |
required |
Returns:
| Type | Description |
|---|---|
QImage
|
A new image with highlighted focus areas in red. |
Source code in plantimager/controller/ImageProvider.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |