You can try:

gray = cv2.convertScaleAbs(sobely, alpha=255/sobely.max())
plt.imshow(gray, cmap='gray')

Answer from sim0ne on Stack Overflow
🌐
Shimat
shimat.github.io › opencvsharp_docs › html › 7633dbe6-e0b8-23bf-6966-dc9b4720e3d1.htm
Cv2.ConvertScaleAbs Method
public static void ConvertScaleAbs( InputArray src, OutputArray dst, double alpha = 1, double beta = 0 )
🌐
Readthedocs
opencv-laboratory.readthedocs.io › en › latest › nodes › core › convertScaleAbs.html
convertScaleAbs — OpenCV Laboratory 1.0 alpha documentation
convertScaleAbs · Edit on GitHub · Scales, calculates absolute values, and converts the result to 8-bit. alpha_in – Optional scale factor. beta_in – Optional delta added to the scaled values. image_in – Input image.
🌐
DEV Community
dev.to › jarvissan22 › cv2-what-is-an-image-lets-adjust-the-brightness-and-contrast-of-an-image-35po
CV2: What is an Image?, Lets adjust the Brightness and Contrast of an image - DEV Community
November 29, 2024 - Example Usage: new_image = cv2.convertScaleAbs(image, alpha=contrast, beta=brightness) This allows us to easily modify brightness and contrast without manually clipping pixel values.
🌐
Openlvvision
openlvvision.org › home › opencv › core functionality › arithmetic operations › convertscaleabs
ConvertScaleAbs | OpenLvVision
On each element of the input array, the function convertScaleAbs performs three operations sequentially: scaling, taking an absolute value, and conversion to an unsigned 8-bit type:
🌐
Amroamroamro
amroamroamro.github.io › mexopencv › matlab › cv.convertScaleAbs.html
cv.convertScaleAbs - mexopencv
cv.convertScaleAbs - Scales, calculates absolute values, and converts the result to 8-bit
🌐
OpenCV
docs.opencv.org › 3.4.20 › d2 › de8 › group__core__array.html
OpenCV: Operations on arrays
On each element of the input array, the function convertScaleAbs performs three operations sequentially: scaling, taking an absolute value, conversion to an unsigned 8-bit type:
Find elsewhere
🌐
GitHub
github.com › opencv › opencv › issues › 11751
What's the operation dose "cv2.convertScaleAbs" actually do? · Issue #11751 · opencv/opencv
June 13, 2018 - I want to convert a float64 array to uint8 array. The result given by cv2.convertScaleAbs looked correct iin cv2.imshow. But when I followed doc to implement it by tensorflow and numpy, it got different result. Part of source array: scal...
🌐
Emgu
emgu.com › wiki › files › 3.0.0 › document › html › 42f48437-3b3c-28ec-4fb1-cf6c90374f46.htm
CvInvoke.ConvertScaleAbs Method
public: static void ConvertScaleAbs( IInputArray^ src, IOutputArray^ dst, double scale, double shift )
🌐
OpenCV
docs.opencv.org › 4.13.0 › d3 › dc1 › tutorial_basic_linear_transform.html
OpenCV: Changing the contrast and brightness of an image!
new_image = cv.convertScaleAbs(image, alpha=alpha, beta=beta) cv::convertScaleAbs · void convertScaleAbs(InputArray src, OutputArray dst, double alpha=1, double beta=0) Scales, calculates absolute values, and converts the result to 8-bit. where cv::Mat::convertTo would effectively perform ...
🌐
YouTube
youtube.com › computer vision lab
OPENCV & C++ TUTORIALS - 99 | convertScaleAbs() | Absolute conversion of pixels - YouTube
The convertScaleAbs() function in OpenCV is used to perform scaling and absolute value conversion on the elements of an input array. It is primarily used for...
Published: June 19, 2023
Views: 476
🌐
AMD
docs.amd.com › r › en-US › Vitis_Libraries › vision › api-reference.html_1_28
convertScaleAbs - 2024.2 English
Loading application · Your web browser must have JavaScript enabled in order for this application to display correctly
🌐
Medium
arsanatl.medium.com › mastering-basic-image-operations-in-opencv-e2e8821b50bd
Mastering Basic Image Operations in OpenCV | by Sanat Ladkat | Medium
August 24, 2024 - import cv2 import numpy as np # Load an image image = cv2.imread('example.jpg') # Adjust brightness and contrast alpha = 1.5 # Contrast control (1.0-3.0) beta = 50 # Brightness control (0-100) adjusted_image = cv2.convertScaleAbs(image, alpha=alpha, beta=beta) # Save the adjusted image cv2.imwrite('brightness_contrast_example.jpg', adjusted_image)
🌐
GitHub
github.com › feler404 › ocvl-addon › blob › master › docs › nodes › core › convertScaleAbs.rst
ocvl-addon/docs/nodes/core/convertScaleAbs.rst at master · feler404/ocvl-addon
Framework to ease manage OpenCV algorithms based on Blender - ocvl-addon/docs/nodes/core/convertScaleAbs.rst at master · feler404/ocvl-addon
Author: feler404
🌐
Kyamagu
kyamagu.github.io › mexopencv › matlab › convertScaleAbs.html
cv.convertScaleAbs - MATLAB File Help
On each element of the input array, the function cv.convertScaleAbs performs three operations sequentially: scaling, taking an absolute value, conversion to an unsigned 8-bit type:
🌐
GeeksforGeeks
geeksforgeeks.org › image-enhancement-techniques-using-opencv-python
Image Enhancement Techniques using OpenCV - Python - GeeksforGeeks
April 28, 2025 - #Import the necessary libraries import cv2 import matplotlib.pyplot as plt import numpy as np # Load the image image = cv2.imread('GFG.jpeg') #Plot the original image plt.subplot(1, 2, 1) plt.title("Original") plt.imshow(image) # Adjust the brightness and contrast # g(i,j)=α⋅f(i,j)+β # control Contrast by 1.5 alpha = 1.5 # control brightness by 50 beta = 50 image2 = cv2.convertScaleAbs(image, alpha=alpha, beta=beta) #Save the image cv2.imwrite('Brightness & contrast.jpg', image2) #Plot the contrast image plt.subplot(1, 2, 2) plt.title("Brightness & contrast") plt.imshow(image2) plt.show()