Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
331 views
in Technique[技术] by (71.8m points)

region of interest image into subset with python

How to do region of interest selected in the image and evenly divided into multiple subsets, whose size and spacing are defined by the user (the subset size and step size, respectively) with python?? '''

images = []
folder = pathF
for filename in os.listdir(folder):
    sorted(filename)
try:
    img = mpimg.imread(os.path.join(folder, filename))
    
    if img is not None:
        images.append(img)
except:
    print('Cant import ' + filename)
images = np.asarray(images)
img_num = len(images) 
ref_img = images[0]
#Roi 

print(len(images))
roi = cv2.selectROI(ref_img)
print(roi)
roi_cropped = [] 
for imagefile in images:
    roi_cropped.append(imagefile[int(roi[1]):int(roi[1]+roi[3]),  int(roi[0]):int(roi[0]+roi[2])])

print(roi_cropped)    
plt.imshow(roi_cropped[10], cmap='gray')    
roi_ref_img = roi_cropped[0]

Next, how do I divide it into subset?

question from:https://stackoverflow.com/questions/66063774/region-of-interest-image-into-subset-with-python

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...