也许这只是我的误解,但你如何重用pyfftw对象呢?
当我运行类似下面的代码时,img1_fft
和img2_fft
尽管收到不同的输入,但它们是相同的。当我取消注释重构fftwObj
的行时,我得到了所需的输出。
inArray = pyfftw.empty_aligned(optimalSize, dtype='complex64')
inArray[ 0:img1.shape[0] , 0:img1.shape[1] ] = img1;
fftwObj = pyfftw.builders.fft2(inArray)
img1_fft = fftwObj(inArray)
inArray = pyfftw.empty_aligned(optimalSize, dtype='complex64')
inArray[ 0:img2.shape[0] , 0:img2.shape[1] ] = img2;
# fftwObj = pyfftw.builders.fft2(inArray)
img2_fft = fftwObj(inArray)
我做错了事,因为"计划"是不是要重建pyfftw对象?我想使用相同的pyfftw对象(因为我的所有图像都是相同的大小),只需更改对象的输入。
答案 0 :(得分:1)
这是设计的。除了显式之外,没有输出数组的副本,因此<script src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.js"></script>
<script src="https://unpkg.com/infinite-scroll@3/dist/infinite-scroll.pkgd.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h1>Infinite Scroll - Loading JSON + Masonry</h1>
<p>Loading photos from the <a href="https://unsplash.com/developers?utm_source=infinite-scroll-demos&utm_medium=referral&utm_campaign=api-credit">Unsplash API</a></p>
<button id="n_photo" >check</button>
<button id="destroy" >Destroy</button>
<div class="grid">
<div class="grid__col-sizer"></div>
<div class="grid__gutter-sizer"></div>
</div>
<div class="grid_b">
<div class="grid_b__col-sizer"></div>
<div class="grid_b__gutter-sizer"></div>
</div>
<div class="page-load-status">
<div class="loader-ellips infinite-scroll-request">
<span class="loader-ellips__dot"></span>
<span class="loader-ellips__dot"></span>
<span class="loader-ellips__dot"></span>
<span class="loader-ellips__dot"></span>
</div>
<p class="infinite-scroll-last">End of content</p>
<p class="infinite-scroll-error">No more pages to load</p>
</div>
<!-- .photo-item template HTML -->
<script type="text/html" id="photo-item-template">
<div class="photo-item">
<img class="photo-item__image" src="{{urls.regular}}" alt="Photo by {{user.name}}" />
<p class="photo-item__caption">
<a href="{{user.links.html}}?utm_source=infinite-scroll-demos&utm_medium=referral&utm_campaign=api-credit">{{user.name}}</a>
</p>
</div>
</script>
返回img2_fft is img1_fft
。
您可以使用True
复制输出,也可以从自己的阵列中明确set the output array。