File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -227,3 +227,9 @@ tools/datagen/src/imgs/*_sobel_*
227227# Ignore VCD files
228228* .vcd
229229test
230+
231+ # Ignore output images
232+ modules /filter /* .bitmap
233+ modules /filter /* .gif
234+ modules /filter /* .jpg
235+ modules /filter /* .png
Original file line number Diff line number Diff line change @@ -64,6 +64,8 @@ void run_image()
6464 cv::Mat image;
6565 read_image.convertTo (image, CV_32F);
6666
67+ cv::Mat o_img (image.size (), image.type ());
68+
6769#ifdef IPS_DUMP_EN
6870 std::cout << " Loading image: " << img_path << std::endl;
6971#endif // IPS_DUMP_EN
@@ -168,8 +170,10 @@ void run_image()
168170 result = s_result.read ();
169171#endif // IPS_FILTER_XX_EN
170172
173+ o_img.at <IPS_OUT_TYPE_TB>(y, x) = result;
174+
171175#ifdef IPS_DEBUG_EN
172- std::cout << " Result[" << x << " ][" << y << " ] = " << result << std::endl << std::endl;
176+ std::cout << " Result[" << x << " ][" << y << " ] = " << o_img. at <IPS_OUT_TYPE_TB>(y, x) << std::endl << std::endl;
173177#endif // IPS_DEBUG_EN
174178 }
175179 }
@@ -178,6 +182,14 @@ void run_image()
178182 sc_start (1 , SC_NS);
179183#endif // IPS_DUMP_EN
180184
185+ // Convert the floating-point image to 8-bit unsigned integer for saving
186+ cv::Mat final_img;
187+ o_img.convertTo (final_img, CV_8U, 1.0 );
188+
189+ // Save the final image
190+ std::string output_img_path = " filtered_image.png" ;
191+ cv::imwrite (output_img_path, final_img);
192+
181193 delete [] img_window;
182194}
183195#endif // TEST_MODE_IMAGE
You can’t perform that action at this time.
0 commit comments