Visionworks output error

Running the candy operation on an image ,output is not expected.

#include
#include “NVX/nvx.h”
#include “NVX/nvx_opencv_interop.hpp”
#include “opencv2/opencv.hpp”
#include <glog/logging.h>
#include “NVX/Utility.hpp”
//#include “NVX/FrameSource.hpp”
//#include “NVX/nvxcu.h”

int main(int argc, char **argv) {
FLAGS_alsologtostderr = 1;
google::InitGoogleLogging(argv[0]);
vx_context context = vxCreateContext();
// 输入
std::string sourceUri = “./rocket.jpg”;
cv::Mat cv_src = cv::imread(sourceUri, cv::IMREAD_GRAYSCALE);
vx_image source = nvx_cv::createVXImageFromCVMat(context, cv_src);
LOG(INFO) << “cv load image”;
// vx_image source = nvxio::loadImageFromFile(context, sourceUri, VX_DF_IMAGE_U8);
vx_uint32 width, height;
vxQueryImage(source, VX_IMAGE_WIDTH, &width, sizeof(width));
vxQueryImage(source, VX_IMAGE_HEIGHT, &height, sizeof(height));
//输出
cv::Mat cv_dst(cv_src.size(), CV_8UC1);
// vx_image edges = vxCreateImage(context, width, height, VX_DF_IMAGE_U8);
vx_image edges = nvx_cv::createVXImageFromCVMat(context, cv_dst);
vx_threshold hyst = vxCreateThreshold(context, VX_THRESHOLD_TYPE_RANGE, VX_TYPE_INT16);
vx_int32 lowerThresh = 230, upperThresh = 250;
vxSetThresholdAttribute(hyst, VX_THRESHOLD_THRESHOLD_LOWER,
&lowerThresh, sizeof(lowerThresh));
vxSetThresholdAttribute(hyst, VX_THRESHOLD_THRESHOLD_UPPER,
&upperThresh, sizeof(upperThresh));
LOG(INFO) << “set up threshold”;
// Finally, the VisionWorks primitives are called in immediate mode.
// Note that intermediate data objects are created as normal images.
vx_image filtered = vxCreateImage(context, width, height, VX_DF_IMAGE_U8);

vx_image equalized = vxCreateImage(context, width, height, VX_DF_IMAGE_U8);
LOG(INFO) << "ready to go.";
vxuMedian3x3(context, source, filtered);
LOG(INFO) << "done filter 3x3";
vxuEqualizeHist(context, filtered, equalized);
LOG(INFO) << "done equalize hist";
vxuCannyEdgeDetector(context, equalized, hyst, 3, VX_NORM_L1, edges);
LOG(INFO) << "done canny edge";
{
    // save
    time_t now = time(0);
    char *dt = ctime(&now);
    cv::imwrite("edge_out" + std::string(dt) + ".jpg", cv_dst);
}
vxReleaseImage(&filtered);
vxReleaseImage(&equalized);
cv_src.release();
cv_dst.release();
LOG(INFO) << "done release";
return 0;

}
edge_outTue Dec  8 07:36:57 2020 rocket
Thanks.

Hi,

Thanks for your feedback.
Let us check your sample and share more information later.

Thanks.

Hi,

We try to reproduce this issue, but the original post’s source seems incomplete and has some problems.
Could you share a complete source as well as the reproduced steps with us?

Thanks.

CMakeLists.txt (938 Bytes) main.cpp (2.4 KB) rocket

No missing file in original post.

There is no update from you for a period, assuming this is not an issue any more.
Hence we are closing this topic. If need further support, please open a new one.
Thanks

Hi,

May I know your environment setting first? Ex. JetPack version, dependencies, …
We cannot compile the above source due to a link error from NVX/Utility.hpp.

Thanks.