Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Wed May 12 13:59:27 2021
- @author: Sajid
- """
- from skimage.io import imread, imshow
- from skimage.filters import gaussian, threshold_otsu
- from skimage.feature import canny
- from skimage.transform import probabilistic_hough_line, rotate
- #testing
- import numpy as np
- import os
- import cv2
- import math
- import matplotlib.pyplot as plt
- import torch
- from torch import nn
- from torch import optim
- import torch.nn.functional as F
- from torchvision import datasets, transforms, models
- from collections import OrderedDict
- from PIL import Image
- import pandas as pd
- import seaborn as sns
- for i in range(0,1018):
- img=Image.open("F:\Thesis Files\Words2\%d.png" %i)
- img=np.uint8(img)
- img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
- tmp=img.shape
- print(i)
- print(tmp)
- if len(tmp)==2:
- img=cv2.merge([img,img,img])
- print('sajid')
- cv2.imwrite("%d.jpg" %(i),img)
- cv2.waitKey(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement