情報詳細Q. C++でdouble型の配列をHALCONに渡してFFTするサンプルはありますでしょうか?A. 下記のサンプルをご参照ください #include <windows.h> #include <stdio.h> #include <halconcpp.h> using namespace HalconCpp; int main() { HObject ho_Image, ho_ImageFFT, ho_CircleOut; HObject ho_CircleIn, ho_BandpassArea, ho_ImageReduced, ho_ZeroFillArea; HObject ho_ImageFFTFiltered, ho_ImageFiltered; HTuple hv_Width, hv_Height, hv_Grayval; constexpr size_t size = 100; HTuple WindowHandle; OpenWindow(0, 0, HTuple(int(size)), HTuple(int(size)), 0, "visible", "", &WindowHandle); double buf[size][size]{ 0 }; GenImageConst(&ho_Image, "real", 100, 100); for (size_t i = 0; i < size; i++) { for (size_t j = 0; j < size; j++) { buf[i][j] = 655.35 * (i + j) - 65535.1; SetGrayval(ho_Image, HTuple(int(i)), HTuple(int(j)), buf[i][j]); } } DispObj(ho_Image, WindowHandle); WriteImage(ho_Image, "tiff", 0, "./input"); WaitSeconds(5.0); FftGeneric(ho_Image, &ho_ImageFFT, "to_freq", -1, "sqrt", "dc_center", "complex"); //Sample Filter(ref. remove_texture_fft.hdev) GetImageSize(ho_ImageFFT, &hv_Width, &hv_Height); GenCircle(&ho_CircleOut, hv_Width / 2, hv_Height / 2, ((hv_Width.TupleConcat(hv_Height)).TupleMin()) / 4); GenCircle(&ho_CircleIn, hv_Width / 2, hv_Height / 2, ((hv_Width.TupleConcat(hv_Height)).TupleMin()) / 6); Difference(ho_CircleOut, ho_CircleIn, &ho_BandpassArea); ReduceDomain(ho_ImageFFT, ho_BandpassArea, &ho_ImageReduced); Complement(ho_BandpassArea, &ho_ZeroFillArea); PaintRegion(ho_ZeroFillArea, ho_ImageReduced, &ho_ImageFFTFiltered, 0, "fill"); // FftGeneric(ho_ImageFFTFiltered, &ho_ImageFiltered, "from_freq", 1, "sqrt", "dc_center", "real"); DispObj(ho_ImageFiltered, WindowHandle); WriteImage(ho_ImageFiltered, "tiff", 0, "./output"); for (size_t i = 0; i < size; i++) { for (size_t j = 0; j < size; j++) { GetGrayval(ho_ImageFiltered, HTuple(int(i)), HTuple(int(j)), &hv_Grayval); buf[i][j] = hv_Grayval; } } WaitSeconds(5.0); return 0; } 添付ファイルタイトルQ. C++でdouble型の配列をHALCONに渡してFFTするサンプルはありますでしょうか?URL 名000012059公開状況公開済み検証状況未検証