Is there a GStreamer filter that does normalization on an image?
chrisp
itschrislytle at gmail.com
Thu Jun 27 22:04:07 UTC 2019
Hello GStreamer Devel World!
I'm trying to create a GStreamer pipeline that can do image processing.
Specifically, I'm doing image pre-processing to be used by machine learning
networks. So this pipeline will do all the necessary pre-processing steps
before it is fed to the neural network.
Right now, I'm trying to figure out if there are any GStreamer plugins that
can simply do normalization.
GStreamer does allow programmers to create custom plugins for applications.
This is one solution to this question, but I want to find out if there are
any pre-existing solutions.
I've looked into GStreamers list of plugins on their website but there are a
lot and some descriptions aren't clear, to me, what they do or how to use
them.
I assume that the pipeline would look something like this:
gst-launch-1.0 videotestsrc ! decodebin ! imagefreeze ! videoconvert !
<PREPROCESS FILTER> ! videoconvert ! autovideosink
If anyone is curious, this is the normalization method that I want to
replicate for my GStreamer pipeline.
# Python code for image preprocessing
def preprocess(img_data):
mean_vec = np.array([0.485, 0.456, 0.406])
stddev_vec = np.array([0.229, 0.224, 0.225])
norm_img_data = np.zeros(img_data.shape).astype('float32')
for i in range(img_data.shape[0]):
# for each pixel in each channel, divide the value by 255 to get
value between [0, 1] and then normalize
norm_img_data[i,:,:] = (img_data[i,:,:]/255 - mean_vec[i]) /
stddev_vec[i]
return norm_img_data
Anything might help!!! I'm still new to GStreamer and still learning. Thank
you in advance!
--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
More information about the gstreamer-devel
mailing list