I write following function to add an image to a rendered window which contained point cloud, it failed
void addImageToview(vtkRenderWindowInteractor* interactor, vtkSmartPointer<vtkRenderWindow> renderWindow, const std::string &imagePath, double &x, double &y, double &x_wide, double &y_wide, double &opaticy)
{
vtkSmartPointer<vtkJPEGReader> reader = vtkSmartPointer<vtkJPEGReader>::New();
reader->SetFileName(imagePath.c_str());/*no multiple coding format*/
reader->Update();
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
//vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New(); //** comment out this line, the passed renderWindow will be erased.
renderWindow->AddRenderer(renderer);
// Create a vtkImageActor to display the image
vtkSmartPointer<vtkImageActor> imageActor = vtkSmartPointer<vtkImageActor>::New();
imageActor->SetInputData(reader->GetOutput());
imageActor->SetPosition(x, y,0);
// Add the image actor to the renderer as an overlay
renderer->AddActor2D(imageActor); // AddActor2D adds the actor as an overlay, keeping existing actors intact
}
where, vtkRenderWindowInteractor* interactor, vtkSmartPointer renderWindow contained point cloud,see blow
if I comment out this line marked by **, the passed renderWindow of function parameter will be erased. only the image showed,
I want to show both an image on the point cloud(put the image at given postion of the screen), like below,
how to implemented this function?