pcl icon indicating copy to clipboard operation
pcl copied to clipboard

access violation reading position 0x0000000000000000

Open zeljko21 opened this issue 3 years ago • 8 comments

https://github.com/PointCloudLibrary/pcl/blob/d98313133b014553ab1b1b5b112f9aade837d55c/doc/tutorials/content/sources/narf_keypoint_extraction/narf_keypoint_extraction.cpp#L161

Hello,

I am a beginner with point cloud library and wanted to start by running some tutorials. When I tried the narf_keypoint_extraction following the steps from https://pcl.readthedocs.io/projects/tutorials/en/latest/narf_keypoint_extraction.html,I ran into an issue. The build with cmake was successful but a runtime error occured at line 161.

Error: Exception thrown at 0x00007FFF817356FD (vtkRenderingContext2D-9.0d.dll) in narf_keypoint_extraction.exe: 0xC0000005: access violation reading position 0x0000000000000000.

Exception

I read that this is due to dereferencing a null pointer but I don't understand why?

Shouldn't the tutorial work basically without any user input, as an example point cloud is generated, if no point cloud is passed by the user? Or am I forgetting something?

Any help is appreciated. Thank you!

zeljko21 avatar Feb 07 '22 09:02 zeljko21

Do you give any (command line) arguments to narf_keypoint_extrraction.exe? Which PCL version do you use and how did you install it?

mvieth avatar Feb 07 '22 12:02 mvieth

#5160 partly fixes this issue. However we also need to add:

vtk_module_autoinit(TARGETS pcl-narf-keypoints 
                    MODULES VTK::RenderingContextOpenGL2)

to the CmakeLists.txt tutorial. I couldn't get it to run without it. I wonder how we can propagate these autoinit downstream. EDIT: The target name needs to be changed accordingly. This was a copy paste from my local test.

larshg avatar Feb 07 '22 23:02 larshg

Do you give any (command line) arguments to narf_keypoint_extrraction.exe? Which PCL version do you use and how did you install it?

I tried it with command line arguments and without. E.g. an example point cloud but with the same result. The 3D viewer opens and shows the point cloud (either the one I give it or the generated rectangle depending on arguments). Then the Range Image window opens but doesn't show anything. Then the exception from above is thrown.

I installed it using the 1.12.1 All-in-One .exe.

zeljko21 avatar Feb 09 '22 11:02 zeljko21

#5160 partly fixes this issue. However we also need to add:

vtk_module_autoinit(TARGETS pcl-narf-keypoints 
                    MODULES VTK::RenderingContextOpenGL2)

to the CmakeLists.txt tutorial. I couldn't get it to run without it. I wonder how we can propagate these autoinit downstream. EDIT: The target name needs to be changed accordingly. This was a copy paste from my local test.

OK thank you. I will try to make it run using your fixes.

zeljko21 avatar Feb 09 '22 11:02 zeljko21

@zeljko21 have you managed to try out my fixes?

larshg avatar Feb 11 '22 23:02 larshg

I have the same problem at line 150.ont this tutorials https://pcl.readthedocs.io/projects/tutorials/en/latest/range_image_visualization.html#range-image-visualization

unclesammy avatar Apr 11 '22 12:04 unclesammy

I was having the same problem. I don't know the minimum changes that are necessary to get it to work, but this CMakeLists ended up working: cmake_minimum_required(VERSION 2.6 FATAL_ERROR) project(range_image_visualization) find_package(PCL 1.12 REQUIRED) find_package(VTK REQUIRED) include_directories(${PCL_INCLUDE_DIRS} ${VTK_USE_FILE} ${VTK_INCLUDE_DIRS}) link_directories(${PCL_LIBRARY_DIRS}) add_definitions(${PCL_DEFINITIONS}) add_executable (range_image_visualization CloudToRangeImage.cpp) target_link_libraries (range_image_visualization ${PCL_LIBRARIES} ${VTK_LIBRARIES}) vtk_module_autoinit( TARGETS ${PROJECT_NAME} MODULES ${VTK_LIBRARIES} )

oliteksamuelfogarty avatar May 27 '22 02:05 oliteksamuelfogarty

I tested this in #5284 and calling vtk_module_init() indeed appears to get it working. That macro appears to add a slew of preprocessor directives that apparently affect vtk initialization.

brlcad avatar Jun 09 '22 18:06 brlcad