You can try:
gray = cv2.convertScaleAbs(sobely, alpha=255/sobely.max())
plt.imshow(gray, cmap='gray')
Answer from sim0ne on Stack Overflow Top answer 1 of 2
6
You can try:
gray = cv2.convertScaleAbs(sobely, alpha=255/sobely.max())
plt.imshow(gray, cmap='gray')
2 of 2
4
You can accept the default arguments for the alpha and beta arguments, so the call is simply:
graySobel = cv.convertScaleAbs(sobely)
Then you can call adaptiveThreshold:
thres = cv2.adaptiveThreshold(graySobel, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,
cv2.THRESH_BINARY, 73, 2)
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.
Pub.dev
pub.dev › documentation › opencv_dart › latest › cv › convertScaleAbs.html
convertScaleAbs function - cv library - Dart API
ConvertScaleAbs scales, calculates absolute values, and converts the result to 8-bit.
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:
Pub.dev
pub.dev › documentation › dartcv_videoio › latest › cv.videoio › convertScaleAbs.html
convertScaleAbs function - cv.videoio library - Dart API
ConvertScaleAbs scales, calculates absolute values, and converts the result to 8-bit.
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 ...
TutorialsPoint
tutorialspoint.com › article › how-to-change-the-contrast-and-brightness-of-an-image-using-opencv-in-python
How to change the contrast and brightness of an image using OpenCV in Python?
March 26, 2026 - In OpenCV, to change the contrast and brightness of an image we use cv2.convertScaleAbs() method.
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
Shimat
shimat.github.io › opencvsharp_docs › html › ea8dcfb6-a5dd-899a-efff-a10f3a3d7b29.htm
Mat.ConvertScaleAbs Method
public: Mat^ ConvertScaleAbs( double alpha = 1, double beta = 0 )
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)
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()