Category Archives: How to Fix

Convex hull detection and convex hull vertex solution of PCL point cloud Library

Convex hull detection of point cloud is more commonly used. PCL comes with Convex hull detection ConvexHull, which is a relatively simple function. Set the dimension setDimension of ConvexHull, and record it here
Header: #include <; pcl/surface/convex_hull.h>
	pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
	pcl::io::loadPCDFile<pcl::PointXYZ>("bun_45.pcd", *cloud);

	pcl::ConvexHull<pcl::PointXYZ> hull;                  
	hull.setInputCloud(cloud);                   
	hull.setDimension(3);

	std::vector<pcl::Vertices> polygons;                 
	pcl::PointCloud<pcl::PointXYZ>::Ptr surface_hull(new pcl::PointCloud<pcl::PointXYZ>);
	hull.reconstruct(*surface_hull, polygons);           

	cout << surface_hull->size() << endl;

	// ---------------------- Visualizer -------------------------------------------
	boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer(new pcl::visualization::PCLVisualizer);
	viewer->setBackgroundColor(255,255,255);

	pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_handler(cloud, 255, 255, 0);
	viewer->addPointCloud(cloud, color_handler, "sample cloud");
	viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 6, "sample cloud");

	pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> color_handlerK(surface_hull, 255, 0, 0);
	viewer->addPointCloud(surface_hull, color_handlerK, "point");
	viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 6, "point");

	//viewer->addPolygon<pcl::PointXYZ>(surface_hull, 0, 0, 255, "polyline");

	while (!viewer->wasStopped())
	{
		viewer->spinOnce(100);
	}

Adopting Stanford Rabbit Point Cloud, the effect is shown in the figure below:

If the point cloud in a certain convex hull is further separated from the scene, Crophull can be used for filtering
CropHull filtering can refer to: https://blog.csdn.net/zfjBIT/article/details/92795689
Thanks for the correction of Xiao snail. If we get the convex hull curve, further triangulation is needed. It is not correct to connect the convex hull points only

CMake_ Compiling VTK_ 9.0.0 running vtkcommoncolor DLL has access conflict

https://blog.csdn.net/weixin_42291376/article/details/105745115 in this place Here also thanks to the original blogger

0x00007FF8959AD270 (VTKCommonColour 9.0.dll) Exception: 0xC0000005: Access conflict occurs when reading position 0x0000009469200000.

ah
Then check to post an article
https://blog.csdn.net/qq_42641977/article/details/107687726.
linker – input – attached dependency 9.0.lib suffix has been removed.

0xc0000005: solution to access conflict when writing to location 0x00000000

I am a novice, in fact, I am not very clear about this thing, of course, it is impossible to list all the cases, here I just see their own possible situation to do a summary:
The idea above is that you are paying a value to a variable that should not be assigned, or that you are paying a value to a variable (or constant) that cannot be paid
(1) The simplest and most straightforward error is probably the problem with scanf(). We all know that scanf(“% format “,& Variable), then in addition to the string (you can call & , but not), all input is required & If you lose it, you won’t be able to find it on many compilers when it’s mutated, meaning it’s not wrong, but the reason why it’s wrong is because the input data is written as scanf(“% format “, variable), so you don’t know where the input variable will be stored.
(2) Null pointer assignment.
We know that if a pointer is empty is not directly to his assignment is the cause of null Pointers don’t know what the dow was, so he has no fixed memory, now you give his assignment, popular point to understand is that he don’t know how to save, also don’t know what there is, will not be stored, but now you have a need to let him storage, then it will appear afore-mentioned problems, then the solution is to apply for space (using malloc or new), or you try to avoid him to become a null pointer, or when he has become the possibility of a null pointer, you can discuss separately.
Here are a few examples of what is possible:

int * p = 0;
int * p = 0;
p [0] = 100;
of course, it can’t be that obvious in actual code, this is just one example, may be similar, this is you have a good look at yourself, the above 0 and NULL is actually the same, that is, NULL pointer assignment.

a=(double*)malloc(sizeof(double)*6);
h=……
a[0]=h;
First of all you don’t know if malloc is going to succeed or not and if it fails it happens to return NULL and normally you can allocate this amount of memory and it won’t fail but as you said after a couple of loops you might not be free or you might run out of memory or you might fragment and malloc fails and you don’t know so the exact problem is that you assign a NULL pointer to an exception

The following three Pointers are available online: You can compare them with your own:

1:
ar *p;
p = new char[number];
delete [] p;

// always using p….
p = XXX;// access violation

2:
char * p;
memcpy (p, XXX, number); // Access Cheesecake
char *p;
p = new char[number];
delete [] p;

delete [] p;// the access violation
0xC0000005: Access Cheesecake error debug —

Added a word no problem: (1) compile time
(2) the runtime is a loop calculation, set breakpoints, before a few cycle are no problem, to which a certain cycle (end of cycle conditions have not reached) will appear these problems.
You must be assigning the null pointer somewhere in the middle of the step.
(3) Array or pointer out of bounds
As long as it is related to memory is basically possible, of course, array or pointer out of bounds, this is also very common, this will not give examples, I believe that everyone can understand what consciousness, also know how to solve, this requires you to be more careful and careful.

0xc0000005: an access conflict occurred while reading location 0x00000020

0x in.exe… Unhandled exception at: 0xC0000005: Access conflict occurred while reading position 0x00000020

Error: : PostMessage (AfxGetMainWnd () – & gt; M_hWnd, UM_XX, 0, 0);

or: : sendMessage (
AfxGetMainWnd()-> M_hWnd, UM_XX, 0, 0);

How to solve it?
Verify that afxGetMainWnd () returns NULL

int k = (int)(& (((CWnd*)NULL)-> m_hWnd));
The value of k is 0x20

In general: afXGetApp ()-> GetMainWnd (); AfxGetMainWnd() is used only on the main thread;

How: foreground thread and background thread, afxGetApp ->; GetMainWnd() differs from AFXGetMainWnd ()

AFXGetMainWnd () is an example of a window handle that can be used to retrieve a window handle. AFXGetMainWnd () is an example of a window handle that can be used to retrieve a window handle. Clever you must have already understand, if you have been tracking AfxGetMainWnd () call, will find that it earned a AFX_MODULE_THREAD_STATE threading module save active threads in the window handle, and a background thread since no window, then obtains the window handle is you from??(maybe someone’s understanding of the background is not display window, even with all the window, as long as it doesn’t show is a background thread, strictly speaking is not the case, the window is mainly used to interact with the user, a window is hard to avoid jam, And the background thread is often used to carry out some behind the operation or processing, is through the foreground information or data to carry out the corresponding operation, if the window is hidden to talk about what information transfer?The case can not be done in the background like other threads. The key is to know the difference and how to use it.)
AfxGetApp()-> GetMainWnd () is the main window handle, no matter in that thread calls are no problem, because it is first obtained the main thread handle, to achieve the main thread of the active window (such as switch view can lead to replacement, I am not sure this kind of circumstance), if there is no active window is the main window, any program must have a main window, so it calls there is no problem, if you want to achieve the program’s main window suggested AfxGetApp () – & gt; GetMainWnd().
Note that the console program has no window and its window handle is always 0. Second, the background thread is actually a desktop control program, just not the main thread. Also, threads created using functions such as API CreateThread cannot generate CWinThread objects. So if you want to use CWinThread object function, and some of the global function, as AfxGetMainWnd (), you must use CWinThread object CreateThread function, or use the AfxBeginThread () function creates a thread, or may be an error, because the MFC to the management of the thread is done through the CWinThread object, it is not hard to see through the tracking code below you. I remember that there was a predecessor once mentioned this problem, but I do not know whether it understands the reason
Here is the trace code:
_AFXWIN_INLINE CWnd* AFXAPI AfxGetMainWnd()
{ CWinThread* pThread = AfxGetThread();
return pThread! = NULL ?pThread-> GetMainWnd() : NULL; }

CWinThread* AFXAPI AfxGetThread()
{
// check for current thread in module thread state
AFX_MODULE_THREAD_STATE* pState = AfxGetModuleThreadState();
CWinThread* pThread = pState-> m_pCurrentWinThread;
// if no CwinThread for the module, then use the global app
if (pThread == NULL)
hread = afxGetApp ();
return pThread;
}
You can see that calling afxgetMainwnd () on the main thread is not a problem (except for console programs) because it returns the main thread handle if the fetched thread handle is empty.
_AFXWIN_INLINE CWinApp* AFXAPI AfxGetApp()
{ return afxCurrentWinApp; }

CWnd* CWinThread::GetMainWnd()
{
if (m_pActiveWnd ! = NULL)
return m_pActiveWnd;// probably – place in active
// when not inplace active, just return main window
if (m_pMainWnd ! = NULL)
return m_pMainWnd;
return CWnd::GetActiveWindow();
}
I don’t need to worry about AFXCurrentInApp.
Hey hey, all finished, if your program exists similar to the above problems can be sure to change back oh.

Opencv: 0xc0000005: an access conflict occurred while reading location 0x0000000010

In the use of OpenCV hog + SVM for pedestrian detection reference when the big ideas and programs: https://blog.csdn.net/u011263315/article/details/41447545, is very much, but will be treated as positive and negative samples is good, the file path is still have after modification for their error as shown in the figure below:

Basically the error location is shown here:

For a long time, I did not know why it was wrong, and I consulted a lot of information but failed to solve it, which troubled me for a whole week. Finally, I solved the problem with the help of another big man, as follows:
At first, if we trace the alpha parameter, we find that it is not identified. Basically, there is no value assigned at all. At first, we thought that the problem was integrated from the ml.hpp file, and neither the existing.xml file nor the self-trained one had the value. Then the following a program about generating classifier and test files are commented out, to step through the part of sample training, found from the file name where you are to become very strange, basically to imread position could not read from the file image, then we do not have the right to read from the file to wrong image, according to this train of thought to make themselves the way in which to read file, specific procedures reference of the below: https://www.cnblogs.com/zhuwei1988/p/5746637.html, after the application is running through the test can also be trained classifier.
My environment is VS2013+OpenCV2.4.9, if other users have other errors, it is probably a version problem…
The programmer patiently read through the error line by line until he found the reason for the error… Record the process in order to avoid later have similar mistakes do not know how to debug……

Unhandled exception: 0xc0000005: access violation while reading location 0x00000000

Unhandled exception: 0xC0000005: Access conflict occurred while reading position 0x00000000

In the process of using, there was a mistake in the title, first of all, I searched some methods on the Internet, and finally solved it with a lot of effort.
About 0xC0000005:
0xC0000005: Access Cheesecake error debug —
1 “data out of bounds or defined pointer not freed.
2: Null Pointers are most likely. It is best to explicitly assign values before using Pointers!
should be a pointer problem
3 “memory access error, check the pointer, whether empty, whether out of bounds, etc

1:
ar *p;
p = new char[number];
delete [] p;

// always using p….
p = XXX;// access violation

2:
char * p;
memcpy (p, XXX, number); // Access Cheesecake
char *p;
p = new char[number];
delete [] p;

delete [] p;// the access violation
http://hi.baidu.com/yuruntsinghua/item/61dfa34e89809793823ae14d

C / C + + error handling (document): unhandled exception: 0xc0000005: access violation while reading location 0x00000000

Environment: VS2005
Code:
#include “stdafx.h”// Add include {
cout< <” argc=”< < argc< < endl;
for(int i=0; i< argc; I++)
{
wcout< <” argv[0]=”< < argv[0]< < endl;
}
cin.get();
return 0;
}
br> <>>
>
Unhandled exception: 0xC0000005: Access conflict occurred while reading position 0x00000000

Memory error unhandled exception: 0xc0000005: read location: 0x00000

The original address: memory error an unhandled exception: 0 xc0000005: read position 0 x00000000 access conflict
Author: tracy_leaf

About 0xC0000005:

0 xc0000005: Access Violation error debugging –
1 “data out of bounds or defined pointer not freed.
2: Null Pointers are most likely. It is best to explicitly assign values before using Pointers! br> s>d be a pointer problem
3 “memory access error, check the pointer, whether empty, whether out of bounds, etc
Possibility 3 of
1:
char * p; The
p = new char [number]. The
delete [] p; The
… The
// always using p… The
p = XXX; // access violation

2:
char * p;
memcpy (p, XXX, number); // access violation

3:
char * p; The
p = new char [number]. The
delete [] p; The
… The
delete [] p; // access violation

Null pointer.. Builder is because the cycle condition was modified to delete not to change back and debug for a long time.

in addition, a pile of damaged errors, too much is new, and not delete, then need to switch to GlobalAlloc to allocate memory.

There is an unhandled exception at: 0xc0000005: an access conflict occurred while reading location 0x00000000.

turn
First, exclude a small probability event that is caused by system conflict. For example, if there is a similar third-party library file in the system disk directory, the program will crash and report an error of 0xC0000005: access conflict occurs when reading position 0x00000000.
You’re paying a value to a variable that shouldn’t be assigned, or you’re paying a value to a variable (or constant) that can’t be paid.
(1) The simplest and most straightforward error is probably the problem with scanf(). We all know that scanf(“% format “,& Variable), then in addition to the string (you can call & , but not), all input is required & If you lose it, you won’t be able to find it on many compilers when it’s mutated, meaning it’s not wrong, but the reason why it’s wrong is because the input data is written as scanf(“% format “, variable), so you don’t know where the input variable will be stored.
(2) Null pointer assignment.
We know that if a pointer is empty can’t directly to his assignment, the reason is null Pointers don’t know what the dow was, so he has no fixed memory, now you give his assignment, popular point to understand is that he don’t know how to save, also don’t know what there is, will not be stored, but now you have a need to let him storage, then it will appear afore-mentioned problems, then the solution is to apply for space (using malloc or new), or you try to avoid him to become a null pointer, or when he has become the possibility of a null pointer, you can discuss separately.
Here are a few examples of what is possible:

int * p = 0;
int * p = 0;
p[0] = 100;
of course, it can’t be that obvious in actual code, this is just one example, may be similar, this is you have a good look at yourself, the above 0 and NULL is actually the same, that is, NULL pointer assignment.

a=(double*)malloc(sizeof(double)*6);
h =…
a[0]=h;
First of all you don’t know if malloc is going to succeed or not and if it fails it happens to return NULL and normally you can allocate this amount of memory and it won’t fail but as you said after a couple of loops you might not be free or you might run out of memory or you might fragment and malloc fails and you don’t know so the exact problem is that you assign a NULL pointer to an exception
The following three Pointers are available online: You can compare them with your own:

1:
ar *p;
p = new char[number];
delete [] p;

// always using p…
p = xxx; // access violation
2:
char *p;
memcpy(p, xxx, number); // access violation
3:
char *p;
p = new char[number];
delete [] p;

delete [] p; // access violation
0xC0000005: Access Cheesecake error debug —
Add a word:
No problem (1) compile time
(2) the runtime is a loop calculation, set breakpoints, before a few cycle are no problem, to which a certain cycle (end of cycle conditions have not reached) will appear these problems.
You must be assigning the null pointer somewhere in the middle of the step.
(3) Array or pointer out of bounds
As long as it is related to memory is basically possible, of course, array or pointer out of bounds, this is also very common, this will not give examples, I believe that everyone can understand what consciousness, also know how to solve, this requires you to be more careful and careful.

Bug resolution of 0xc0000005: access conflict occurred when reading location of 0x00000000.

The error is as follows:


Error cause:
There’s a section in the program called cout <; < string; //char string[] But didn't notice that string can also be NULL, This leads to errors. Error analysis: When string is a null pointer, cout calls strlen to get the length of the string before printing it. So you need to access the null pointer (that is, the memory address of 0), and once the program accesses this memory, the system raises an exception, thus reporting an error.

Unhandled exception at 0x00000000: 0xc0000005: access violation at position 0x0000000000

Anyway, here’s a picture:


After half a day’s search, I finally found the problem. Here are the details:
The dynamic library is called in a thread function, hInst = loadLibrary (“mydll/mydll.dll”); However, this library is Win32Debug, so the Win64Debug runtime will report the above error.
However, Win32 has the following problems:

This program was originally on a Windows 32-bit computer, now get my Windows 64-bit on such a problem, I do not know is the VS version of the problem, or 32-bit and 64-bit compatibility problems. Continue to verify, have the result again to continue.
If you run Debug Win64 on Windows 32, it will prompt you to dump 64 bits. If you run Debug Win64 on Windows 32, it will prompt you to dump 64 bits. It’s hard to make a program that’s not your own. I realized that I really can’t solve this problem. The problem is defined as a compatibility problem. If anyone has solved it, please let me know in the comments section.
The above solution is only the case I encountered, you may not be the same as this case, please do not take a peek.

[debug notes] pointer error when STD:: vector is used in VTK “access conflict when reading location XXX”

1. Build a vector tempActor;
2. Create Actor with VTKSmartPointer
3. Put the actor into tempActor using push_back;
4. Returns tempActor, as shown below.

std::vector<vtkActor*> tempActor;
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
tempActor.push_back(actor);
return tempActor;

After the compilation was successful, the execution error occurred, and an access conflict occurred when reading location XXX. The reason should be a pointer problem.
Solution: Instead of using vtksmartPointer, replace it with

vtkActor* actor = vtkActor::New();