Hello,
I am trying to use vxusobel3x3 API, which uses VX_DF_IMAGE_S16 format as parameter, and I'm getting status -10 error, which means parameters given are not proper. Can someone please help me with it?
Hello,
I am trying to use vxusobel3x3 API, which uses VX_DF_IMAGE_S16 format as parameter, and I'm getting status -10 error, which means parameters given are not proper. Can someone please help me with it?
Hi,
Parameter not proper may due to non-supported input parameter.
Just check openvx spec, sobel3x3 doesn’t support s16 format.
For more detail:
Thanks.
Hello,
Thank you so much for the reply.
Its is mentioned that it should be S16, (VX_DF_IMAGE_S16)
I gave the format in reference to that itself.
render->putImage() is not taking format S16. I dont think it supoorts that.
Hi,
Double check openvx spec pasted in #2: (in chapter2, page18)
Sobel3x3 doesn’t support S16 as input but be able to covert S16 as output.
Thanks.
Hi,
Thank you so much. I guess I was not clear about my question.
Yes I am using U8 for input, and for Output I am giving S16 ,now its working fine. I want to display the output image for that I am using render->putImage(output_image) and output Image is in S16 format. May be because of that I am not able to render.
Hi,
Thanks for your feedback and also apologize for my misunderstood.
I wrote a small sample and hope it be helpful to you.
#include <cmath>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <memory>
//#include <NVX/nvx.h>
//#include <NVX/nvx_timer.hpp>
//#include <NVXIO/Application.hpp>
//#include <NVXIO/ConfigParser.hpp>
#include <NVXIO/FrameSource.hpp>
#include <NVXIO/Render.hpp>
//#include <NVXIO/SyncTimer.hpp>
//#include <NVXIO/Utility.hpp>
int main(int argc, char** argv)
{
std::string sourceUri = "/home/ubuntu/VisionWorks-1.5-Samples/data/signs.avi";
nvxio::Application &app = nvxio::Application::get();
app.addOption('s', "source", "Input URI", nvxio::OptionHandler::string(&sourceUri));
app.init(argc, argv);
nvxio::ContextGuard context;
std::unique_ptr<nvxio::FrameSource> source(nvxio::createDefaultFrameSource(context, sourceUri));
source->open();
nvxio::FrameSource::Parameters frameConfig = source->getConfiguration();
std::unique_ptr<nvxio::Render> render(
nvxio::createDefaultRender(context, "Test", frameConfig.frameWidth, frameConfig.frameHeight));
vx_image frame = vxCreateImage(context, frameConfig.frameWidth, frameConfig.frameHeight, VX_DF_IMAGE_RGBX);
vx_image disp_dX = vxCreateImage(context, frameConfig.frameWidth, frameConfig.frameHeight, VX_DF_IMAGE_U8);
vx_graph graph = vxCreateGraph(context);
vx_image virt_U8 = vxCreateVirtualImage(graph, 0, 0, VX_DF_IMAGE_U8);
vx_image virt_dX = vxCreateVirtualImage(graph, 0, 0, VX_DF_IMAGE_S16);
vx_image virt_dY = vxCreateVirtualImage(graph, 0, 0, VX_DF_IMAGE_S16);
vx_int32 shift = 0;
vx_scalar s_shift = vxCreateScalar(context, VX_TYPE_INT32, &shift);
vx_node cvtImgNode = vxColorConvertNode(graph, frame, virt_U8);
vx_node sobel3x3Node = vxSobel3x3Node(graph, virt_U8, virt_dX, virt_dY);
vx_node cvtDepthNode = vxConvertDepthNode(graph, virt_dX, disp_dX, VX_CONVERT_POLICY_SATURATE, s_shift);
vx_status verify_status = vxVerifyGraph(graph);
vxReleaseImage(&virt_U8);
vxReleaseImage(&virt_dX);
vxReleaseImage(&virt_dY);
while (true)
{
nvxio::FrameSource::FrameStatus status = source->fetch(frame);
if (status != nvxio::FrameSource::OK) break;
NVXIO_SAFE_CALL( vxProcessGraph(graph) );
render->putImage(disp_dX);
render->flush();
}
vxReleaseNode(&cvtImgNode);
vxReleaseNode(&sobel3x3Node);
vxReleaseNode(&cvtDepthNode);
vxReleaseImage(&frame);
vxReleaseImage(&disp_dX);
return nvxio::Application::APP_EXIT_CODE_SUCCESS;
}
Hi,
Thank you so much for the code. It was really helpful.