Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 从原始图像的HoG特征直接获取编辑图像的HoG特征_Python_Image_Image Processing_Computer Vision_Scikit Image - Fatal编程技术网

Python 从原始图像的HoG特征直接获取编辑图像的HoG特征

Python 从原始图像的HoG特征直接获取编辑图像的HoG特征,python,image,image-processing,computer-vision,scikit-image,Python,Image,Image Processing,Computer Vision,Scikit Image,我有很多图像,我从中提取了猪的特征并保存了它们 我现在丢失了图像,这显然是一个数据集,在机器出问题之前我没有备份 但是,我有包含这些图像特征的文件 如果我现在有这些图像,我会对图像应用剪切和旋转来创建更多的样本,然后获取这些编辑图像的特征 但是因为我没有这些图像。。。是否有可能仅处理原始文件的HoG特征,以获得编辑文件的HoG特征 这是我将用来编辑图像的代码,如果我仍然有这些图像,我将从中提取用于对象分类的HoG特征: import numpy as np from skimage import

我有很多图像,我从中提取了猪的特征并保存了它们

我现在丢失了图像,这显然是一个数据集,在机器出问题之前我没有备份

但是,我有包含这些图像特征的文件

如果我现在有这些图像,我会对图像应用剪切和旋转来创建更多的样本,然后获取这些编辑图像的特征

但是因为我没有这些图像。。。是否有可能仅处理原始文件的HoG特征,以获得编辑文件的HoG特征

这是我将用来编辑图像的代码,如果我仍然有这些图像,我将从中提取用于对象分类的HoG特征:

import numpy as np
from skimage import data, io, filter, color, exposure
from skimage.feature import hog
import skimage.transform as tf
from skimage.transform import resize, rescale, rotate, setup, warp, AffineTransform
import matplotlib.pyplot as plt
import os
from os import listdir
from os.path import isfile, join
import pickle
import Image

def generateSamples(path, readfile):
    print "generating samples from  " + path+"\\"+readfile
    img = color.rgb2gray(io.imread(path+"\\"+readfile))
    img = resize(img, (50,100))
    filename = os.path.splitext(readfile)[0]
    angles = [3, 0, -3]
    shears = [0.13, 0.0, -0.13]
    i = 0
    no_samples = len(angles) * len(shears)
    samples = np.empty((no_samples, int(img.shape[0]), int(img.shape[1])), dtype=object)
    for myangle in angles:
        myimg = rotate(img, angle=myangle, order=2)
        for myshear in shears:
            afine_tf = tf.AffineTransform(shear=myshear)
            mymyimg = tf.warp(myimg, afine_tf)
            samples[i] = np.array(mymyimg)
            i+=1
            #io.imshow(mymyimg)
            #io.show()  
    newfile = filename + "_samples.vec"
    pickle.dump(samples, file(path+"\\"+newfile,'w'))
    print "saved vec file"