Thank you very much for reading my question . A newbie here sorry if my question isnt asked quite right
for example I have this image and want to convert it to binary tensor that only has 1s and 0s, I was just using
import torch
import numpy as np
from PIL import Image
from torchvision import transforms
import torchvision.transforms.functional as fn
cc = Image.open("C:/Users/T/Desktop/circle.png")
cc = fn.resize(cc, size=[300,200])
tt = transforms.ToTensor()
gg = transforms.Grayscale()
circle_tensor = gg(tt(cc))
circle_np = circle_tensor[0].numpy()
pd.DataFrame(circle_np).to_csv("C:/Users/T/Desktop/circle.csv")
and it becomes a tensor that has only 1 representing white and 0 representing black.
here is another example of a line ,
I was just wondering , instead of converting an image into a tensor ,
if I knew the geometric coordinates of the shape in the image . ie , the center of the circle and its radius , and for the line , the two ends points [x,y], [x1,y1] coordinates . can I create this binary tensor directly within pytorch.
ie through something like a for loop or more efficient method
zz = torch.zeros(300,200)
for x in range(zz.shape[0]):
...
and some for loop ? at the moment Im using drawing it as image first and convert in this way which doesnt feel quite right in my specific situation where I know the coordinates,
Thank you very much for your time in reading and helping out.!