猿问

蟒蛇图像上的滑动窗口

我想把这个矩阵代码转换为python:


images = []; 

foreach image in images:

     features = [];

     windows = extractWindows(image,size=(30,30),stride=(30,30));

     foreach window in windows:

          featureVector = extractFeatures(window);

          features.append(featureVector);

     saveAsCSV('image_name_features.txt',features);


狐的传说
浏览 84回答 1
1回答

四季花海

def sliding_window(image, stepSize, windowSize):  for y in range(0, image.shape[0], stepSize):    for x in range(0, image.shape[1], stepSize):      yield (x, y, image[y:y + windowSize[1], x:x + windowSize[0]])def extractFeatures(window):  # fast? sift? orb? or something?  return featuresimages = []for image in images:  features = []  windows = sliding_window(image, 30, (30, 30))  for window in windows:    featureVector = extractFeatures(window)    features.append(featureVector)  numpy.savetxt('image_name_features.txt', feautres, delimiter=",")
随时随地看视频慕课网APP

相关分类

Python
我要回答