.. _program_listing_file__tmp_ws_src_vitis_common_include_imgproc_xf_hog_descriptor_kernel.hpp: Program Listing for File xf_hog_descriptor_kernel.hpp ===================================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/vitis_common/include/imgproc/xf_hog_descriptor_kernel.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* * Copyright 2019 Xilinx, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _XF_HOG_DESCRIPTOR_KERNEL_HPP_ #define _XF_HOG_DESCRIPTOR_KERNEL_HPP_ #ifndef __cplusplus #error C++ is needed to include this header #endif #include "hls_stream.h" #include "../common/xf_common.hpp" #include "../common/xf_utility.hpp" #include "../core/xf_math.h" #include "xf_hog_descriptor_utility.hpp" #include "xf_hog_descriptor_gradients.hpp" #include "xf_hog_descriptor_pm.hpp" #include "xf_hog_descriptor_hist_norm.hpp" /******************************************************************************************** * xFDHOG function ******************************************************************************************** * This function calls the various pipelined functions for computing the HoG descriptors. * * _in_stream: input image stream * _block_stream: block stream (O) desc data written to this stream * ********************************************************************************************/ template void xFDHOGKernel(hls::stream _in_stream[NOC], hls::stream& _block_stream, uint16_t _height, uint16_t _width) { // streams for dataflow between various processes hls::stream grad_x_stream, grad_y_stream; hls::stream phase_stream("phase_stream"), mag_stream("mag_stream"); // clang-format off #pragma HLS DATAFLOW // clang-format on // gradient computation xFHOGgradients( _in_stream, grad_x_stream, grad_y_stream, XF_BORDER_CONSTANT, _height, _width); // finding the magnitude and the phase for the gradient data xFHOGPhaseMagnitude( grad_x_stream, grad_y_stream, phase_stream, mag_stream, _height, _width); // Descriptor function where the histogram is computed and the blocks are normalized xFDHOGDescriptor( phase_stream, mag_stream, _block_stream, _height, _width); } /*********************************************************************** * xFDHOG function *********************************************************************** * This function acts as wrapper function for xFDHOGKernel * * _in_stream: This stream contains the input image data (I) * _block_stream: This stream contaisn the output descriptor data (O) * ***********************************************************************/ template void xFDHOG(hls::stream _in_stream[NOC], hls::stream& _block_stream, uint16_t _height, uint16_t _width) { //#pragma HLS license key=IPAUVIZ_HOG // Updating the _width based on NPC _width = _width >> XF_BITSHIFT(NPC); #ifndef __SYNTHESIS__ assert(((_height <= ROWS) && (_width <= COLS)) && "ROWS and COLS should be greater than input image"); assert((NPC == XF_NPPC1) && "The NPC value must be XF_NPPC1"); #endif if (NPC == XF_NPPC1) { xFDHOGKernel(_in_stream, _block_stream, _height, _width); } } #endif // _XF_HOG_DESCRIPTOR_KERNEL_HPP_