+ 3

How do I center an image in python preprocessing? I need to preprocess CEDAR signature dataset.

Python preprocessing of dataset

31st Jan 2024, 2:19 AM
Jaz
Jaz - avatar
7 Réponses
+ 3
so what you want is to use opencv to detect the ROI (signatures) and center it then perhaps crop or resize the images? but looking at the dataset, it seems that the primary problem is that the cropping and size of the images varies across the different folders. Perhaps you mean to address that problem?
31st Jan 2024, 1:03 PM
Bob_Li
Bob_Li - avatar
+ 3
Here you can see methods for standardization, normalization and scaling - this is the first adress for information: https://scikit-learn.org/stable/modules/preprocessing.html
1st Feb 2024, 3:29 PM
JaScript
JaScript - avatar
+ 1
31st Jan 2024, 8:53 AM
Bob_Li
Bob_Li - avatar
+ 1
I used OpenCv and OS
31st Jan 2024, 11:14 AM
Jaz
Jaz - avatar
+ 1
basically, you can crop, resize or pad so that all the images have the same dimensions. First determine the actual dimension of the image you are going to use in your training data. Then write a python script to bstch process your files. read these: https://blog.roboflow.com/you-might-be-resizing-your-images-incorrectly/#:~:text=Principally%2C%20our%20machine%20learning%20models,and%20that%20time%20adds%20up. https://stackoverflow.com/questions/60439843/how-do-i-resize-images-in-python-for-machine-learning https://zuru.tech/blog/the-dangers-behind-image-resizing
1st Feb 2024, 2:53 AM
Bob_Li
Bob_Li - avatar
0
Hello you can center an image in Python preprocessing, you typically need to calculate the offset needed to move the image to the center of a desired canvas size and then apply this offset to the image. 1- Load the image. 2- Determine the desired canvas size. 3- Calculate the offset needed to center the image on the canvas. 4- Apply the offset to the image. 5- Save or display the centered image.
1st Feb 2024, 11:55 AM
Code With Nouman
Code With Nouman - avatar
0
Try look at TensorFlow library for that..
1st Feb 2024, 11:55 PM
Smith Welder
Smith Welder - avatar