Normalization of image in python

 from sklearn import preprocessing

import cv2

####

## you can normalize each of rgb channel of image separately, and combine them as well.

####

img_data = cv2.imread(path)

b,g,r = cv2.split(img_data)

data_scaler = preprocessing.MinMaxScaler(feature_range = (0, 1))

b = data_scaler.fit_transform(b)

g = data_scaler.fit_transform(g)

r = data_scaler.fit_transform(r)        

img_data = cv2.merge((b,g,r))

No comments:

Post a Comment

Building a CLI-Based People Tracking and Dwell Time Analytics System Using YOLOv8 and DeepSORT

  Introduction Tracking people across video frames and analyzing their behavior (like  dwell time ) is a crucial task for many real-world ap...